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.
FlashBurn
Post
by FlashBurn » Fri Mar 28, 2003 7:49 am
I?ve written a function which should convert a page address into a physical address. But because of any reason, my function is incorrect!
Code: Select all
;----------------------------
; Input:
; EAX - address (paged)
; ESI - address of PD
; Output:
; EAX - physical address
addr_page2phys:
push eax
push eax
and eax,0ff300000h
shr eax,22
add esi,eax
mov eax,[esi]
and eax,0fffff000h
mov esi,eax
pop eax
and eax,03ff000h
shr eax,12
add esi,eax
mov eax,[esi]
and eax,0fffff000h
pop ebx
and ebx,0fffh
add eax,ebx
ret
;----------------------------
Pype.Clicker
Member
Posts: 5964 Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:
Post
by Pype.Clicker » Fri Mar 28, 2003 7:58 am
seems wrong.
0xff30 ==1111 1111 0011 0000
what you want is more likely to be 0xffc0 0000 ...
FlashBurn
Post
by FlashBurn » Fri Mar 28, 2003 12:11 pm
Thanks, but this seems not to be the only problem, because it ?still doesn?t work
Pype.Clicker
Member
Posts: 5964 Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:
Post
by Pype.Clicker » Sat Mar 29, 2003 4:07 pm
you seemed to forgot that page table entries are 4 bytes long ...
So, i wouldn't do
Code: Select all
shr eax,22
add esi,eax
mov eax,[esi]
but rather
FlashBurn
Post
by FlashBurn » Sun Mar 30, 2003 4:18 am
Thanks, my function is working now ;D