2 #include <lunaix/syscall.h>
3 #include "syscall_nr.inc"
6 .type syscall_hndlr, @function
11 movl 8(%esp), %ebx // struct hart_state*
14 movl (%ebx), %eax /* eax: call code as well as the return value from syscall */
15 cmpl $__SYSCALL_MAX, %eax
19 addl $syscall_table, %eax
30 pushl 24(%ebx) /* esi - #5 arg */
31 pushl 16(%ebx) /* edi - #4 arg */
32 pushl 12(%ebx) /* edx - #3 arg */
33 pushl 8(%ebx) /* ecx - #2 arg */
34 pushl 4(%ebx) /* ebx - #1 arg */
39 addl $24, %esp /* remove the parameters from stack */
42 movl %eax, (%ebx) /* save the return value */