2 #include <lunaix/syscall.h>
6 注意,这里的顺序非常重要。每个系统调用在这个地址表里的索引等于其调用号。
11 .long __lxsys_fork /* 1 */
15 .long __lxsys_getpid /* 5 */
19 .long __lxsys_wait /* 9 */
21 .rept __SYSCALL_MAX - (2b - 1b)/4
32 movl (%ebp), %eax /* eax: call code as well as the return value from syscall */
33 cmpl $__SYSCALL_MAX, %eax
37 addl $syscall_table, %eax
45 pushl 24(%ebp) /* esi - #6 arg */
46 pushl 20(%ebp) /* ebp - #5 arg */
47 pushl 16(%ebp) /* edi - #4 arg */
48 pushl 12(%ebp) /* edx - #3 arg */
49 pushl 8(%ebp) /* ecx - #2 arg */
50 pushl 4(%ebp) /* ebx - #1 arg */
54 movl %eax, (%ebp) /* save the return value */
56 addl $24, %esp /* remove the parameters from stack */