PDA

View Full Version : Bios Question


paracelsus
03-08-2006, 10:34 AM
Hi all,

Until very recently, I have thought that BIOS is only used at the boot time. According to this view, x86 processor powers up in the real mode and starts to run the BIOS code for system checks and OS loading. Then, as the operating system is loaded, the system is switched to the protected mode. The BIOS code -which is written for real mode- becomes unavailable and never used again till the next power-up...

Recently, I have seen some references which caused me to question this belief. For example, I have read an article which said "BIOS is so heavily used by the OS that it is copied to faster RAM memory at the start-up".

So, my question is : Is BIOS ever used after the computer switched to protected mode, i.e, 2-3 seconds after the power up? Is it used by device drivers, for example?

Currently I am very confused on this matter. Any help will be greatly appreciated.

megamaced
03-08-2006, 10:37 AM
The BIOS is used extensively whilst your computer is on. All requests you make go to the OS, which in turn sends them to the BIOS. The BIOS controls the hardware at all times

paracelsus
03-08-2006, 11:05 AM
The BIOS is used extensively whilst your computer is on. All requests you make go to the OS, which in turn sends them to the BIOS. The BIOS controls the hardware at all times

I can agree with that. My problem is, I cannot see how it is possible.

An operating system is written in protected mode. For example, whenever it makes a memory reference, this reference goes through segment tables, page tables etc. Bios is real mode code. Its memory rererences does not go through such tables. So when the system is switched to protected mode, Bios code must became obsolete. It seems impossible that protected mode code can call real mode code.

One solution to this is virtual 8086 mode. But I have never heard anywhere that the OS uses v8086 mode to reach BIOS.

saphalline
03-08-2006, 07:20 PM
No no, you're mixing up a few things.

First of all, real mode and protected mode haven't been mutually exclusive since the 286! With the 386 came the advent of CPU-level mode switching without a hardware reset. Real mode and protected mode instructions can be executed side-by-side without a problem. They never interfere with eachother and they never "crash" eachother. Moreover, protected mode is old stuff. It's now referred to under the blanket term "x86" which implies 32-bit x86-based instructions, and this can also be referred to under the blanket term "586" meaning Pentium-class instructions. Since then, other modes have been added to the mix, such as MMX and SSE on Intel's side. x86-based instructions do not stand still.

Second of all, what you quoted is true yet it isn't... For older hardware and operating systems, yes, the BIOS is kept in memory and used for low-level access to certain resources. But many advancements such as DMA and the aggregation of functionality into ever fewer controllers in chipsets has all but demolished the reliance on the old BIOS methodology for modern systems. Intel is right now working on replacing the old BIOS idea that IBM started ages ago. Legacy resources and functions simply aren't used anymore, and if you look at the BIOS options on a modern mobo you'll see the option to disable system & video BIOS shadowing all together (which I always disable). In a modern PC with a 64-bit CPU and WinXP as the OS, the BIOS is useless once the OS is loaded and running.