syscall.s (801B)
1 /* System call implementation */ 2 .section .text 3 4 /* System call handler - called by int 0x80 */ 5 .global syscall_handler 6 .type syscall_handler, @function 7 syscall_handler: 8 /* Save all registers */ 9 pushl %ebp 10 pushl %edi 11 pushl %esi 12 pushl %edx 13 pushl %ecx 14 pushl %ebx 15 pushl %eax 16 17 /* Call C handler with syscall number (eax) and parameters */ 18 pushl %edx /* param 3 */ 19 pushl %ecx /* param 2 */ 20 pushl %ebx /* param 1 */ 21 pushl %eax /* syscall number */ 22 call handle_syscall 23 addl $16, %esp 24 25 /* Restore registers (except eax which has return value) */ 26 addl $4, %esp /* Skip saved eax */ 27 popl %ebx 28 popl %ecx 29 popl %edx 30 popl %esi 31 popl %edi 32 popl %ebp 33 34 iret 35 36 .size syscall_handler, . - syscall_handler