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