Small GDT problem

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Matt

Small GDT problem

Post 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?
crazybuddha

Re:Small GDT problem

Post by crazybuddha »

I realize this isn't anwering your question (directly), but are you planning to change the values in the descriptors??
K.J.

Re:Small GDT problem

Post 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.
Matt

Re:Small GDT problem

Post 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
crazybuddha

Re:Small GDT problem

Post 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.
matt

Re:Small GDT problem

Post 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 :)
crazybuddha

Re:Small GDT problem

Post by crazybuddha »

Actually, now that I think about it, why did you need to do this??
Post Reply