I'm trying to write directly to a physical memory location, so I use the build function to first turn off paging, write a value, and then turn on paging again, but for some reason, the page error still fails when I try to write the value.
As I understand it, in x86-32bit paging is turned on and off, flipping bit 32 to cr0, so here is my build function:
mov 4(%esp), %ecx //address mov 8(%esp), %edx //value mov %cr0, %eax and $0x7fffffff, %eax mov %eax, %cr0 mov %edx, (%ecx) //this line still triggers a page fault somehow or $0x80000000, %eax mov %eax, %cr0 ret
Is this the right way to achieve what I want to do? If so, why is the page error still running when the bit in cr0 flipped over?
source share