GDTR linear address to physical address

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.
Dinesh
Posts: 8
Joined: Wed Oct 08, 2014 3:55 am

Re: GDTR linear address to physical address

Post by Dinesh »

iocoder
You mean to say in every task's page directory GDT's linear address is mapped. So it's like GDT's page is shared by all the tasks in system.
User avatar
JAAman
Member
Member
Posts: 879
Joined: Wed Oct 27, 2004 11:00 pm
Location: WA

Re: GDTR linear address to physical address

Post by JAAman »

if your GDT is located in kernel space (like it should anyway) typically, the kernel space is always the same in every process anyway (because every process needs access to other things as well, such as the physical/virtual memory managers, exception handlers, and kernel services) so as long as the GDT is mapped into kernel space, then it will automatically be mapped identically in every process without you having to worry about it
User avatar
iocoder
Member
Member
Posts: 208
Joined: Sun Oct 18, 2009 5:47 pm
Libera.chat IRC: iocoder
Location: Alexandria, Egypt | Ottawa, Canada
Contact:

Re: GDTR linear address to physical address

Post by iocoder »

Dinesh wrote:iocoder
You mean to say in every task's page directory GDT's linear address is mapped. So it's like GDT's page is shared by all the tasks in system.
EXACTLY. One GDT table for the whole system (stored in physical memory) appears at certain linear base address x for every page directory. GDTR contains that x and the limit.
Dinesh
Posts: 8
Joined: Wed Oct 08, 2014 3:55 am

Re: GDTR linear address to physical address

Post by Dinesh »

iocoder JAAman iansjack
Thanks guys
alexfru
Member
Member
Posts: 1112
Joined: Tue Mar 04, 2014 5:27 am

Re: GDTR linear address to physical address

Post by alexfru »

Brendan wrote: The LGDT and SGDT instructions use a linear address. This is not necessarily the same as a virtual address (if you use segmentation), and not necessarily the same as a physical address (if you use paging).
You should probably be more clear here.

LGDT, SGDT, LIDT and SIDT use the logical address (segment selector:offset) of the instruction operand to access it. Logical is then translated into linear/virtual, which is then either the final physical address or subject to further virtual-to-physical translation using the page tables.

The operand (resides in memory) contains the table address and its limit (the limit ultimately gives the table size).
The table address is linear/virtual, which, again, may be subject to further virtual-to-physical translation.
Gigasoft
Member
Member
Posts: 856
Joined: Sat Nov 21, 2009 5:11 pm

Re: GDTR linear address to physical address

Post by Gigasoft »

iocoder wrote:In this case you may simply let GDT appear in the address space of every process, although some may argue that this is a bad design.
And who are those people? Is there anyone else who believe that having the GDTR pointing to invalid memory is a good design?
Post Reply