Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .global idt_init
- .type idt_init, @function
- idt_init: lidt (idtr) # Load the idt pointed to by our idtr struct and return.
- ret
- ###########################################################################
- # ISRS #
- ###########################################################################
- .global isr0 # Divide exception
- .type isr0, @function
- isr0: cli
- push 0 # Dummy error code
- push 0 # Reference number of exception
- jmp isr_common_stub # Jump to our default ISR handler
- # ... other ISR stubs go here...
- .extern isr_handle # External function defined in isr.c to print error message etc.
- isr_common_stub:
- pusha
- push %ds
- push %es
- push %fs
- push %gs
- mov $0x10, %ax
- mov %ax, %ds
- mov %ax, %es
- mov %ax, %fs
- mov %ax, %gs # Push all data segment registers onto the stack, and then load them with data segment offset
- mov %esp, %eax
- push %eax # Push the location of our stack
- mov isr_handle, %eax
- call %eax # Indirectly call isr_handle
- pop %eax
- pop %gs
- pop %fs
- pop %es
- pop %ds
- popa
- add $8, %esp
- iret # Pop everything, clean up the stack and return.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement