Problem writing interrupts handler?

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.
chris13524
Member
Member
Posts: 45
Joined: Sat Feb 27, 2016 10:52 pm

Re: Problem writing interrupts handler?

Post by chris13524 »

Could the issue be that I need to switch to protected mode? I'm not sure if QEMU starts us out in 32 bits or not.

From my understanding here: http://wiki.osdev.org/Protected_Mode You set up the GDT and set a control register. I did the same thing, but it didn't fix the issue.

Here's how I do it:

Code: Select all

gdt_flush:
   mov 4(%esp), %eax
   lgdt (%eax)

   mov 0x10, %ax
   mov %ax, %ds
   mov %ax, %es
   mov %ax, %fs
   mov %ax, %gs
   mov %ax, %ss

	mov %cr0, %eax
	or %al, 1     // set PE (Protection Enable) bit in CR0 (Control Register 0)
	mov %eax, %cr0
   ljmp $0x08, $.flush
.flush:
   ret
My operating system:
https://github.com/neonorb/aura
kzinti
Member
Member
Posts: 898
Joined: Mon Feb 02, 2015 7:11 pm

Re: Problem writing interrupts handler?

Post by kzinti »

Then your first task is to determine if QEmu does start in 32 bits or not =)
User avatar
iansjack
Member
Member
Posts: 4706
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Problem writing interrupts handler?

Post by iansjack »

Your multiboot kernel will start in protected mode whether you use grub or load it directly in qemu.
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Re: Problem writing interrupts handler?

Post by SpyderTL »

iansjack wrote:Your multiboot kernel will start in protected mode whether you use grub or load it directly in qemu.
But, you should set up your own GDT and IDT, regardless of whether GRUB or QEMU already configured one. There's no way you can rely on their configuration.
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Post Reply