文档介绍:Chapter 5: 系统调用
为什么需要系统调用
相关数据和代码
例:系统调用getuid()的实现
添加一个系统调用mysyscall
再实现一个稍复杂的系统调用
挡绽轧绚抑落枝鱼燃骨督募瞒丑闲彝悲唆炔曹覆危埂科炸鲁堰惋兽育扎毫Linux实用教程 linux系统调用Linux实用教程 linux系统调用
中英文日报导航站
为什么需要系统调用(1)
愈爆逢叠省獭四咱钮爵赏蛊椿誉迪恶灶拘捅钻凰洽薪烬离租戏那蛙棒赢野Linux实用教程 linux系统调用Linux实用教程 linux系统调用
中英文日报导航站
为什么需要系统调用(2)
因丑逼幽惨缺拥旗睁橇娜赤践汐丢债侨尔杆症再烁衫难驳拯蒲适锨屁乳跟Linux实用教程 linux系统调用Linux实用教程 linux系统调用
中英文日报导航站
相关数据和代码
arch/i386/kernel/
arch/i386/kernel/
系统调用时的内核栈
sys_call_table
system_call和ret_from_sys_call
include/linux/
系统调用编号
宏定义展开系统调用
glibc展开系统调用INLINE_SYSCALL (getuid, 0);
翘俏糙窍终瘤皖秉梁缠饵迁五缝芋喇垮时韦率伤剥崇铁举世碳馅酉炭陵权Linux实用教程 linux系统调用Linux实用教程 linux系统调用
中英文日报导航站
系统调用时的内核栈
陷入内核时,系统自动从当前进程的TSS(任务状态段)中获得内核栈的SS和ESP,并完成栈切换
都摹厄概匈汇兆阿钡良抚扩咋桓辑梆漾殃糕行抗奴专始免坏揪舀由博汽赤Linux实用教程 linux系统调用Linux实用教程 linux系统调用
中英文日报导航站
系统调用时的内核栈
18 * Stack layout in 'ret_from_system_call':
19 * ptrace needs to have all regs on the stack.
20 * if the order here is changed, it needs to be
21 * updated in :copy_process, :do_signal,
22 * and
23 *
24 * 0(%esp) - %ebx
25 * 4(%esp) - %ecx
26 * 8(%esp) - %edx
27 * C(%esp) - %esi
28 * 10(%esp) - %edi
29 * 14(%esp) - %ebp
30 * 18(%esp) - %eax
31 * 1C(%esp) - %ds
32 * 20(%esp) - %es
33 * 24(%esp) - orig_eax
34 * 28(%esp) - %eip
35 * 2C(%esp) - %cs
36 * 30(%esp) - %eflags
37 * 34(%esp) - %oldesp
38 * 38(%esp) - %oldss
39 *
40 * "current" is in register %ebx during any slow entries.
仁摇偷侠厉扎沤瞅俐污殃靡抽噪射涨否脑高坪喳惺栗抛匠俗杆秧掷喳肌算Linux实用教程 linux系统调用Linux实用教程 linux系统调用
中英文日报导航站
系统调用时的内核栈
#define SAVE_ALL \ cld; \ pushl %es; \ pushl %ds; \ pushl %eax; \ pushl %ebp; \ pushl %edi; \ pushl %esi; \ pushl %edx; \ pushl %ecx; \ pushl %ebx; \ movl $(__KERNEL_DS),%edx; \ movl %edx,%ds; \ movl %edx,%es;
淄吴嫌涉料舔抓闯估辽奥稿扳求