中断发生后栈的布局--linux内核笔记
来源:互联网 发布:node.js express框架 编辑:程序博客网 时间:2024/05/01 00:08
异常发生后栈的布局:
ss
esp
eflags
cs
eip 以上由硬件自动完成压栈工作
ERROR_ CODE -----异常码,有些异常无异常码,用0代替(pushl 0)
function -----异常处理函数
pushl %ds
pushl %eax
xorl %eax,%eax
pushl %ebp
pushl %edi
pushl %esi
pushl %edx
decl %eax # eax = -1
pushl %ecx
pushl %ebx
cld
movl %es,%ecx
movl ORIG_EAX(%esp), %esi # get the error code
movl ES(%esp), %edi # get the function address
movl %eax, ORIG_EAX(%esp)
movl %ecx, ES(%esp)
movl %esp,%edx
pushl %esi # push the error code
pushl %edx # push the pt_regs pointer
movl $(__KERNEL_DS),%edx
movl %edx,%ds
movl %edx,%es
GET_CURRENT(%ebx)
call *%edi //调用异常处理函数,function(error_code, pt_regs)
addl $8,%esp
jmp ret_from_exception
中断发生后栈的布局:
ss
esp
eflags
cs
eip 以上由硬件自动完成压栈工作
irq --是一个负数, 为中断号-256,用irq & 0xFF取它的值,比如:1-256=-255=0xFFFFFF01, 跟0xFF与之后正好为1,但为什么用一个负数,还没搞清楚
ES
DS
EAX
EBP
EDI
ESI
EDX
ECX
EBX
call do_IRQ
do_IRQ定义如下:asmlinkage unsigned int do_IRQ(struct pt_regs regs)
系统调用发生后栈的布局:
ss
esp
eflags
cs
eip 以上由硬件自动完成压栈工作
syscall_no --系统调用的编号
ES
DS
EAX
EBP
EDI
ESI
EDX
ECX
EBX
call system_table[syscall_no](xxxxx)
我们再看看struct pt_regs刚好与栈中的数据相同,
struct pt_regs {
long ebx;
long ecx;
long edx;
long esi;
long edi;
long ebp;
long eax;
int xds;
int xes;
long orig_eax; //对就中断号或异常码或系统调用号
long eip;
int xcs;
long eflags;
long esp;
int xss;
};
- 中断发生后栈的布局--linux内核笔记
- linux-0.11调试教程,timer_interrupt,内核态发生的时钟中断(01)
- linux-0.11调试教程,timer_interrupt,内核态发生的时钟中断(02)
- linux内核学习笔记:中断的下半部分
- 中断发生时用户堆栈和内核堆栈的切换
- 中断发生时用户堆栈和内核堆栈的切换
- linux内核的中断开关
- Linux内核的中断机制
- Linux内核的时钟中断
- Linux内核的中断子系统
- Linux内核的中断机制
- linux内核学习笔记:中断与异常
- linux内核分析笔记---中断实现
- linux 内核笔记--中断子系统之softirq
- linux内核笔记--中断子系统之tasklet
- linux内核分析笔记----中断和中断处理程序
- linux内核分析笔记----中断和中断处理程序
- linux内核分析笔记----中断和中断处理程序
- SQL Server补丁安装常见问题(更新) http://www.xfocus.net/articles/200301/480.html
- asterisk app命令中文翻译
- DLL编程04
- MySql1045错误解决方法
- 大脾气天蝎座
- 中断发生后栈的布局--linux内核笔记
- 不了解CRM的可以看看这则笑话,一定会有感觉的
- 网页中下拉列表框自动展开的方法
- c++中宏的使用
- Asterisk PBX 配置文件 - 1
- 高斯混合模型的期望最大化算法
- 你的心态决定了你的成败 [转载]
- 感性与理性作品集-李宗盛
- 斯达康 ut-300r adsl modem 开启路由详解