2 #include <lunaix/syscall.h>
5 .type syscall_hndlr, @function
10 movl 8(%esp), %ebx // struct hart_state*
13 movl (%ebx), %eax /* eax: call code as well as the return value from syscall */
14 cmpl $__SYSCALL_MAX, %eax
18 addl $__syscall_table, %eax
29 pushl 24(%ebx) /* esi - #5 arg */
30 pushl 16(%ebx) /* edi - #4 arg */
31 pushl 12(%ebx) /* edx - #3 arg */
32 pushl 8(%ebx) /* ecx - #2 arg */
33 pushl 4(%ebx) /* ebx - #1 arg */
38 addl $24, %esp /* remove the parameters from stack */
41 movl %eax, (%ebx) /* save the return value */