1. Question on Entering Protected Mode
I am new at this mailing list business, so bear with me if I am not posting
my question at the most appropriate list... (maybe one of you can suggest me
a better place to discuss things related to my question bellow).
Well, I am an experienced C programmer and I just began learning the workings
of x86 systems. At the same time I am trying to tame the beast, beginning
with Linux's bootsect.S and setup.S, naturally. So here goes my question:
After loading both the Global and Local descriptor tables, the setup code
enters PM by issuing the instructions
setup.S: mov ax,#1 ! protected mode (PE) bit
setup.S: lmsw ax ! This is it!
Previous to 'lmsw' the CS register naturally contains the current code
segment (0x9000, I believe). But right after 'lmsw' the CPU interprets
its content differently, like a segment selector for the appropriate
descriptor table. The hex number 0x9000 corresponds to
1001000000000 0 00 b
This number, interpreted as a segment selector, tells the CPU the following:
Global descriptor Table,
Requested Privilege Level 0 (Ring 0),
Descriptor selector 4608
But the GDT loaded at setup.S only contains two descriptors (2 and 3) besides
the two inaccessible (0 and 1) ones. So, it looks to me that the next
instruction to be executed (or pre-fetched) that uses the register CS would
try to access a descriptor (4608) that is not in GDT and therefore a CPU
exception should be raised. (is the IDT ready to deal with this at
this point ?)
Obviously either there's something wrong with way I see things up here or
I know only half the story... Can someone help me understand that ? I also
would be glad to discuss other Linux/x86 arch questions...
Well, I have other questions on top of my mind but I better wait and see
if anyone is interested in discussing with me. Please, when replying to
this message, reply directly to me as well. Thanks, Ximenes.
PS: Does somebody know of an on-line document that goes into the details of the
Linux code, at the level of the question above ? This would help me
a lot in learning both Linux and x86 at the same time.
XIMENES ROCHA RESENDE
Department of Physics Swain Hall West 117
Indiana University Bloomington IN 47405
Phone: (812) 855-3152 Fax: (812) 855-5533
2. Getting Geforce DDR to work
3. switch from protected mode to real mode in kernel
4. Linux mgetty/pap dialin
5. linux->real mode-> boot other OS in protected mode
6. pop3/dns server problem?
7. A confusion about IA32 protected mode protecting kernel data.
8. Stats comp.os.linux.networking (last 7 days)
9. device eth0 entered promiscuous mode
10. Help!!! eth0 entered Promiscuous mode???
11. use esc key to exit GRUB graphical boot menu and enter command line mode
12. How to enter single user mode at boot time like SCO-UNIX ?
13. RH 8.0 can't enter into graphical install mode