include/protect.h
来源:互联网 发布:笔记本电池校正软件 编辑:程序博客网 时间:2024/06/03 21:51
- /*
- By Marcus Xing
- include/protect.h
- 在内核使用的有关保护模式的数据结构
- */
- /*
- forward include:
- type.h
- */
- #ifndef _PROTECT_H_
- #define _PROTECT_H_
- /* 外中断向量号 */
- #define INT_VECTOR_IRQ0 0x20 /* 0号外中断的向量号 */
- #define INT_VECTOR_IRQ8 0x28 /* 8号外中断的向量号 */
- #define SYSTEM_CALL_INT_VECTOR 0x90 /* 系统调用中断的向量号 */
- /* 系统内中断向量 */
- #define INT_VECTOR_DIVIDE 0x0
- #define INT_VECTOR_DEBUG 0x1
- #define INT_VECTOR_NMI 0x2
- #define INT_VECTOR_BREAKPOINT 0x3
- #define INT_VECTOR_OVERFLOW 0x4
- #define INT_VECTOR_BOUNDS 0x5
- #define INT_VECTOR_INVAL_OP 0x6
- #define INT_VECTOR_COPROC_NOT 0x7
- #define INT_VECTOR_DOUBLE_FAULT 0x8
- #define INT_VECTOR_COPROC_SEG 0x9
- #define INT_VECTOR_INVAL_TSS 0xA
- #define INT_VECTOR_SEG_NOT 0xB
- #define INT_VECTOR_STACK_FAULT 0xC
- #define INT_VECTOR_PROTECTION 0xD
- #define INT_VECTOR_PAGE_FAULT 0xE
- #define INT_VECTOR_COPROC_ERR 0x10
- /* 描述符索引 */
- #define DUMMY_INDEX 0
- #define FLAT_RW_INDEX 1
- #define FLAT_C_INDEX 2
- #define VIDEO_INDEX 3
- #define TSS_INDEX 4 /* TSS在GDT的索引 */
- #define FIRST_LDT_INDEX 5 /* 第一个进程的LDT在GDT中的索引 */
- /* 选择子 */
- #define SELECTOR_DUMMY 0
- #define SELECTOR_FLAT_RW 8
- #define SELECTOR_FLAT_C 16
- #define SELECTOR_VIDEO 24
- #define SELECTOR_TSS 32
- #define SELECTOR_FIRST_LDT 40
- #define SELECTOR_LDT_FLAT_RW 0 /* 进程LDT中的FLAT_RW选择子 */
- #define SELECTOR_LDT_FLAT_C 8 /* 进程LDT中的FLAT_C选择子 */
- /* 权限 */
- #define PRIVILEGE_KRNL 0
- #define PRIVILEGE_TASK 1
- #define PRIVILEGE_USER 3
- /* 描述符类型值说明 */
- #define DA_32 0x4000 /* 32 位段 */
- #define DA_LIMIT_4K 0x8000 /* 段界限粒度为 4K 字节 */
- #define DA_DPL0 0x00 /* DPL = 0 */
- #define DA_DPL1 0x20 /* DPL = 1 */
- #define DA_DPL2 0x40 /* DPL = 2 */
- #define DA_DPL3 0x60 /* DPL = 3 */
- /* 存储段描述符类型值说明 */
- #define DA_DR 0x90 /* 存在的只读数据段类型值 */
- #define DA_DRW 0x92 /* 存在的可读写数据段属性值 */
- #define DA_DRWA 0x93 /* 存在的已访问可读写数据段类型值 */
- #define DA_C 0x98 /* 存在的只执行代码段属性值 */
- #define DA_CR 0x9A /* 存在的可执行可读代码段属性值 */
- #define DA_CCO 0x9C /* 存在的只执行一致代码段属性值 */
- #define DA_CCOR 0x9E /* 存在的可执行可读一致代码段属性值 */
- /* 系统段描述符类型值说明 */
- #define DA_LDT 0x82 /* 局部描述符表段类型值 */
- #define DA_TaskGate 0x85 /* 任务门类型值 */
- #define DA_386TSS 0x89 /* 可用 386 任务状态段类型值 */
- #define DA_386CGate 0x8C /* 386 调用门类型值 */
- #define DA_386IGate 0x8E /* 386 中断门类型值 */
- #define DA_386TGate 0x8F /* 386 陷阱门类型值 */
- /* 选择子的类型值说明 */
- #define SA_RPL0 0 /* 选择子特权级0 */
- #define SA_RPL1 1 /* 选择子特权级1 */
- #define SA_RPL2 2 /* 选择子特权级2 */
- #define SA_RPL3 3 /* 选择子特权级3 */
- #define SA_TIG 0 /* 从GDT中读取描述符 */
- #define SA_TIL 4 /* 从LDT中读取描述符 */
- /* 数据段和系统段结构 */
- typedef struct s_descriptor
- {
- u16 limit_low; /* limit(0..15) */
- u16 base_low; /* base(0..15) */
- u8 base_mid; /* base(16..23) */
- u8 attr1; /* P(1) DPL(2) S(1) TYPE(4)*/
- u8 limit_high_attr2; /* G(1) D/B(1) O(1) AVL(1) limit(16..19) */
- u8 base_high; /* base(24..31) */
- }Descriptor;
- typedef struct s_gate
- {
- u16 offset_low; /* offset(0..15) */
- u16 selector; /* selector */
- u8 dcount; /* 调用门才用,表示传递的参数个数,非调用门为0 */
- u8 attr; /* P(1) DPL(2) S(1) TYPE(4) */
- u16 offset_high; /* offset(16..31) */
- }Gate;
- #endif
- include/protect.h
- include/protect.h
- #include stdio.h #include cstdio
- include *.c与 include *.h
- protect
- 如何include ntddk.h
- Not Include "stdafx.h"
- #include "stdafx.h"
- 关于#include "stdafx.h"
- 关于#include "stdafx.h"
- include .h文件
- #include "2DArray.h"
- #include "stdafx.h" 作用
- 关于#include "stdafx.h"
- include/console.h
- include/const.h
- include/global.h
- include/keyboard.h
- include/global.h
- include/ipc.h
- include/keyboard.h
- include/keymap.h
- include/proc.h
- include/protect.h
- include/proto.h
- include/tty.h
- include/type.h
- kernel/clock.c
- kernel/console.c
- kernel/global.c
- kernel/init_8253.c
- kernel/init_8259a.c