📄 trap.h
字号:
#ifndef JOS_INC_TRAP_H#define JOS_INC_TRAP_H// Trap numbers// These are processor defined:#define T_DIVIDE 0 // divide error#define T_DEBUG 1 // debug exception#define T_NMI 2 // non-maskable interrupt#define T_BRKPT 3 // breakpoint#define T_OFLOW 4 // overflow#define T_BOUND 5 // bounds check#define T_ILLOP 6 // illegal opcode#define T_DEVICE 7 // device not available #define T_DBLFLT 8 // double fault/* #define T_COPROC 9 */ // reserved (not generated by recent processors)#define T_TSS 10 // invalid task switch segment#define T_SEGNP 11 // segment not present#define T_STACK 12 // stack exception#define T_GPFLT 13 // general protection fault#define T_PGFLT 14 // page fault/* #define T_RES 15 */ // reserved#define T_FPERR 16 // floating point error#define T_ALIGN 17 // aligment check#define T_MCHK 18 // machine check#define T_SIMDERR 19 // SIMD floating point error// These are arbitrarily chosen, but with care not to overlap// processor defined exceptions or interrupt vectors.#define T_SYSCALL 48 // system call#define T_DEFAULT 500 // catchall#ifndef __ASSEMBLER__#include <inc/types.h>struct PushRegs { /* registers as pushed by pusha */ uint32_t reg_edi; uint32_t reg_esi; uint32_t reg_ebp; uint32_t reg_oesp; /* Useless */ uint32_t reg_ebx; uint32_t reg_edx; uint32_t reg_ecx; uint32_t reg_eax;};struct Trapframe { struct PushRegs tf_regs; uint16_t tf_es; uint16_t tf_padding1; uint16_t tf_ds; uint16_t tf_padding2; uint32_t tf_trapno; /* below here defined by x86 hardware */ uint32_t tf_err; uintptr_t tf_eip; uint16_t tf_cs; uint16_t tf_padding3; uint32_t tf_eflags; /* below here only when crossing rings, such as from user to kernel */ uintptr_t tf_esp; uint16_t tf_ss; uint16_t tf_padding4;};#endif /* !__ASSEMBLER__ */// Must equal 'sizeof(struct Trapframe)'.// A static_assert in kern/trap.c checks this.#define SIZEOF_STRUCT_TRAPFRAME 0x44#endif /* !JOS_INC_TRAP_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -