[init] Meh

This commit is contained in:
Kevin Lange 2011-02-27 21:19:54 -06:00
parent ad9eb394d6
commit 211ad21467

View File

@ -25,9 +25,10 @@ mboot:
; Main entrypoint
global start
start:
mov esp, 0x7FFFF ; grub likes this
; Set up stack pointer.
mov esp, 0x7FFFF
; Push the incoming mulitboot headers
push eax ; Magic
push eax ; Header magic
push ebx ; Header pointer
; Disable interrupts
cli
@ -41,7 +42,9 @@ start:
global gdt_flush
extern gp
gdt_flush:
; Load the GDT
lgdt [gp]
; Flush the values to 0x10
mov ax, 0x10
mov ds, ax
mov es, ax
@ -77,6 +80,15 @@ idt_load:
jmp isr_common_stub
%endmacro
%macro IRQ_ENTRY 2
global _irq%1
_irq%1:
cli
push byte 0
push byte %2
jmp irq_common_stub
%endmacro
; Standard X86 interrupt service routines
ISR_NOERR 0
ISR_NOERR 1
@ -111,8 +123,27 @@ ISR_NOERR 29
ISR_NOERR 30
ISR_NOERR 31
extern fault_handler
; Interrupt Requests
IRQ_ENTRY 0, 32
IRQ_ENTRY 1, 33
IRQ_ENTRY 2, 34
IRQ_ENTRY 3, 35
IRQ_ENTRY 4, 36
IRQ_ENTRY 5, 37
IRQ_ENTRY 6, 38
IRQ_ENTRY 7, 39
IRQ_ENTRY 8, 40
IRQ_ENTRY 9, 41
IRQ_ENTRY 10, 42
IRQ_ENTRY 11, 43
IRQ_ENTRY 12, 44
IRQ_ENTRY 13, 45
IRQ_ENTRY 14, 46
IRQ_ENTRY 15, 47
; Interrupt handlers
extern fault_handler
isr_common_stub:
pusha
push ds
@ -138,35 +169,7 @@ isr_common_stub:
add esp, 8
iret
%macro IRQ_ENTRY 2
global _irq%1
_irq%1:
cli
push byte 0
push byte %2
jmp irq_common_stub
%endmacro
; Interrupt Requests
IRQ_ENTRY 0, 32
IRQ_ENTRY 1, 33
IRQ_ENTRY 2, 34
IRQ_ENTRY 3, 35
IRQ_ENTRY 4, 36
IRQ_ENTRY 5, 37
IRQ_ENTRY 6, 38
IRQ_ENTRY 7, 39
IRQ_ENTRY 8, 40
IRQ_ENTRY 9, 41
IRQ_ENTRY 10, 42
IRQ_ENTRY 11, 43
IRQ_ENTRY 12, 44
IRQ_ENTRY 13, 45
IRQ_ENTRY 14, 46
IRQ_ENTRY 15, 47
extern irq_handler
irq_common_stub:
pusha
push ds