Linux系统内核分析实验——system_call中断处理过程
来源:互联网 发布:苏亚雷斯巴萨数据 编辑:程序博客网 时间:2024/06/05 08:42
在linux中,当一个系统调用发生时,linux内核会做什么事?
linux system_call处理代码,该处理函数大量直接操作寄存器
ENTRY(system_call) RING0_INT_FRAME # can't unwind into user space anyway ASM_CLAC pushl_cfi %eax # save orig_eax SAVE_ALL GET_THREAD_INFO(%ebp) # system call tracing in operation / emulation testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%ebp) jnz syscall_trace_entry cmpl $(NR_syscalls), %eax jae syscall_badsyssyscall_call: call *sys_call_table(,%eax,4)syscall_after_call: movl %eax,PT_EAX(%esp) # store the return valuesyscall_exit: LOCKDEP_SYS_EXIT DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt # setting need_resched or sigpending # between sampling and the iret TRACE_IRQS_OFF movl TI_flags(%ebp), %ecx testl $_TIF_ALLWORK_MASK, %ecx # current->work jne syscall_exit_workrestore_all: TRACE_IRQS_IRETrestore_all_notrace:#ifdef CONFIG_X86_ESPFIX32 movl PT_EFLAGS(%esp), %eax # mix EFLAGS, SS and CS # Warning: PT_OLDSS(%esp) contains the wrong/random values if we # are returning to the kernel. # See comments in process.c:copy_thread() for details. movb PT_OLDSS(%esp), %ah movb PT_CS(%esp), %al andl $(X86_EFLAGS_VM | (SEGMENT_TI_MASK << 8) | SEGMENT_RPL_MASK), %eax cmpl $((SEGMENT_LDT << 8) | USER_RPL), %eax CFI_REMEMBER_STATE je ldt_ss # returning to user-space with LDT SS#endifrestore_nocheck: RESTORE_REGS 4 # skip orig_eax/error_codeirq_return: INTERRUPT_RETURN
大致流程:
1. 进入system_call
2. 保护现场SAVE_ALL
3. 根据eax中的调用号在系统调用表中调用相应功能
4. 存储返回值
5. 调用syscall_exit_work,进行中断检测与进程调度
6. 回复现场,返回用户态
0 0
- Linux系统内核分析实验——system_call中断处理过程
- Linux内核分析实验五—分析system_call中断处理过程
- Linux内核分析 实验五:分析system_call中断处理过程
- Linux内核分析 实验五:分析system_call中断处理过程
- MOOC《Linux内核分析》——分析system_call中断处理过程
- [网易云课堂]Linux内核分析(五)—— 分析system_call中断处理过程
- Linux内核分析:分析system_call中断处理过程
- Linux内核分析5:分析system_call中断处理过程
- Linux内核分析课程--分析system_call中断处理过程
- MOOC-Linux内核lab5 分析system_call中断处理过程
- Linux内核分析学习笔记:system_call中断处理过程
- Linux内核分析之简析system_call中断处理过程
- 通过实验分析system_call中断处理过程
- 实验五:分析system_call中断处理过程
- 分析system_call中断处理过程(Linux)
- 分析system_call中断处理过程
- system_call中断处理过程分析
- system_call中断处理过程分析
- centos 7配置ip地址
- OpenCV_(HougLines transform)霍夫变换检测直线
- 基础算法——快速排序
- Android 自定义View学习之文字绘制
- UItableveiw的一些使用
- Linux系统内核分析实验——system_call中断处理过程
- JAVA HttpURLConnection Post方式提交传递参数
- css3实现的手风琴效果
- GYM 101102 C.Bored Judge(map)
- Struts2配置RESULT中TYPE的参数说明
- 给定两个排序的数组,其中A有足够空间容纳B,实现一个方法将B容纳进A并排序
- Codeforces Round #404 (Div. 2) A. Anton and Polyhedrons
- eclipse中安装svn插件
- Linux查看物理CPU个数、核数、逻辑CPU个数