Saturday, January 26, 2013

INFO Bios


http://www.bioscentral.com/misc/biosbasics.htm

IntroductionThe Boot ProcessBIOS and Boot SequencesBIOS ManufacturersBIOS and CMOS IntroductionInside every PC out there is BIOS, which stands for Basic Input Output System.  In a nutshell, BIOS is software that interacts between a computers hardware and the operating system and software applications.  There are several types of BIOS', ranging from the motherboard ROM BIOS to adapter BIOS' such as video BIOS, drive controller BIOS, network adapter BIOS, SCSI adapter BIOS, etc... These BIOS' are the lowest level of software in a computer providing a set of small programs or software routines that allow the hardware of a computer to interact with the operating system by a set of standard calls.I hope to provide a through understanding of how the BIOS works and leave you with a better understanding of it's interworkings. At the same time, I hope to show how complex a BIOS is in relation to it's relationship with the operating system and the software applications you use everyday. Enjoy.The Boot ProcessTo get to the operating system, a computer must first boot from the BIOS.  The BIOS performs a number of tasks when a computer is started.  From initializing the microprocessor to initializing and testing hardware to starting the operating system.  Starting a computer is not a simple task.  It's a methodical process that is performed every time power is applied to computer.  Here is a detailed description of the boot process.  This process will vary with different computers and different BIOS', but the overall goal is the same. When you first turn on a computer the very first operation performed by the CPU is to read the address space at FFFF:0000h. This address space it reads from is only 16 bytes, which is not nearly enough space to house the BIOS found on a motherboard.  Instead, this location contains a special instruction called a jump command (JMP) that tells the processor where to go to find and read the actual BIOS into memory.  The process of the processor reading the jump instruction and redirection to the actual BIOS is called the bootstrap or boot. So, when you apply power, it's not the operating system that's working. It's the BIOS.First, I want to get something straight.  The CMOS and the BIOS are two different things.  The BIOS refers to the firmware instructions that are located on the BIOS ROM.  CMOS refers to the low-power RAM that holds the system's setup parameters.  The BIOS reads the CMOS RAM into memory at boot up and provides the setup routine that allows you to change the contents of CMOS, but the CMOS RAM/RTC device is a totally different IC.  The CMOS holds the information provided by the BIOS.  This is why you "lose" the settings of a system when the battery dies or you clear the CMOS through a jumper on the motherboard.With today's high performance 32 bit operating systems, the BIOS becomes less used, but it is still there, always interacting with the operating system. Disk access, for example, is done through the operating system with 32-bit routines, whereas the BIOS is using 16-bit routines. Although the BIOS provides VGA support, Windows and other 32-bit operating systems use software device drivers to work with the hardware.  Early OS's, like DOS, worked with the BIOS.  DOS relied on the BIOS to perform most functions, like displaying characters on the screen or sending output to the printer, reading input from the keyboard and other essential tasks. These drivers, which operate in protected mode(since they aren't written for real mode, they are able to use memory above the 1MB barrier that real mode provides), allow for several enhancements.   They can access more memory, can be written in 32-bit code for optimized execution and are not limited to the amount of space available to their code. However, regardless of OS, whether it's Windows 2000, Linux or DOS, the BIOS and the operating system still interact with each other.Here is a basic rundown of what is happening:   1.  Power is applied to the computer   When power is applied to the system and all output voltages from the power supply are good, the power supply will generate a power good signal which is received by the motherboard timer.  When the timer receives this signal, it stops forcing a reset signal to the CPU and the CPU begins processing instructions.    2.  Actual boot    The very first instruction performed by a CPU is to read the contents of a specific memory address that is preprogrammed into the CPU.  In the case of x86 based processors, this address is FFFF:0000h.   This is the last 16 bytes of memory at the end of the first megabyte of memory.   The code that the processor reads is actually a jump command (JMP) telling the processor where to go in memory to read the BIOS ROM.  This process is traditionally referred to as the bootstrap, but now commonly referred to as boot and has been broadened to include the entire initialization process from applying power to the final stages of loading the operating system.   3.  POST    POST stands for Power On Self Test.  It's a series of individual functions or routines that perform various initialization and tests of the computers hardware.  BIOS starts with a series of tests of the motherboard hardware.  The CPU, math coprocessor, timer IC's, DMA controllers, and IRQ controllers. The order in which these tests are performed varies from mottherboard to motherboard. Next, the BIOS will look for the presence of video ROM between memory locations C000:000h and C780:000h.  If a video BIOS is found, It's contents will be tested with a checksum test.  If this test is successful, the BIOS will initialize the video adapter. It will pass controller to the video BIOS, which will inturn initialize itself and then assume controller once it's complete.  At this point, you should see things like a manufacturers logo from the video card manufacturer video card description or the video card BIOS information.  Next, the BIOS will scan memory from C800:000h to DF800:000h in 2KB increments.  It's searching for any other ROM's that might be installed in the computer, such as network adapter cards or SCSI adapter cards. If a adapter ROM is found, it's contents are tested with a checksum test.  If the tests pass, the card is initialized. Controller will be passed to each ROM for initialization then the system BIOS will resume controller after each BIOS found is done initializing. If these tests fail, you should see a error message displayed telling you "XXXX ROM Error".  The XXXX indicates the segment address where the faulty ROM was detected.  Next, BIOS will begin checking memory at 0000:0472h.  This address contains a flag which will tell the BIOS if the system is booting from a cold boot or warm boot.  A value of 1234h at this address tells the BIOS that the system was started from a warm boot. This signature value appears in Intel little endian format , that is, the least significant byte comes first, they appear in memory as the sequence 3412. In the event of a warm boot, the BIOS will will skip the POST routines remaining.  If a cold start is indicated, the remaining POST routines will be run.  During the POST test, a single hexadecimal code will be written to port 80h.  Some other PC's send these codes to other ports however. Compaq sends them to port 84h, IBM PS/2 model 25 and 30 send them to port 90h, model 20-286 send them to port 190h. Some EISA machines with an Award BIOS send them to port 300h and system with the MCA architecture send them to port 680h. Some early AT&T, Olivetti, NCR and other AT Clones send them to the printer port at 3BC, 278h or 378h. This code will signify what is being tested at any given moment.   Typically, when the BIOS fails at some point, this code will tell you what is failing.    4.  Looking for the Operating System    Once POST is complete and no errors found, the BIOS will begin searching for an operating system.   Typically, the BIOS will look for a DOS Volume Boot Sector on the floppy drive.   If no operating system is found, it will search the next location, the hard drive C.  If the floppy drive (A), has a bootable floppy in it, the BIOS will load sector 1, head 0, cylinder 0 from the disk into memory starting at location 0000:7C00h.  The first program to load will be IO.SYS, then MSDOS.SYS.  If the floppy does not contain a DOS volume boot sector, then BIOS will next search the computers hard drive for a master partition boot sector and load it into memory at 0000:7C00h.  There are some occasions in which you will encounter problems with the proper loading of the Volume Boot Sector.  Below are some of those:            A.  If the first byte of the Volume Boot Sector is less than 6h, then you will receive a message similar to "Diskette boot record error".            B.  If the IO.SYS or MSDOS.SYS are not the first two files in the Volume Boot Sector, then you will see a message similar to "Non-system disk or disk error".            C.  If the Volume Boot Sector is corrupt or missing, you will get a message similar to "Disk boot failure"Once the BIOS has searched for a bootable floppy device, it should turn it's attention to the next boot device it's programmed to look for.  The next device is typically the hard drive, or C.   Like a floppy drive, the BIOS will attempt to load the Volume Boot Sector from sector 1, head 0, cylinder 0 from the Master Boot Sector, or MBS, into memory starting at 0000:7C00h.  The BIOS will check the last two bytes of the MBS.  They should be 55h and AAh respectively.  If they are not, then you will receive an error message similar to "No boot device available" and "System initialization will halt".  If they are correct, then the BIOS will continue the loading process.   At this point, the BIOS will scan the MBR in search of any extended partitions.   If any extended partitions are identified, the original boot sector will search for a boot indicator byte which indicates a active and bootable partition.  If it cannot find one, you will receive a message similar to "Invalid partition table".At this, once a active partition is found, the BIOS will search for a Volume Boot Sector on the bootable partition and load the VBS into memory and test it.  If the VBS is not readable or corrupt, you will see a message similar to "Error loading operating system".  At the point, the BIOS will read the last two bytes of the VBS.  These bytes should be 55h and AAh respectively.  If they are not, then you will see a message similar to "Missing operating system"  It is at this point that the BIOS will begin loading of the operating system. Plug and PlayIntel and Microsoft took the first stab at Plug and Play with the specification for ISA on May 28, 1993. Later, Compaq, Phoenix and Intel developed the BIOS specification for Plug and Play, first released on November 1, 1993. Plug and Play requires three elements of the system be written to it's standards. The motherboard BIOS, the operating system, and the boards and peripherals attached to the PC. Devices that don't conform are considered legacy devices.The basic procedure for plug and play is a three step process. First, the system checks what resources are needed for each expansion device. Next, the system coordinates assignments to IRQ's, DMA's and I/O Ports to avoid conflicts and finally, the system tells the software what choices it has made. In order to do this, the BIOS calls upon specific features of a plug and play expansion board. To achieve this, the expansion board must be able to deactivate itself from normal control signals to avoid conflicts with other devices. In addition to this, each expansion board has registers that are accessed through standard I/O port addresses so the BIOS and operating system can configure the board. These ports are Address, Write Data and Read Data.The Address port functions like a pointer the expands the control registers accessible to your system without stealing more system resources. The plug and play specification defines eight card control registers and two large ranges. One range of 24 registers for future expansion of the standard and another 16 registers for board makers for their own purposes. The Address port allows the Write Data port to choose which logical devices reactive and the resources used by them. Some boards, such as video adapters and disk controller cards, start up active because they are needed at bootup. Other devices, such as sound cards, modems and such come up inactive during boot and wait to be configured for use by the operating system. Typically, any board that starts up inactive, stays this way until specifically activated by the operating system. Every plug and play board has specific circuitry that handles this configuration process, always monitoring the signals of the bus. Every plug and play devices operates in four states. Wait for Key, Isolation, Configuration and Sleep.All plug and play devices, whether inactive or active, bootup in their Wait for Key state. In this state, each board will refuse to respond until they receive the Initialization Key. This Initialization key is a 32-step process between the host system and each expansion board. In order for the initialization to be successful, this 32-step must be correct. Once this is successful, the expansion board shifts itself into Sleep.BIOS and Boot SequencesAmerican MegatrendsPhoenix Technologies1Disable the NMICheck the CPU2Power-on DelayTest CMOS RAM3Initialize chipsetsBIOS ROM checksum4Reset determinationTest chipset(s)5BIOS ROM checksumTest PIT6Keyboard testTest DMA7CMOS shutdown checkTest base 64KB memory8Controller disableCheck serial and parallel ports9Disable videoTest PIC10Detect memoryCheck the Keyboard Controller (KBC)11PIT testVerify CMOS data12Check memory refreshVerify video system13Check low address linesTest RTC14Check low 64KB RAMTest CPU in protected mode15Initialize support IC'sVerify PIC 216Load INT vector tableCheck NMI17Check the Keyboard Controller (KBC)Check the keyboard18Video testsCheck the mouse19Load the BDACheck system RAM20Test memoryTest disk controller21Check DMA registersSet shadow RAM areas22Check the keyboardCheck extended ROMs23Perform high-level testsTest cache controller24Load the OSTest CPU cache25Check hardware adapters26Load the OS BIOS ManufacturersThere are a number of BIOS manufacturers, but the three leader's are Phoenix Software, American Megatrends and Award Software.  Each of these BIOS manufacturers produce BIOS's for PC's and each has it's strong points and weaknesses.  It is not my goal or intention to lean towards one manufacturer over the other.  One of my PC's has an Award BIOS and the other has a AMI BIOS, so these are the BIOS's in which I will be using for most of this discussion.The BIOS FunctionsThe BIOS is comprised of several independent functions or routines that are distinct from one another. Even though these routines are separate and distinct from one another, they get stored in the same memory location. The BIOS is way to refer to each of these separate functions as a entire group. There are functions that test the computer, routines to let software take control, and PnP (in some) to determine which peripherals are installed and that these components do not conflict with one another in I/O activities and memory allocation. (Under construction)



