[bits 32] global interrupts_enable global interrupts_disable global interrupts_load_idt extern interrupts_handle_interrupt ; void interrupts_enable( void ) interrupts_enable: push ebp sti leave ret ; void interrupts_disable( void ) interrupts_disable: push ebp cli leave ret %include "stage2_functions.asm" extern idt_pointer ; void interrupts_load_idt( interrupt_descriptor_table_pointer_t *idt_pointer ) interrupts_load_idt: push ebp mov ebp, esp mov ecx, [ebp+8] lidt [idt_pointer] leave ret ; the handler to ignore interrupts global interrupts_ignore_request interrupts_ignore_request: pusha push si mov si, IGNINTR call pm_print_string pop si popa iret IGNINTR: db "IGNINTR ", 0 ; void interrupts_handle_request_0x00( ); %macro exception_stub 1 global interrupts_handle_request_%1 interrupts_handle_request_%1: mov [interrupt_no], byte %1 %endmacro exception_stub 0x00 int_entry: ; safe state of interrupted code pusha push ds push es push fs push gs ; call the static C handler with the correct interrupt number ; uint32_t interrupts_handle_interrupt( uint8_t interrupt_no, uint32_t esp ); push esp mov eax, [interrupt_no] push eax call interrupts_handle_interrupt add esp, 8 ; mov esp, eax ; restore state pop gs pop fs pop es pop ds popa iret interrupt_no: db 0