When I call kernel_main I get a reboot(?) the instruction pointer changes to 0xE05b. I have the full code here: https://github.com/tedavids/DragonOS
here is a snippet of where the error is:
Code: Select all
_start2:
# At this point, paging is fully set up and enabled.
# Unmap the identity mapping as it is now unnecessary.
movl $0, page_directory + 0
# Reload crc3 to force a TLB flush so the changes to take effect.
movl %cr3, %ecx
movl %ecx, %cr3
# Set up the stack.
mov $stack_top, %esp
# Unmap the identity mapping as it is now unnecessary.
movl $0, page_directory + 0
# Reload crc3 to force a TLB flush so the changes to take effect.
movl %cr3, %ecx
movl %ecx, %cr3
# Enter the high-level kernel.
call kernel_main
Things I have checked: CR3 has the proper address of my page directory
CR0 is set to paging on
EIP points at the proper address '0xC...' right before the call (this is how I know I am in virtual space).
The disassembly shows the call using the proper 0xC.. address
The page directory has line 768 (0xC000) pointing at my page table
The page table entry for the address of kernel_main is mapped
If I replace the call to kernel_main with "loop: jmp loop", it happily loops forever.
Any ideas would be helpful. Thanks in advance

