Bits for DPL in GDT or IDT.

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
donggas90
Member
Member
Posts: 38
Joined: Fri Oct 17, 2014 12:07 pm

Bits for DPL in GDT or IDT.

Post by donggas90 »

You can see IDT structure here.

Code: Select all

•Bits 42...44: Descriptor Privedlge Level (DPL)
◦00: Ring 0
◦01: Ring 1
◦10: Ring 2
◦11: Ring 3
And you can download that tutorial's source here.

Now my question is this.
About bits of DPL field.
I already know that 0(00b) means Ring0 and 3(11b) means Ring3.

but How about Ring1 or Ring2?
In Ring1 case, 01b? 10b?
I thought and believe 01b is right because that is 1 in decimal.
However the source had been wrote 10b as Ring1.

Code: Select all

#define I86_IDT_DESC_RING1		0x40	//01000000
#define I86_IDT_DESC_RING2		0x20	//00100000
#define I86_IDT_DESC_RING3		0x60	//01100000
You can see this code at idt.h in Hal project.

I'm really confusing about that. The code is wrong? What is correct?
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Bits for DPL in GDT or IDT.

Post by Brendan »

Hi,
donggas90 wrote:I'm really concerning. The code is wrong? What is correct?
The source in the tutorial is wrong and has them around the wrong way. Nobody uses ring 1 or ring 2 (including the demo/tutorial), so nobody noticed.


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
donggas90
Member
Member
Posts: 38
Joined: Fri Oct 17, 2014 12:07 pm

Re: Bits for DPL in GDT or IDT.

Post by donggas90 »

Thanks Brendan.
Post Reply