Re: OS program execution in depth.
Posted: Fri Sep 04, 2015 10:41 am
Segment registers (including CS) have both a visible and a hidden part. The visible part is what you write to/read from. The hidden part contains the base address of the segment, its limit and privilege levels. In real mode when you write to the visible part, it fills the hidden part with base = value * 0x10, limit = 0xffff. In protected mode, it gets these values from the GDT/LDT. This has the side effect of meaning the hidden parts are not updated if you change the GDT without also reloading the segment register.
When a (>= 80386) cpu starts, it sets the various parts of CS specially - the visible part reads 0xf000, but the base address in the hidden part is 0xffff0000. This is not something you can do programmatically from within real mode, and the next time CS is loaded then it will use the normal real mode rules. If you dump the value of CS from within bochs however, you will get the visible part, which is 0xf0000.
Regards,
John.
When a (>= 80386) cpu starts, it sets the various parts of CS specially - the visible part reads 0xf000, but the base address in the hidden part is 0xffff0000. This is not something you can do programmatically from within real mode, and the next time CS is loaded then it will use the normal real mode rules. If you dump the value of CS from within bochs however, you will get the visible part, which is 0xf0000.
Regards,
John.