OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 12:59 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Are GDT addresses logical or physical when paging is on?
PostPosted: Sat Jul 27, 2019 4:58 pm 
Offline

Joined: Sun Jul 14, 2019 4:27 pm
Posts: 22
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.


Top
 Profile  
 
 Post subject: Re: Are GDT addresses logical or physical when paging is on?
PostPosted: Sat Jul 27, 2019 6:14 pm 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 1108
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).


Top
 Profile  
 
 Post subject: Re: Are GDT addresses logical or physical when paging is on?
PostPosted: Sun Jul 28, 2019 3:08 am 
Offline

Joined: Sun Jul 14, 2019 4:27 pm
Posts: 22
Thanks. This raises the question of what the difference between a logical and virtual address is. Does logical contain a segment and a pointer?


Top
 Profile  
 
 Post subject: Re: Are GDT addresses logical or physical when paging is on?
PostPosted: Sun Jul 28, 2019 10:13 am 
Online
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
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.


Top
 Profile  
 
 Post subject: Re: Are GDT addresses logical or physical when paging is on?
PostPosted: Sun Jul 28, 2019 11:03 am 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 1108
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).


Top
 Profile  
 
 Post subject: Re: Are GDT addresses logical or physical when paging is on?
PostPosted: Sun Jul 28, 2019 11:39 am 
Online
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
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. ;)


Top
 Profile  
 
 Post subject: Re: Are GDT addresses logical or physical when paging is on?
PostPosted: Sun Jul 28, 2019 12:44 pm 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 1108
Octocontrabass wrote:
There's no such thing as virtual addresses in x86. ;)

You'll be surprised.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: 8infy, DotBot [Bot], Google [Bot] and 55 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group