Linux1.0内核中断体系的建立
来源:互联网 发布:mac清理垃圾软件 编辑:程序博客网 时间:2024/06/05 03:26
head.S中设置了IDT的指针,共256项,都指向ignore_int函数
ignore_int: cld pushl %eax pushl %ecx pushl %edx push %ds push %es push %fs movl $(KERNEL_DS),%eax mov %ax,%ds mov %ax,%es mov %ax,%fs pushl $int_msg call _printk popl %eax pop %fs pop %es pop %ds popl %edx popl %ecx popl %eax iret
而在Traps.c文件中,对可能出现的异常进行初始化
void trap_init(void){ int i; set_trap_gate(0,÷_error); set_trap_gate(1,&debug); set_trap_gate(2,&nmi); set_system_gate(3,&int3); /* int3-5 can be called from all */ set_system_gate(4,&overflow); set_system_gate(5,&bounds); set_trap_gate(6,&invalid_op); set_trap_gate(7,&device_not_available); set_trap_gate(8,&double_fault); set_trap_gate(9,&coprocessor_segment_overrun); set_trap_gate(10,&invalid_TSS); set_trap_gate(11,&segment_not_present); set_trap_gate(12,&stack_segment); set_trap_gate(13,&general_protection); set_trap_gate(14,&page_fault); set_trap_gate(15,&reserved); set_trap_gate(16,&coprocessor_error); set_trap_gate(17,&alignment_check); for (i=18;i<48;i++) set_trap_gate(i,&reserved);}
至于硬件设备产生的中断,Linux1.0内核专门建立了对应的函数调用表,当产生中断则调用相应的函数。在IRQ.c文件中处理。
void init_IRQ(void){ int i; //初始化16个中断执行函数,初始化16个中断处理 for (i = 0; i < 16 ; i++) set_intr_gate(0x20+i,bad_interrupt[i]); //挂接2号,2号为连接从芯片,不执行任何事 if (irqaction(2,&ignore_IRQ)) printk("Unable to get IRQ2 for cascade\n"); //挂接irq与math操作,数学协处理器中断 if (request_irq(13,math_error_irq)) printk("Unable to get IRQ13 for math-error handler\n"); /* intialize the bottom half routines. */ for (i = 0; i < 32; i++) { bh_base[i].routine = NULL; bh_base[i].data = NULL; } bh_active = 0; intr_count = 0;}
0 0
- Linux1.0内核中断体系的建立
- linux1.0内核硬件须知
- Linux1.0内核主设备号
- linux1.0内核编译为elf文件格式,导致无法运行
- linux1.0的磁盘缓存buffer cache
- linux1.0支持的设备文件
- Linux内核中断处理体系分析
- [smart210] s5pv210的中断体系
- [smart210] s5pv210的中断体系
- S5PV210的中断体系介绍
- linux1.0 Makefile
- Linux1.0 Socketpair通信
- Linux1
- linux1
- linux1
- linux1
- linux1
- linux1
- 特殊的IP地址详解
- [学习笔记—Objective-C]《Objective-C 程序设计 第6版》第四章 数据类型和表达式
- Tomcat的配置
- ubuntu12.04 minicom安装和使用
- Android的Fragment中onActivityResult不被调用的解决方案(绝对管用)
- Linux1.0内核中断体系的建立
- IntPtr介绍
- 如何在iOS应用中使用自定义字体
- MySQL存储引擎
- 微信支付流程(IOS)
- 获取html节点时过滤空白节点
- FFMPEG 批量连接视频文件示范代码
- 海量路由表可以使用HASH表存储吗-HASH查找和TRIE树查找
- Hibernate入门教程