Segment Registers and GCC
Posted: Thu Jan 29, 2004 12:00 am
If I use GCC to compile a simple program, say:
void main(void) {
return;
}
What must the segment registers be set to when my OS executes it?
CS and DS are very obvious, but what about ES, FS, and GS?
ES used to be used by the string instructions in real mode. Is it still used as such in protected mode? If so, should it simply point to the same descriptor as DS?
IIRC, FS is used for ELF Shared Libraries, and GS is used for pthreads.
Must I create valid descriptors and place them in the GDT or LDT and assume they will never be touched, or will the compiled program set descriptors up itself? If it's the second, how do I know which descriptor numbers it is going to use?
I haven't seen anyone write this up, so forgive if it's a stupid question.
void main(void) {
return;
}
What must the segment registers be set to when my OS executes it?
CS and DS are very obvious, but what about ES, FS, and GS?
ES used to be used by the string instructions in real mode. Is it still used as such in protected mode? If so, should it simply point to the same descriptor as DS?
IIRC, FS is used for ELF Shared Libraries, and GS is used for pthreads.
Must I create valid descriptors and place them in the GDT or LDT and assume they will never be touched, or will the compiled program set descriptors up itself? If it's the second, how do I know which descriptor numbers it is going to use?
I haven't seen anyone write this up, so forgive if it's a stupid question.