Lowest level details of x86
I am reading broken thorn operating system development series. I read about real mode and protected mode. I read that interrupts are not available in protected mode. I have to set a bit to switch between modes. I can code in real modes with the help of bios interrupts. All these are fine. But I want to know what is behind all these? What exactly happens when we switch off the PE flag in CR0? Why we can't use bio开发者_如何学Gos interrupts in protected mode? What is behind those bios interrupts? Why we have to use bios at all? How to directly interact with the hardware? How those 0's and 1's are making hardware to work? why these machine codes work? I want the lowest level details about all these things. Can anybody please suggest me a good book or link for this? Thanks in advance.
You have asked many questions there, and it would be time consuming to attempt to answer them all here.
I'll provide a couple of quick answers and some pointers to other resources that might help to provide you with the background knowledge you need to understand the answers to your questions.
Most of the PC BIOS routines are written in real mode and will not work correctly once the CPU is in protected mode; there are some BIOS routines that have a compatible 32-bit protected mode interface.
These days the PC BIOS is used mainly to bootstrap another operating system, after which the BIOS is hardly used. The PC BIOS was originally provided so that there could be an abstraction layer between the operating system and the underlying hardware so that operating systems could more easily run on different hardware without having to be customised for various (slightly) different hardware configurations. Gary Kildall and his CP/M operating system is often credited with being the first microcomputer operating system to have a BIOS.
Direct hardware programming is about as platform specific as you can get. You need to know exactly what chipsets, ports and their configuration your hardware has in order to program them.
The Indispensable PC Hardware Book by Messmer provides a comprehensive and readable introduction to the operation of the PC including the role of the BIOS and interrupts and CPU modes (eg. real, protected) as well as how machine code (1's and 0's) drive the hardware to realise our intended outcomes.
Other books which will go someway towards answering your questions, and maybe more acessible/available to you, include: Structured Computer Organisation by Tanenbaum, Digital Systems by Tocci.
Edit: For further technical detail you could try Intel Microprocessors by Brey (the latest edition covers up to the Core2 architecture), and then the Intel/AMD Developer Manuals (freely downloadable).
Sounds like you'd be bettered by reading the intel and amd developer manuals(not so much the per instruction sections, but the bigger/broader overviews), as well as the technical papers on the the cpu architecture(addison-weasley has some good books on this)
精彩评论