2023-02-08 13:07:44 +00:00
|
|
|
.code32
|
2021-11-03 19:03:38 +00:00
|
|
|
/*
|
|
|
|
* Interupt handlers
|
|
|
|
*/
|
|
|
|
|
2023-02-08 13:07:44 +00:00
|
|
|
.macro ISR_NOERRORCODE NAME, VECTOR
|
|
|
|
.globl irs\NAME
|
|
|
|
irs\NAME:
|
|
|
|
cli
|
|
|
|
push $0
|
|
|
|
push \VECTOR
|
|
|
|
jmp irs_common
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro ISR_ERROCODE NAME, VECTOR
|
|
|
|
.globl irs\NAME
|
|
|
|
irs\NAME:
|
|
|
|
cli
|
|
|
|
push \VECTOR
|
|
|
|
jmp irs_common
|
|
|
|
.endm
|
|
|
|
|
|
|
|
|
|
|
|
ISR_NOERRORCODE 0 $0
|
|
|
|
ISR_NOERRORCODE 1 $1
|
|
|
|
ISR_NOERRORCODE 2 $2
|
|
|
|
ISR_NOERRORCODE 3 $3
|
|
|
|
ISR_NOERRORCODE 4 $4
|
|
|
|
ISR_NOERRORCODE 5 $5
|
|
|
|
ISR_NOERRORCODE 6 $6
|
|
|
|
ISR_NOERRORCODE 7 $7
|
|
|
|
ISR_NOERRORCODE 8 $8
|
|
|
|
ISR_NOERRORCODE 9 $9
|
|
|
|
ISR_NOERRORCODE 10 $10
|
|
|
|
ISR_NOERRORCODE 11 $11
|
|
|
|
ISR_NOERRORCODE 12 $12
|
|
|
|
ISR_NOERRORCODE 13 $13
|
|
|
|
ISR_NOERRORCODE 14 $14
|
|
|
|
ISR_NOERRORCODE 15 $15
|
|
|
|
ISR_NOERRORCODE 16 $16
|
|
|
|
ISR_NOERRORCODE 17 $17
|
|
|
|
ISR_NOERRORCODE 18 $18
|
|
|
|
ISR_NOERRORCODE 19 $19
|
|
|
|
ISR_NOERRORCODE 20 $20
|
|
|
|
ISR_NOERRORCODE 21 $21
|
|
|
|
ISR_NOERRORCODE 22 $22
|
|
|
|
ISR_NOERRORCODE 23 $23
|
|
|
|
ISR_NOERRORCODE 24 $24
|
|
|
|
ISR_NOERRORCODE 25 $25
|
|
|
|
ISR_NOERRORCODE 26 $26
|
|
|
|
ISR_NOERRORCODE 27 $27
|
|
|
|
ISR_NOERRORCODE 28 $28
|
|
|
|
ISR_NOERRORCODE 29 $29
|
|
|
|
ISR_NOERRORCODE 30 $30
|
|
|
|
ISR_NOERRORCODE 31 $31
|
2023-02-26 23:34:30 +00:00
|
|
|
ISR_NOERRORCODE 50 $50
|
2021-11-03 19:03:38 +00:00
|
|
|
|
|
|
|
irs_common:
|
|
|
|
pusha # Pushes edi,esi,ebp,esp,ebx,edx,ecx,eax
|
|
|
|
|
|
|
|
mov %ds, %ax
|
|
|
|
push %eax
|
|
|
|
|
|
|
|
/* load the kernel data segment descriptor*/
|
|
|
|
|
|
|
|
mov $0x10, %ax
|
|
|
|
mov %ax, %ds
|
|
|
|
mov %ax, %es
|
|
|
|
mov %ax, %fs
|
|
|
|
mov %ax, %gs
|
2023-02-08 13:07:44 +00:00
|
|
|
|
|
|
|
mov %esp, %eax
|
|
|
|
push %eax
|
2021-11-03 19:03:38 +00:00
|
|
|
|
|
|
|
call irs_handler
|
2023-02-08 13:07:44 +00:00
|
|
|
|
2023-02-26 23:34:30 +00:00
|
|
|
pop %eax // pop stack pointer
|
2023-02-08 13:07:44 +00:00
|
|
|
pop %ebx // reload ther orignal data segment descriptor
|
|
|
|
mov %bx, %ds
|
|
|
|
mov %bx, %es
|
|
|
|
mov %bx, %fs
|
|
|
|
mov %bx, %gs
|
2021-11-03 19:03:38 +00:00
|
|
|
|
|
|
|
popa
|
2023-02-26 23:34:30 +00:00
|
|
|
add $8, %esp # cleans push error and irs code
|
2023-02-08 13:07:44 +00:00
|
|
|
|
2021-11-03 19:03:38 +00:00
|
|
|
iret # pops 5 things at once: CS, EIP, EFLAGS, SS, and ESP
|