Code: Select all
paging:
mov esi,0
mov ecx,1024
.1:
cmp esi,_kernel_start
jl .2
cmp esi,_kernel_end
jge .3
mov edx,esi
or edx,3
mov [edi],edx
.2:
add esi,4096
add edi,4
loop .1
.3:
mov dword [boot_page_directory],(boot_page_table1+3)
mov dword [boot_page_directory+(768*4)],(boot_page_table1+0x3)
mov ecx,boot_page_directory
mov cr3,ecx
mov ecx,cr0
or ecx,0x80010000
mov cr0,ecx
jmp $ ;cr2 pointed to this. replaced with hlt, still the same.
and the register contents are:
cr0=0xe0010011
cr2=0x001010d1
cr3=0x105000
cr4=0
Also, how do I find the corresponding code in my assembly source from the cr2 register?