BIOS: Difference between revisions

1,748 bytes added ,  5 years ago
m
Add a link to the IBM BIOS manual, which is a great reference for the arguments to the BIOS interrupt routines.
[unchecked revision][unchecked revision]
m (Added it to the category of "Firmware".)
m (Add a link to the IBM BIOS manual, which is a great reference for the arguments to the BIOS interrupt routines.)
 
(14 intermediate revisions by 11 users not shown)
Line 8:
==BIOS functions==
 
To access a BIOS function, you generally set the AH [[CPU Registers x86|CPU register]] (or AX, or EAX) to a particular value, and then do
an INT opcode. The value in AH (or AX, or EAX), combined with the particular interrupt number selected requests a specific
BIOS function. (Other CPU registers hold any "arguments" to the function, and often the return values from the function, also.)
Line 102:
Try to always test these error returns, because in many circumstances the BIOS functions might appear to be returning valid
(but very wrong) data -- rather than an error code.
 
 
==BIOS in Protected Mode==
Line 111 ⟶ 110:
 
If you must use Real Mode BIOS functions after the CPU has been switched into Protected Mode, then see [[Virtual 8086 Mode]],
or perhaps exit Protected Mode, and momentarily return to [[Real Mode]]. Both methods have associatedserious problems, soand trytherefore any calls to getthe BIOS should be done before any physical device is programmed by everythingyour youcode:
 
need from the BIOS before you ever enter Protected Mode.
* BIOS calls may use interrupts, which means that you need to forward IRQs or map the PIC back to its original configuration.
* BIOS calls may access devices that you have already configured - notably the PIT and PIC
* BIOS calls can enter protected mode on their own to access MMIO registers, which is beyond the limits of virtual 8086 mode.
* In real mode, you have no way of managing interrupts and your drivers may get stuck for interrupts being lost.
* In real mode, you have no control over time, performance and security guarantees.
 
The only device that's mostly exempt from these problems is the Video BIOS, which is not generally bundled with your motherboard and therefore can't rely on BIOS services either. Most current OSes - commercial and hobbyist alike - use a v8086 monitor or emulator to support graphics devices without a native driver so many BIOSes have been tested against such a set-up.
 
==BIOS in Long Mode==
 
Just like in [[Protected Mode]], BIOS functions are unavailable in [[Long Mode]] too. Unfortunately there's no [[Virtual 8086 Mode]] to come to the rescue. It is necessary to momentarily switch to [[Real Mode]], or to emulate a CPU and interpret opcodes by software. All necessary information for the latter approach can be found in Intel and AMD documentation.
 
==Additional Information from the BIOS==
Line 127 ⟶ 136:
 
=== Articles ===
* [[Real Mode OS Warning]]
* [[DMI]]
 
=== Threads ===
* [[Topic:23125|ASM example code about how to call BIOS function from Long Mode (by switching into RM and back again)]]
 
=== External Links ===
* [[wikipedia:BIOS | BIOS]] on Wikipedia]]
* [http://www.ctyme.com/intr/int.htm http://www.ctyme.com/intr/int.htm]
* [http://classiccomputers.info/down/IBM_PS2/documents/PS2_and_PC_BIOS_Interface_Technical_Reference_Apr87.pdf 1987 IBM BIOS Technical Reference]
 
[[Category:X86]]
[[Category:FirmwareBIOS]]
[[Category:Firmware]]
[[de:Basic Input Output System]]
Anonymous user