I've been trying to develop a mini os and i'm still at the early stages.
however, every time i tried to enable the MMU, my kernel crashes and qemu restarts it.
Here is my code:
https://github.com/baselsayeh/test_kern ... i386/mmu.c
crashing exatly after mov cr0, eax after calling __enable_mmu
https://github.com/baselsayeh/test_kern ... /mmu_asm.S
did i do anything wrong?
here is gdb output:
(both 0x00200000 and 0x00300000 is reserved in the linker script)
Code: Select all
0x001003ff in ?? ()
(gdb) si
0x00100404 in ?? ()
(gdb) disas $eip-0x10,+0x20
Dump of assembler code from 0x1003f4 to 0x100414:
0x001003f4: mov %esp,%ebp
0x001003f6: mov 0xc(%ebp),%eax
0x001003f9: mov %eax,%cr3
0x001003fc: mov %cr0,%eax
0x001003ff: or $0x80000001,%eax
=> 0x00100404: mov %eax,%cr0
0x00100407: mov $0x0,%eax
0x0010040c: pop %ebp
0x0010040d: ret
0x0010040e: push %ebp
0x0010040f: mov %esp,%ebp
0x00100411: sub $0x18,%esp
End of assembler dump.
(gdb) si
0x00100407 in ?? ()
(gdb) disas $eip-0x10,+0x20
Dump of assembler code from 0x1003f7 to 0x100417:
0x001003f7: Cannot access memory at address 0x1003f7
(gdb) x/2x 0x0
0x0: Cannot access memory at address 0x0
(gdb) x/2x 0x1000
0x1000: Cannot access memory at address 0x1000
(gdb) x/2x 0x2000
0x2000: Cannot access memory at address 0x2000
(gdb) x/2x 0x3000
0x3000: Cannot access memory at address 0x3000
(gdb) si
0x0000e05b in ?? ()
(gdb)
i loaded it via
qemu-system-i386 -kernel myos.kernel -m 128 -gdb tcp::9000 -S
i solved it, was not getting the parameter correctly