#define ASM_SOURCE 1 .file "irq_wrappers.S" .text .extern exception_handler_wrap .globl exception_handler_wrapper_array .altmacro .macro exception_mac id exception_wrapper_\id: .type exception_wrapper_\id,@function /* INTERRUPT FRAME START */ /* ALREADY PUSHED TO US BY THE PROCESSOR UPON ENTRY TO THIS INTERRUPT */ /* uint32_t ip */ /* uint32_t cs; */ /* uint32_t flags */ /* Pushes the other reg to save same and look like a struct cpu_state*/ /* Fake error code */ pushl $0 /* Backup the actual context */ pushl %ebp movl %esp, %ebp pushl %edi pushl %esi pushl %edx pushl %ecx pushl %ebx pushl %eax subl $2,%esp pushw %ss pushw %ds pushw %es pushw %fs pushw %gs push %esp pushl $\id call exception_handler_wrap addl $8, %esp /* Restore the context */ popw %gs popw %fs popw %es popw %ds popw %ss addl $2,%esp popl %eax popl %ebx popl %ecx popl %edx popl %esi popl %edi popl %ebp /* Remove fake error code */ addl $4, %esp iret .endm .set i, 0 .rept 0x20 exception_mac %i .set i, i+1 .endr .macro ref_exception_wrapper id .long exception_wrapper_\id .endm .section ".rodata" .p2align 5, 0x0 exception_handler_wrapper_array: .set i, 0x0 .rept 0x20 ref_exception_wrapper %i .set i, i+1 .endr