Offset HexOffset DecBIOS ServiceField SizeFunction00h0Int 14h2 bytesBase I/O address for serial port 1 (communications port 1 - COM 1)02h2Int 14h2 bytesBase I/O address for serial port 2 (communications port 2 - COM 2)04h4Int 14h2 bytesBase I/O address for serial port 3 (communications port 3 - COM 3)06h6Int 14h2 bytesBase I/O address for serial port 4 (communications port 4 - COM 4)08h8Int 17h2 bytesBase I/O address for parallel port 1 (printer port 1 - LPT 1)0Ah10Int 17h2 bytesBase I/O address for parallel port 2 (printer port 2 - LPT 2)0Ch12Int 17h2 bytesBase I/O address for parallel port 3 (printer port 3 - LPT 3)0Eh14POST2 bytesBase I/O address for parallel port 4 (printer port 4 - LPT 4) (Only found in PC/XT systems)10h16Int 11h2 bytesEquipment Word    Bits 15-14 indicate the number of parallel ports installed    00b = 1 parallel port    01b = 2 parallel ports    03b = 3 parallel ports    Bits 13-12 are reserved    Bits 11-9 indicate the number of serial ports installed    000b = none    001b = 1 serial port    002b = 2 serial ports    003b = 3 serial ports    004b = 4 serial ports    Bit 8 is reserved    Bit 7-6 indicate the number of floppy drives installed    0b = 1 floppy drive    1b = 2 floppy drives    Bits 5-4 indicate the video mode    00b = EGA or later    01b = color 40x25    10b = color 80x25    11b = monochrome 80x25    Bit 3 is reserved    Bit 2 indicates if a PS/2 mouse is installed    0b = not installed    1b = installed    Bit 1 indicated if a math coprocessor is installed    0b = not installed    1b = installed    Bit 0 indicated if a boot floppy is installed    0b = not installed    1b = installed12h18POST1 byteInterrupt flag - Manufacturing test13h19Int 12h2 bytesMemory size in Kb15h21 2 bytesError codes for AT+; Adapter memory size for PC and XT17h22Int 16h1 byteKeyboard shift flags 1    Bit 7 indicates if Insert is on or off    0b = Insert off    1b = Insert on    Bit 6 indicates if CapsLock is on or off    0b = CapsLock off    1b - CapsLock on    Bit 5 indicates if NumLock is on or off    0b = NumLock off    1b = NumLock on    Bit 4 indicates if ScrollLock is on or off    0b = ScrollLock off    1b = ScrollLock on    Bit 3 indicates if the Alt key is up or down    0b = Alt key is up    1b = Alt key is down    Bit 2 indicates if the Control key is up or down    0b = Control key is up    1b = Control key is down    Bit 1 indicates if the Left Shift key is up or down    0b = Left Shift key is up    1b = Left Shift key is down    Bit 0 indicates if the Right Shift key is up or down    0b = Right Shift key is up    1b = Right Shift key is down18h23Int 16h1 byteKeyboard shift flags 2    Bit 7 indicates if the Insert key is up or down    0b = Insert key is up    1b = Insert key is down    Bit 6 indicates if the CapsLock key is up or down    0b = CapsLock is key is up    1b = CapsLock key is down    Bit 5 indicates if the NumLock key is up or down    0b = NumLock key is up    1b = Numlock key is down    Bit 4 indicates if the ScrollLock key is up or down    0b = ScrollLock key is up    1b = ScrollLock key is down    Bit 3 indicates if the Pause key is active or inactive    0b = pause key is inactive    1b = Pause key is active    Bit 2 indicates if the SysReg key is up or down    0b = SysReg key is up    1b = SysReg key is down    Bit 1 indicates if the Left Alt key is up or down    0b = Left Alt key is up    1b = Left Alt key is down    Bit 0 indicates if the Right Alt key is up or down    0b = Right Alt key is up    1b = Right Alt key is down19h24Int 09h1 byteAlt Numpad work area1Ah26Int 16h2 bytesPointer to the address of the next character in the keyboard buffer1Ch28Int 16h2 bytesPointer to the address of the last character in he keyboard buffer1Eh60Int 16h32 bytesKeyboard buffer3Eh61Int 13h1 byteFloppy disk drive calibration status    Bits 7-4 are reserved    Bit 3 = floppy drive 3 (PC, XT)    Bit 2 = floppy drive 2 (PC, XT)    Bit 1 = floppy drive 1    Bit 0 = floppy drive 0    0b indicates not calibrated    1b indicates calibrated3Fh62Int 13h1 byteFloppy disk drive motor status    Bit 7 indicates current operation    0b = read or verify operation    1b = write or format operation    Bit 6 is not used    Bit 5-4 indicates drive select    00b = Drive 0    01b = Drive 1    10b = Drive 2 (PC, XT)    11b = Drive 4 (PC, XT)    Bit 3 indicates drive 3 motor    0b = motor off    1b = motor on    Bit 2 indicates drive 2 motor    0b = motor off    1b = motor on    Bit 1 indicates drive 0 motor    0b = motor off    1b = motor on    0b = motor off    1b = motor on40h63Int 13h1 byteFloppy disk drive motor time-out41h64Int 13h1 byteFloppy disk drive status    Bit 7 indicates drive ready status    0b = drive ready 


--
Sent from hacked phone

No comments:

Post a Comment