Page 1 of 1

Small GDT problem

Posted: Sun Aug 04, 2002 10:47 am
by Matt
My bootloader sets up my descriptors and GDT for me, but I want access to those descriptors in my kernel. How do I access descriptors in one file that were declared in another?

Re:Small GDT problem

Posted: Sun Aug 04, 2002 7:24 pm
by crazybuddha
I realize this isn't anwering your question (directly), but are you planning to change the values in the descriptors??

Re:Small GDT problem

Posted: Sun Aug 04, 2002 8:27 pm
by K.J.
Hard code in the address of where the descriptors start. Then you can make a pointer in C to that place.

K.J.

Re:Small GDT problem

Posted: Mon Aug 05, 2002 10:16 am
by Matt
crazybuddha wrote: I realize this isn't anwering your question (directly), but are you planning to change the values in the descriptors??
Nope, I don't need to change the values. I also need it in ASM

Re:Small GDT problem

Posted: Mon Aug 05, 2002 10:37 am
by crazybuddha
You might consider just creating a new table. Often, the place in memory where the gdt is located for the switch to pmode is not where you want it to reside permanently (since it is an offset from 0x7c00), and you might want to overwrite that memory anyway.

There is something else to note (for what it's worth). When a segment register is given a value, the descriptor is put into the segment cache register. As long as you don't mess with the segment register, you don't use the table anymore.

Re:Small GDT problem

Posted: Mon Aug 05, 2002 1:13 pm
by matt
crazybuddha wrote: You might consider just creating a new table. Often, the place in memory where the gdt is located for the switch to pmode is not where you want it to reside permanently (since it is an offset from 0x7c00), and you might want to overwrite that memory anyway.

There is something else to note (for what it's worth). When a segment register is given a value, the descriptor is put into the segment cache register. As long as you don't mess with the segment register, you don't use the table anymore.
Ok, I'll try it :)

Re:Small GDT problem

Posted: Mon Aug 05, 2002 1:28 pm
by crazybuddha
Actually, now that I think about it, why did you need to do this??