I'm trying to map my kernel to virtual address 0xC0000000 using the GDT method described on the wiki, but I'm running into some problems. Even if I copy/paste the code directly from Higher Half With GDT into a clean project, it consistently crashes QEMU and VirtualBox as soon as I select my kernel on the GRUB OS select screen. Bochs doesn't crash, but it stops execution right where it would normally crash and triple-faults if I continue it. After looking at it in the Bochs debugger, it seems like it's crashing while GRUB is trying to load the kernel. If I revert the codebase to an older version of the kernel that doesn't even try to enable paging or load in the higher half, it works fine. Any ideas on why this is happening?
EDIT: Added build script and Bochs log
Higher half kernel using GDT [SOLVED]
Higher half kernel using GDT [SOLVED]
- Attachments
-
- build.sh.txt
- Build script
- (679 Bytes) Downloaded 61 times
-
- bochs_log.txt
- Bochs log
- (33.51 KiB) Downloaded 36 times
Last edited by ellipsis on Tue Sep 07, 2010 2:37 am, edited 2 times in total.
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Higher half kernel using GDT
Given the amount of info provided, the most accurate conclusion we can give is that it's happening because of you
Bochs' log and building commands, please?
Bochs' log and building commands, please?
Re: Higher half kernel using GDT [SOLVED]
I found the problem. There were 2 things wrong.
1. I was initializing the stack pointer before initializing the GDT
2. I was corrupting eax (0x2BADB002) making my kernel fail on boot. Solved by transferring into ecx before fixing segments after lgdt.
1. I was initializing the stack pointer before initializing the GDT
2. I was corrupting eax (0x2BADB002) making my kernel fail on boot. Solved by transferring into ecx before fixing segments after lgdt.