OSDev.org

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

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: why cannot i access GDT with PL changed
PostPosted: Sun Jun 15, 2008 9:44 am 
Offline

Joined: Sun Jun 15, 2008 7:48 am
Posts: 2
i>amibition:access GDT
ii>enviroment:
windows2003sp2;syser debugger;masm32v9.
iii>method:
1.asm code:
Code:
    sgdt gdtr               ;this ins can be run in ring3
    lea eax,gdtr
    mov eax,[eax+2]         ;eax<--->GDT baseaddress<---->8003f000
    add eax,48h             ;in my computer 48h is reserved
   
    mov esi,eax             
    lea edi,bakgdt
    movsd
    movsd
   

2.change PL
1>segement protection:
stage1:es=23h;RPL=3;TI=0[GDT];Index=4;
stage2:GDTR=8003f000;PA=3f000;GDT[4](3f020h---3f028h)=00cff3000000ffff;
base=0;G=1&D=1&E=0&ED=0&R/W=1--->code32 readable.
--
DPL=3;NO NEED TO CHANGE.
2>page protection:
LA=8003f048;cr3=39000
stage1:page directory table.peekd 39800--->3b163
U/S=0;---->NEED CHANGE--->poked 39800 3b167.
stage2:page table.peekd 3b0fc--->3f163.
NEED CHANGE--->poked 3b0fc 3f167...
---------------------
iv>question:
All done then why i got a ACESS_VOLIDATION error???
----------
thx in advance...
regs from kybyw


Top
 Profile  
 
 Post subject: Re: why cannot i access GDT with PL changed
PostPosted: Fri Jun 20, 2008 10:27 pm 
Offline

Joined: Sun Jun 15, 2008 7:48 am
Posts: 2
i have solved this question.
----
i didn't consider the factor of task swtich.after a task switch,the cr3 will refresh,so does the page directory table.
so i edited the wrong page directory entry.the page directory entry changed belong to system's or explores?
---
reason:
directly using Ctrl+f12 to active syser then change the PDE(page directory entry)
--
solution:
use syser to load the exe and then get the right cr3 value and change the right page directory entry.


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 726 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