Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1826553
  • 博文数量: 286
  • 博客积分: 3713
  • 博客等级: 少校
  • 技术积分: 2275
  • 用 户 组: 普通用户
  • 注册时间: 2012-01-11 09:47
个人简介

http://blog.chinaunix.net/uid/16979052.html

文章分类

全部博文(286)

文章存档

2018年(1)

2017年(16)

2016年(9)

2015年(17)

2014年(15)

2013年(112)

2012年(116)

分类: LINUX

2012-06-28 08:12:11

#include

.text
.global wrappers

.macro ISRNOERROR func,nr
.align 4
\func:
pushl $0
pushl $\nr
jmp error_code
.endm

.macro ISR__ERROR func,nr
.align 4
\func:
pushl $\nr
jmp error_code
.endm

.align 4
error_code:
pusha
push %ds
push %es
push %fs
push %gs
mov $KERNEL_DS_SEL,%ax
mov %eax,%ds
mov %eax,%es
mov %eax,%fs
mov %eax,%gs
mov %esp,%eax
push %eax
call intr_handler
pop %eax
pop %gs
pop %fs
pop %es
pop %ds
popa
add $0x8,%esp /*skip intr_no, err_code*/
iret


ISRNOERROR _isr_00, 0x00
ISRNOERROR _isr_01, 0x01
ISRNOERROR _isr_02, 0x02
ISRNOERROR _isr_03, 0x03
ISRNOERROR _isr_04, 0x04
ISRNOERROR _isr_05, 0x05
ISRNOERROR _isr_06, 0x06
ISRNOERROR _isr_07, 0x07
ISR__ERROR _isr_08, 0x08
ISRNOERROR _isr_09, 0x09
ISR__ERROR _isr_0A, 0x0A
ISR__ERROR _isr_0B, 0x0B
ISR__ERROR _isr_0C, 0x0C
ISR__ERROR _isr_0D, 0x0D
ISR__ERROR _isr_0E, 0x0E
ISRNOERROR _isr_0F, 0x0F
ISRNOERROR _isr_10, 0x10
ISR__ERROR _isr_11, 0x11
ISRNOERROR _isr_12, 0x12
ISRNOERROR _isr_13, 0x13
ISRNOERROR _isr_14, 0x14
ISRNOERROR _isr_15, 0x15
ISRNOERROR _isr_16, 0x16
ISRNOERROR _isr_17, 0x17
ISRNOERROR _isr_18, 0x18
ISRNOERROR _isr_19, 0x19
ISRNOERROR _isr_1A, 0x1A
ISRNOERROR _isr_1B, 0x1B
ISRNOERROR _isr_1C, 0x1C
ISRNOERROR _isr_1D, 0x1D
ISRNOERROR _isr_1E, 0x1E
ISRNOERROR _isr_1F, 0x1F

/*ISRNOERROR _isr_20, 0x20 */

ISRNOERROR _isr_21, 0x21
ISRNOERROR _isr_22, 0x22
ISRNOERROR _isr_23, 0x23
ISRNOERROR _isr_24, 0x24
ISRNOERROR _isr_25, 0x25
ISRNOERROR _isr_26, 0x26
ISRNOERROR _isr_27, 0x27
ISRNOERROR _isr_28, 0x28
ISRNOERROR _isr_29, 0x29
ISRNOERROR _isr_2A, 0x2A
ISRNOERROR _isr_2B, 0x2B
ISRNOERROR _isr_2C, 0x2C
ISRNOERROR _isr_2D, 0x2D
ISRNOERROR _isr_2E, 0x2E
ISRNOERROR _isr_2F, 0x2F

.align 4
wrappers:
.long _isr_00, _isr_01, _isr_02, _isr_03, _isr_04, _isr_05, _isr_06, _isr_07
.long _isr_08, _isr_09, _isr_0A, _isr_0B, _isr_0C, _isr_0D, _isr_0E, _isr_0F
.long _isr_10, _isr_11, _isr_12, _isr_13, _isr_14, _isr_15, _isr_16, _isr_17
.long _isr_18, _isr_19, _isr_1A, _isr_1B, _isr_1C, _isr_1D, _isr_1E, _isr_1F
.long _isr_20, _isr_21, _isr_22, _isr_23, _isr_24, _isr_25, _isr_26, _isr_27
.long _isr_28, _isr_29, _isr_2A, _isr_2B, _isr_2C, _isr_2D, _isr_2E, _isr_2F
.long 0, 0, 0, 0, 0, 0, 0, 0
.long 0, 0, 0, 0, 0, 0, 0, 0
.long 0, 0, 0, 0, 0, 0, 0, 0
.long 0, 0, 0, 0, 0, 0, 0, 0
.long 0, 0, 0, 0, 0, 0, 0, 0
.long 0, 0, 0, 0, 0, 0, 0, 0
.long 0, 0, 0, 0, 0, 0, 0, 0
.long 0, 0, 0, 0, 0, 0, 0, 0
.long 0, 0, 0, 0, 0, 0, 0, 0
.long 0, 0, 0, 0, 0, 0, 0, 0
.long 0

_isr_20:
cli
push $0x0 /*push a dummy error code*/
push $0x20
pusha
push %ds
push %es
push %fs
push %gs
mov $KERNEL_DS_SEL,%ax
mov %eax,%ds
mov %eax,%es
mov %eax,%fs
mov %eax,%gs
mov %esp,%eax
push %eax
call intr_handler
add $0x4,%esp /*balance stack, 1 parameter.*/
mov %esp,%eax
push %eax
call task_switch
# add $0x4,%esp /*balance stack, no used*/
mov %eax,%esp /*put return value to esp(return value as stack pointer)*/
pop %gs
pop %fs
pop %es
pop %ds
popa
add $0x8,%esp
sti
iret

阅读(989) | 评论(0) | 转发(0) |
0

上一篇:include/types.h

下一篇:kernel/kernel.ld

给主人留下些什么吧!~~