| 1 | section .text |
| 2 | |
| 3 | extern except |
| 4 | |
| 5 | %macro raise_exception 1 |
| 6 | align 16 |
| 7 | raise_exception_%1: |
| 8 | cld |
| 9 | %if %1 == 8 || %1 == 10 || %1 == 11 || %1 == 12 || %1 == 13 || %1 == 14 || %1 == 17 || %1 == 30 |
| 10 | pop eax |
| 11 | %else |
| 12 | xor eax, eax |
| 13 | %endif |
| 14 | push ebp |
| 15 | mov ebp, esp |
| 16 | push eax |
| 17 | push %1 |
| 18 | call except |
| 19 | %endmacro |
| 20 | |
| 21 | %assign i 0 |
| 22 | %rep 32 |
| 23 | raise_exception i |
| 24 | %assign i i+1 |
| 25 | %endrep |
| 26 | |
| 27 | section .rodata |
| 28 | |
| 29 | %macro raise_exception_getaddr 1 |
| 30 | dd raise_exception_%1 |
| 31 | %endmacro |
| 32 | |
| 33 | global exceptions |
| 34 | exceptions: |
| 35 | %assign i 0 |
| 36 | %rep 32 |
| 37 | raise_exception_getaddr i |
| 38 | %assign i i+1 |
| 39 | %endrep |
| 40 | |
| 41 | section .note.GNU-stack noalloc noexec nowrite progbits |
