during the paging activation, when I go to set a bit of CR4, I get the error "Cannot access memory...".
Code: Select all
.global attiva_paginazione
attiva_paginazione:
pushl %eax
pushl %ecx
pushl %edx
movl $0x0000080, %ecx //efer msr
rdmsr
orl $0x00000100, %eax //efer.lme
wrmsr
movl $0x00000020, %eax //cr4.pae
movl %eax, %cr4
movl %cr0, %eax
orl $0x80000000, %eax //cr0.pg
movl %eax, %cr0
popl %edx
popl %ecx
popl %eax
ret
After, the function continue to running until the first pop istruction, then crashes.
The value 0x6ee0, analyzing registers, is in the esp.
what happens? How to solve?