OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 16, 2024 9:23 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: need explanation on this (tss's prvil field)
PostPosted: Mon Aug 03, 2020 4:15 am 
Offline
Member
Member

Joined: Sat Aug 18, 2018 8:44 pm
Posts: 127
I am creating a tss segment so I can switch to user mode...
This is the privilege level description I got from osdev's article

Privl: Privilege, 2 bits. Contains the ring level, 0 = highest (kernel), 3 = lowest (user applications).

I still don't understand what I should set it to...

since tss should store the stack pointer and stack segment value for kernel... it should be set to 0.

but james molloy set the access byte to 0xE9, which implies that the privilege level is set to 3 ...

is he wrong or I intepret it wrong?


Top
 Profile  
 
 Post subject: Re: need explanation on this (tss's prvil field)
PostPosted: Mon Aug 03, 2020 7:32 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
The Intel manual seems to be pretty clear on this:
Quote:
Any program or procedure with access to a TSS descriptor (that is, whose CPL is numerically equal to or less than the DPL of the TSS descriptor) can dispatch the task with a call or a jump.

In most systems, the DPLs of TSS descriptors are set to values less than 3, so that only privileged software can perform task switching. However, in multitasking applications, DPLs for some TSS descriptors may be set to 3 to allow task switching at the application (or user) privilege level.
So the answer is (as it so often is) - "It depends....".


Top
 Profile  
 
 Post subject: Re: need explanation on this (tss's prvil field)
PostPosted: Mon Aug 03, 2020 7:48 pm 
Offline
Member
Member

Joined: Sat Aug 18, 2018 8:44 pm
Posts: 127
my question is: switching to user level from kernel level, dpl is something between...

linux kernel book (bovet mentioned dpl should be set to 0)

james molloy sets it to 3 ....

I am confused...


Top
 Profile  
 
 Post subject: Re: need explanation on this (tss's prvil field)
PostPosted: Tue Aug 04, 2020 3:17 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
The setting in the descriptor is just telling you whether a user process can access the TSS or not; the kernel always can. I can't see any reason why you would want to make it accessible to a user process (and I can think of plenty of reasons not to).


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 98 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