- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinterrupt.s
More file actions
Latest commit
17 lines (13 loc) · 585 Bytes
/
Copy pathinterrupt.s
File metadata and controls
17 lines (13 loc) · 585 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
globalsyscall_stub
externsyscall_handler
section .text
syscall_stub:
pushad ; Save EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI
; Pass arguments from registers to C syscall handler
pushedx ; Argument 2
pushecx ; Argument 1
pusheax ; Syscall Number
call syscall_handler ; Call C dispatcher function in idt.c
addesp,12 ; Clean up pushed arguments from stack
popad ; Restore general purpose registers
iretd ; Return from interrupt (Restores CS, EIP, EFLAGS)