bochs physical memory read

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
vjain20
Member
Member
Posts: 73
Joined: Wed Apr 04, 2012 9:12 pm

bochs physical memory read

Post by vjain20 »

I made some changes to my kernel and all of a sudden a function, which was working fine earlier, started throwing a physical memory read error.
The page table seems to be fine -
(The page directory self-referencing)

Code: Select all

<bochs:6> info tab
cr3: 0x0a1995f800003000
0x00000000-0x003fffff -> 0x0000000000000000-0x00000000003fffff
0xc0000000-0xc0000fff -> 0x0000000000500000-0x0000000000500fff
0xc0001000-0xc03fffff -> 0x0000000000101000-0x00000000004fffff
0xc0402000-0xc0402fff -> 0x0000000000007000-0x0000000000007fff
0xd0000000-0xd00fffff -> 0x0000000000009000-0x0000000000108fff
0xffc00000-0xffc00fff -> 0x0000000000001000-0x0000000000001fff
0xfff00000-0xfff00fff -> 0x0000000000002000-0x0000000000002fff
0xfff01000-0xfff01fff -> 0x0000000000008000-0x0000000000008fff
0xfff40000-0xfff40fff -> 0x0000000000006000-0x0000000000006fff
0xfffff000-0xffffffff -> 0x0000000000003000-0x0000000000003fff

Here is the debug sequence for the function :

Code: Select all

(0) [0x0000000000104dd3] 0008:c0004dd3 (copy_page_physical+0): push ebx                  ; 53
<bochs:7> s
Next at t=152378656
(0) [0x0000000000104dd4] 0008:c0004dd4 (copy_page_physical+1): pushfd                    ; 9c
<bochs:8> s
Next at t=152378657
(0) [0x0000000000104dd5] 0008:c0004dd5 (copy_page_physical+2): cli                       ; fa
<bochs:9> s
Next at t=152378658
(0) [0x0000000000104dd6] 0008:c0004dd6 (copy_page_physical+3): mov ebx, dword ptr ss:[esp+12] ; 8b5c240c
<bochs:10> s
Next at t=152378659
(0) [0x0000000000104dda] 0008:c0004dda (copy_page_physical+7): mov ecx, dword ptr ss:[esp+16] ; 8b4c2410
<bochs:11> s
Next at t=152378660
(0) [0x0000000000104dde] 0008:c0004dde (copy_page_physical+b): mov edx, cr0              ; 0f20c2
<bochs:12> s
Next at t=152378661
(0) [0x0000000000104de1] 0008:c0004de1 (copy_page_physical+e): and edx, 0x7fffffff       ; 81e2ffffff7f
<bochs:13> s
Next at t=152378662
(0) [0x0000000000104de7] 0008:c0004de7 (copy_page_physical+14): mov cr0, edx              ; 0f22c2
<bochs:14> s
Next at t=152378663
bx_dbg_read_linear: physical memory read error (phy=0x00000000c0004dea, lin=0xc0004dea)
<bochs:15> 
This function is trying to copy the contents of one physical frame to another after disabling paging. However as soon as it writes
to cr0 register an error is thrown.
Please suggest the possible causes of this and how i can debug this.
- Thanks
Vaibhav jain
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: bochs physical memory read

Post by Combuster »

What does 0xc0004de7 point to with paging disabled? (hint)
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
vjain20
Member
Member
Posts: 73
Joined: Wed Apr 04, 2012 9:12 pm

Re: bochs physical memory read

Post by vjain20 »

Thanks for hint! I am dumb :oops:
- Thanks
Vaibhav jain
Post Reply