|
@@ -11,6 +11,20 @@
|
|
|
#define PIC_S_DATA 0xA1 // 从片的数据端口是 0xA1
|
|
#define PIC_S_DATA 0xA1 // 从片的数据端口是 0xA1
|
|
|
|
|
|
|
|
typedef void *intr_handler;
|
|
typedef void *intr_handler;
|
|
|
|
|
+void itd_init(void);
|
|
|
|
|
+
|
|
|
|
|
+/* 定义中断的两种状态:
|
|
|
|
|
+ * INTR_OFF值为 0,表示关中断
|
|
|
|
|
+ * INTR_ON值为 1,表示开中断 */
|
|
|
|
|
+enum intr_status
|
|
|
|
|
+{
|
|
|
|
|
+ INTR_OFF,
|
|
|
|
|
+ INTR_ON
|
|
|
|
|
+};
|
|
|
|
|
+enum intr_status intr_get_status(void);
|
|
|
|
|
+enum intr_status intr_set_status(enum intr_status);
|
|
|
|
|
+enum intr_status intr_enable(void);
|
|
|
|
|
+enum intr_status intr_disable(void);
|
|
|
|
|
|
|
|
/* 中断门描述符结构体 */
|
|
/* 中断门描述符结构体 */
|
|
|
// Example type_attributes values that people are likely to use (assuming DPL is 0):
|
|
// Example type_attributes values that people are likely to use (assuming DPL is 0):
|
|
@@ -28,7 +42,6 @@ typedef struct
|
|
|
|
|
|
|
|
static void make_idt_desc(gate_desc *p_gdesc, uint8_t attr, intr_handler function);
|
|
static void make_idt_desc(gate_desc *p_gdesc, uint8_t attr, intr_handler function);
|
|
|
static void itd_desc_init(void);
|
|
static void itd_desc_init(void);
|
|
|
-void itd_init(void);
|
|
|
|
|
|
|
|
|
|
static gate_desc idt[IDT_DESC_CNT]; // 中断描述符表,本质上就是个中断门描述符数组
|
|
static gate_desc idt[IDT_DESC_CNT]; // 中断描述符表,本质上就是个中断门描述符数组
|
|
|
// 定义中断处理程序数组.在 kernel.S 中定义的intrXXentry只是中断处理程序的入口,最终调用的是ide_table中的处理程序
|
|
// 定义中断处理程序数组.在 kernel.S 中定义的intrXXentry只是中断处理程序的入口,最终调用的是ide_table中的处理程序
|