OSDev.org
https://forum.osdev.org/

Are GDT addresses logical or physical when paging is on?
https://forum.osdev.org/viewtopic.php?f=1&t=33792
Page 1 of 1

Author:  GMorgan [ Sat Jul 27, 2019 4:58 pm ]
Post subject:  Are GDT addresses logical or physical when paging is on?

Hi Guys,

Are GDT addresses logical or physical once paging is enabled?

I've been looking for an answer to this as most sources just say "address" and don't tell you if that is relative to the real memory position or in the logical space. I'm looking for the best way to control port access to user space drivers in a micro kernel and I'm thinking about having the OS map different IOPB pages for each process depending upon what ports have been granted access (rather than have a TSS for every process that needs its own IOPB). The idea being that the kernel will map all ports other than what it needs to sigma0 on startup. Any process that owns a port can pass it to another process via a syscall. Sigma0 accepts requests from the root task to transfer ports (so the root task kicks off the serial port driver and immediately requests all the ports for that process). All dead processes get their ports allocated back to sigma0.

Obviously this only works to begin with if the GDT offset is into the current logical space and not into the physical one.

Thanks in advance.

Author:  alexfru [ Sat Jul 27, 2019 6:14 pm ]
Post subject:  Re: Are GDT addresses logical or physical when paging is on?

GMorgan wrote:
Are GDT addresses logical or physical once paging is enabled?

Virtual (in segment descriptors and GDTR). LGDT still takes a logical address (which then translates into virtual and so on).

Author:  GMorgan [ Sun Jul 28, 2019 3:08 am ]
Post subject:  Re: Are GDT addresses logical or physical when paging is on?

Thanks. This raises the question of what the difference between a logical and virtual address is. Does logical contain a segment and a pointer?

Author:  Octocontrabass [ Sun Jul 28, 2019 10:13 am ]
Post subject:  Re: Are GDT addresses logical or physical when paging is on?

GMorgan wrote:
Are GDT addresses logical or physical once paging is enabled?

There's no such thing as a "logical" address in x86. Maybe you're thinking of linear addresses?

Segmentation is used to translate from virtual to linear addresses, and paging is used to translate from linear to physical addresses. This means addresses in the GDT and GDTR will be linear addresses.

Author:  alexfru [ Sun Jul 28, 2019 11:03 am ]
Post subject:  Re: Are GDT addresses logical or physical when paging is on?

Octocontrabass wrote:
There's no such thing as a "logical" address in x86.

There is.
Section 3.3.1 IA-32 Memory Models of Intel® 64 and IA-32 Architectures Software Developer’s Manual Combined Volumes: 1, 2A, 2B, 2C, 2D, 3A, 3B, 3C, 3D and 4 wrote:
To address a byte in a segment, a program issues a logical address. This consists of a segment selector and an offset (logical addresses are often referred to as far pointers).

Author:  Octocontrabass [ Sun Jul 28, 2019 11:39 am ]
Post subject:  Re: Are GDT addresses logical or physical when paging is on?

Whoops, that's what I get for reading too many MIPS manuals.

Segmentation is used to translate from logical to linear addresses, and paging is used to translate from linear to physical addresses.

There's no such thing as virtual addresses in x86. ;)

Author:  alexfru [ Sun Jul 28, 2019 12:44 pm ]
Post subject:  Re: Are GDT addresses logical or physical when paging is on?

Octocontrabass wrote:
There's no such thing as virtual addresses in x86. ;)

You'll be surprised.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/