📄 defs.h
字号:
/*文件名: defs.h
说明: i386段结构等定义
作者: marsinfan
日期: 2005/12/10
*/
#ifndef _defs_h_
#define _defs_h_
#include "types.h"
/* 端口 */
#define PORT_8259M 0x20
#define PORT_8259S 0xA0
#define PORT_KBD_A 0x60
#define EOI 0x20
/* 访问标志 */
#define ACS_PRESENT 0x80 /* present segment */
#define ACS_CSEG 0x18 /* 代码段 */
#define ACS_DSEG 0x10 /* 数据段 */
#define ACS_CONFORM 0x04 /* conforming segment */
#define ACS_READ 0x02 /* 可读段 */
#define ACS_WRITE 0x02 /* 可写段 */
#define ACS_IDT ACS_DSEG /* segment type is the same type */
#define ACS_INT_GATE 0x0E /* int gate for 386 */
#define ACS_TRAP_GATE 0x0F /* TRAP gate for 386 */
#define ACS_INT (ACS_PRESENT | ACS_INT_GATE) /* present int gate */
#define ACS_TRAP (ACS_PRESENT| ACS_TRAP_GATE) /* present int gate */
#define ACS_TSS_GATE 0x09
#define ACS_TSS (ACS_PRESENT | ACS_TSS_GATE) /* present tss gate */
#define ACS_DPL_0 0x00 /* descriptor privilege level #0 */
//#define ACS_DPL_1 0x20 /* descriptor privilege level #1 */
//#define ACS_DPL_2 0x40 /* descriptor privilege level #2 */
#define ACS_DPL_3 0x60 /* descriptor privilege level #3 */
//#define ACS_LDT 0x02 /* ldt descriptor */
/* Ready-made values */
#define ACS_CODE (ACS_PRESENT | ACS_CSEG | ACS_READ)
#define ACS_DATA (ACS_PRESENT | ACS_DSEG | ACS_WRITE)
#define ACS_STACK (ACS_PRESENT | ACS_DSEG | ACS_WRITE)
/* Attributes (in turms of size) */
#define ATTR_GRANULARITY 0x80 /* segment limit is given in 4KB pages rather than in bytes */
#define ATTR_BIG 0x40 /* ESP is used rather than SP */
#define ATTR_DEFAULT 0x40 /* 32-bit code segment rather than 16-bit */
/* 段描述符定义 */
typedef struct
{
u16 limit, base_l;
u8 base_m, access, attribs, base_h;
} __attribute__((packed)) DESCR_SEG;
/* GDTR 寄存器定义 */
typedef struct
{
u16 limit;
u32 base;
} __attribute__((packed)) GDTR;
/* 中断描述符定义 */
typedef struct
{
u16 offset_l;
u16 selector ;
u8 param_cnt;
u8 access;
u16 offset_h;
} __attribute__((packed)) DESCR_INT;
/* IDTR 寄存器定义 */
typedef struct
{
u16 limit;
u32 base ;
} __attribute__((packed)) IDTR;
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -