2 #include <lunaix/syscall.h>
6 注意,这里的顺序非常重要。每个系统调用在这个地址表里的索引等于其调用号。
11 .long __lxsys_fork /* 1 */
15 .long __lxsys_getpid /* 5 */
20 .long __lxsys_waitpid /* 10 */
21 .long __lxsys_sigreturn
22 .long __lxsys_sigprocmask
25 .long __lxsys_kill /* 15 */
27 .long __lxsys_sigpending
28 .long __lxsys_sigsuspend
30 .long __lxsys_close /* 20 */
35 .long __lxsys_lseek /* 25 */
36 .long __lxsys_geterrno
38 .rept __SYSCALL_MAX - (2b - 1b)/4
49 movl (%ebp), %eax /* eax: call code as well as the return value from syscall */
50 cmpl $__SYSCALL_MAX, %eax
54 addl $syscall_table, %eax
62 pushl 24(%ebp) /* esi - #6 arg */
63 pushl 20(%ebp) /* ebp - #5 arg */
64 pushl 16(%ebp) /* edi - #4 arg */
65 pushl 12(%ebp) /* edx - #3 arg */
66 pushl 8(%ebp) /* ecx - #2 arg */
67 pushl 4(%ebp) /* ebx - #1 arg */
71 movl %eax, (%ebp) /* save the return value */
73 addl $24, %esp /* remove the parameters from stack */