⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 interrupt.h

📁 保护模式下8259A芯片编程及中断处理探究
💻 H
字号:
#ifndef _PYOS_INTERRUPT_H_
#define _PYOS_INTERRUPT_H_

#include "system.h"

/* 中断描述符结构 */
struct struct_pyos_InterruptItem{
  unsigned short Offset_0_15 ; // 偏移量的0~15位
  unsigned short SegSelector ; // 段选择符
  unsigned char UnUsed ; // 未使用,须设为全零
  unsigned char Saved_1_1_0 : 3 ; // 保留,需设为 110
  unsigned char D : 1 ; // D 位
  unsigned char Saved_0 : 1 ; // 保留,需设为0
  unsigned char DPL : 2 ; // 特权位
  unsigned char P : 1 ; // P 位
  unsigned short Offset_16_31 ; // 偏移量的16~31位
} ;

/* IDTR所用结构 */
struct struct_pyos_Idtr{
  unsigned short IdtLengthLimit ;
  struct_pyos_InterruptItem* IdtAddr ;
} ;

/* 定义中断类,专门处理系统中断 */
class class_pyos_Interrupt{
  friend class class_pyos_System ; // 声明 class_PYOS_System 为其友元类

  protected:
    class_pyos_Interrupt(){} ;

    static struct_pyos_InterruptItem m_Idt[ 256 ] ; // 中断描述符表项
    static struct_pyos_Idtr m_Idtr ;

    static void Init() ;
    static void InitInterruptTable() ; // 中断向量表初始化
    static void Init8259A();
} ;

extern "C" void pyos_asm_interrupt_handle_for_default() ;

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -