use inline assembler to load the IDT

This commit is contained in:
Stefan Lankes 2011-04-08 10:45:26 -07:00
parent ba1388c13d
commit 0fbf2df5ac
2 changed files with 3 additions and 13 deletions

View file

@ -103,14 +103,7 @@ gdt_flush:
flush2:
ret
; Loads the IDT defined in '_idtp' into the processor.
; This is declared in C as 'extern void idt_load();'
global idt_load
extern idtp
idt_load:
lidt [idtp]
ret
; determines the current instruction pointer (after the jmp)
global read_eip
read_eip:
pop eax ; Get the return address

View file

@ -43,10 +43,7 @@ typedef struct {
* "Unhandled Interrupt" exception
*/
static idt_entry_t idt[256] = {[0 ... 255] = {0, 0, 0, 0, 0}};
idt_ptr_t idtp;
/* This exists in 'start.asm', and is used to load our IDT */
extern void idt_load(void);
static idt_ptr_t idtp;
/*
* Use this function to set an entry in the IDT. Alot simpler
@ -81,5 +78,5 @@ void idt_install(void)
IDT_FLAG_PRESENT|IDT_FLAG_RING3|IDT_FLAG_32BIT|IDT_FLAG_TRAPGATE);
/* Points the processor's internal register to the new IDT */
idt_load();
asm volatile("lidt %0" : : "m" (idtp));
}