Page 1 of 1

Higher half kernel using GDT [SOLVED]

Posted: Sun Aug 15, 2010 3:55 pm
by ellipsis
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

Re: Higher half kernel using GDT

Posted: Sun Aug 15, 2010 4:03 pm
by Combuster
Given the amount of info provided, the most accurate conclusion we can give is that it's happening because of you :wink:

Bochs' log and building commands, please?

Re: Higher half kernel using GDT [SOLVED]

Posted: Tue Sep 07, 2010 2:40 am
by ellipsis
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.