Page 1 of 1

Booting kernel in Qemu make General Protection Fault

Posted: Tue Jul 16, 2013 3:37 am
by josephks
I've created a C kernel and I create a bootable iso file using grub-mkrescue utility. When I tried running the kernel with the command

Code: Select all

qemu-i386 -cdrom myos.iso
Its giving General Protection Fault. Kernel was fine if I didn't enable the interrupts with ("sti").

I tried the binary(this binary is used to generate bootable iso using grub-mkrescue) generated after the compiling and linking with

Code: Select all

qemu-i386 -kernel myos.bin
option then the kernel is working as expected in emulator(Enabled the interrupt and Installed a timer which is working fine ). Is there any reason for this behavior?

Re: Booting kernel in Qemu make General Protection Fault

Posted: Sat Jul 20, 2013 2:50 am
by xenos
I guess you should use qemu-system-i386 instead...

Re: Booting kernel in Qemu make General Protection Fault

Posted: Tue Jul 23, 2013 5:59 am
by josephks
Oops Sorry that was a typo, I was using qemu-system-i386 only.
Also I fixed the problem, What i am doing wrong was that not jumping a far jump for setting the CS regsiter after the lgdt instruction.