NetcanOS
Netcan OS is an operation system for x86 PCs, for learning how os works.
int_handler.h
浏览该文件的文档.
1 /*************************************************************************
2  > File Name: kernel/init_handler.h
3  > Author: Netcan
4  > Blog: http://www.netcan666.com
5  > Mail: 1469709759@qq.com
6  > Created Time: 2018-07-09 Mon 22:47:21 CST
7  ************************************************************************/
8 
9 #include <io.h>
10 #ifndef INIT_HANDLER_H
11 #define INIT_HANDLER_H
12 #define IRQ0 32
13 #define IRQ1 33
14 #define IRQ2 34
15 #define IRQ3 35
16 #define IRQ4 36
17 #define IRQ5 37
18 #define IRQ6 38
19 #define IRQ7 39
20 #define IRQ8 40
21 #define IRQ9 41
22 #define IRQ10 42
23 #define IRQ11 43
24 #define IRQ12 44
25 #define IRQ13 45
26 #define IRQ14 46
27 #define IRQ15 47
28 
29 typedef struct registers {
30  u32 ds; // 数据段选择
31  u32 edi, esi, ebp, esp, ebx, edx, ecx, eax; // 通用寄存器
32  u32 int_no, err_code; // 中断号、错误码
33  u32 eip, cs, eflags, sp, ss; // 中断恢复
34 } registers_t;
35 
36 void isr_handler(registers_t regs);
37 
38 typedef void (*int_handler_t)(registers_t);
39 extern int_handler_t int_handlers[0x100];
40 void register_int_handler(u8 int_no, int_handler_t handler);
41 #endif
u32 ebx
Definition: int_handler.h:31
void(* int_handler_t)(registers_t)
Definition: int_handler.h:38
u32 ss
Definition: int_handler.h:33
Definition: int_handler.h:29
u32 cs
Definition: int_handler.h:33
u32 eip
Definition: int_handler.h:33
u32 eflags
Definition: int_handler.h:33
u32 ds
Definition: int_handler.h:30
unsigned char u8
Definition: io.h:18
u32 edi
Definition: int_handler.h:31
u32 edx
Definition: int_handler.h:31
u32 sp
Definition: int_handler.h:33
u32 ebp
Definition: int_handler.h:31
struct registers registers_t
u32 int_no
Definition: int_handler.h:32
void register_int_handler(u8 int_no, int_handler_t handler)
注册中断程序 int_no 中断号 handler 中断处理程序
Definition: int_handler.c:18
u32 esi
Definition: int_handler.h:31
void isr_handler(registers_t regs)
中断处理程序(中断号<32,又叫异常),处理系统中断system error。
Definition: int_handler.c:26
int_handler_t int_handlers[0x100]
Definition: int_handler.c:13
unsigned int u32
Definition: io.h:14
u32 eax
Definition: int_handler.h:31
u32 err_code
Definition: int_handler.h:32
u32 esp
Definition: int_handler.h:31
u32 ecx
Definition: int_handler.h:31