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 .rept __SYSCALL_MAX - (2b - 1b)/4
38 movl (%ebp), %eax /* eax: call code as well as the return value from syscall */
39 cmpl $__SYSCALL_MAX, %eax
43 addl $syscall_table, %eax
51 pushl 24(%ebp) /* esi - #6 arg */
52 pushl 20(%ebp) /* ebp - #5 arg */
53 pushl 16(%ebp) /* edi - #4 arg */
54 pushl 12(%ebp) /* edx - #3 arg */
55 pushl 8(%ebp) /* ecx - #2 arg */
56 pushl 4(%ebp) /* ebx - #1 arg */
60 movl %eax, (%ebp) /* save the return value */
62 addl $24, %esp /* remove the parameters from stack */