Page 1 of 1
Changing Privilege Level
Posted: Sun Jul 27, 2003 12:56 pm
by pini
I tried this :
in the kernel code (ring 0) to switch to a CPL 3 function FUNC, but I get this :
How can I do to switch between CPLs ??
Re:Changing Privilege Level
Posted: Sun Jul 27, 2003 1:42 pm
by pini
Anyway, I found it : I can make a far call to go to a less CPL and make a return to go to a greater CPL
Re:Changing Privilege Level
Posted: Sun Jul 27, 2003 3:16 pm
by pini
Well, I have some problems to make it work...
I have to use a far return to switch from CPL 0 to CPL 3, so I'm using this code :
Code: Select all
push ss
push esp
push cs
push eip
retf
DS, ES, FS and GS are set to zero by the retf, because of the privilege switching, so I put this before my pushs :
Code: Select all
mov ax,USER_DATA_SELECTOR ; GDT Data CPL 3 entry
mov ds,ax
mov es,ax
mov fs,ax
mov gs,ax
But I get this with bochs :
Code: Select all
exception(): 3rd exception with no resolution
I guess I forgot something, but I can't figure out what...