- 论坛徽章:
- 0
|
本帖最后由 ww2000e 于 2012-03-12 00:59 编辑
include/linux/sys.h- extern int sys_fork();
- fn_ptr sys_call_table[] = { sys_setup, sys_exit, sys_fork, sys_read,..................};
复制代码 include/unistd.h
- #define __NR_fork 2
- #define _syscall0(type,name) \
- type name(void) \
- { \
- long __res; \
- __asm__ volatile ("int $0x80" \
- : "=a" (__res) \
- : "0" (__NR_##name)); \
- if (__res >= 0) \
- return (type) __res; \
- errno = -__res; \
- return -1; \
- }
复制代码 init/main.c- static inline _syscall0(int,fork)
复制代码 kernel/fork.c
kernel/system_call.s- .align 2
- sys_fork:
- call find_empty_process
- testl %eax,%eax
- js 1f
- push %gs
- pushl %esi
- pushl %edi
- pushl %ebp
- pushl %eax
- call copy_process
- addl $20,%esp
- 1: ret
复制代码 差了下 fork就涉及这几个文件吧 |
|