well this time, i have tryed to setup paging, but as soon as i have enablede paging, a page fault opurcere. Well that is not the problem. The problem is, that it is still the samm address. EVen if i change the address in cr3 to 0xffffff.. or 0x0001, it only changes when: cr3:0x00000000 or when i write at the address (0x11d1).
I have tryed all, followed that geppy said, looked at a exapmle code, and so on.... but no changes.
the code is here:
paging.start:
mov eax,0x00000000 ; where we shall the page start in phy mem
mov esi,0x0006000+(10*4) ; where are the table located in mem
call paging.table.prepare ;setup the first 4 mb, for the kernel
call paging.dir.prepare ; setup the dir
mov eax,0x04000008 ; kernel area. tables beginns at 0x04000 and ends at 40000 + 4mb
mov cr3,eax ; prepare.
jmp paging.enable ; this shuld be the last "thing" before going into paging, because the code will then run smoothy then.
paging.dir.prepare:
mov cx,0x0001 ; how maney dir entrys to setup
mov eax,0x00060000 ; table address
mov al,0x3 ;attributes for the kernels map
mov esi,0x40000 ; the dir start
paging.dir.prepare.loop:
mov [esi],eax
add esi,0x4 ; 32 bits incresse
add eax,0x2000 ; only the new address of a page table.
loop paging.dir.prepare.loop ; countinue undtil we are finish
ret
paging.table.prepare:
mov cx,0x0400-0xa ; how maney dir entrys to setup (1014)
mov al,0x3 ;attributes for the kernels map
paging.table.prepare.loop:
add eax,0x1000
mov [esi],eax
add eax,0x1000; we need to incres the page's frame, so we map more than the same page!
add esi,0x4 ; next entry
loop paging.table.prepare.loop
ret ; now we have map the first 4 mb memory, this is the interface between the dir and table.
paging.enable:
mov eax, cr0
or eax, 0x80000000
mov cr0, eax
jmp $+2
cli
hlt
KMTDK

