Booting kernel in Qemu make General Protection Fault

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
josephks
Posts: 5
Joined: Fri Jul 05, 2013 12:14 am

Booting kernel in Qemu make General Protection Fault

Post 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?
User avatar
xenos
Member
Member
Posts: 1121
Joined: Thu Aug 11, 2005 11:00 pm
Libera.chat IRC: xenos1984
Location: Tartu, Estonia
Contact:

Re: Booting kernel in Qemu make General Protection Fault

Post by xenos »

I guess you should use qemu-system-i386 instead...
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS
josephks
Posts: 5
Joined: Fri Jul 05, 2013 12:14 am

Re: Booting kernel in Qemu make General Protection Fault

Post 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.
Post Reply