[Krafton Jungle] PintOS 2.0.0
크래프톤 정글 PintOS
 
Loading...
Searching...
No Matches
exception.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PF_P   0x1 /* 0: not-present page. 1: access rights violation. */
 
#define PF_W   0x2 /* 0: read, 1: write. */
 
#define PF_U   0x4 /* 0: kernel, 1: user process. */
 

Functions

void exception_init (void)
 
void exception_print_stats (void)
 

Macro Definition Documentation

◆ PF_P

#define PF_P   0x1 /* 0: not-present page. 1: access rights violation. */

◆ PF_U

#define PF_U   0x4 /* 0: kernel, 1: user process. */

◆ PF_W

#define PF_W   0x2 /* 0: read, 1: write. */

Function Documentation

◆ exception_init()

void exception_init ( void  )
31 {
32 /* These exceptions can be raised explicitly by a user program,
33 e.g. via the INT, INT3, INTO, and BOUND instructions. Thus,
34 we set DPL==3, meaning that user programs are allowed to
35 invoke them via these instructions. */
36 intr_register_int (3, 3, INTR_ON, kill, "#BP Breakpoint Exception");
37 intr_register_int (4, 3, INTR_ON, kill, "#OF Overflow Exception");
39 "#BR BOUND Range Exceeded Exception");
40
41 /* These exceptions have DPL==0, preventing user processes from
42 invoking them via the INT instruction. They can still be
43 caused indirectly, e.g. #DE can be caused by dividing by
44 0. */
45 intr_register_int (0, 0, INTR_ON, kill, "#DE Divide Error");
46 intr_register_int (1, 0, INTR_ON, kill, "#DB Debug Exception");
47 intr_register_int (6, 0, INTR_ON, kill, "#UD Invalid Opcode Exception");
49 "#NM Device Not Available Exception");
50 intr_register_int (11, 0, INTR_ON, kill, "#NP Segment Not Present");
51 intr_register_int (12, 0, INTR_ON, kill, "#SS Stack Fault Exception");
52 intr_register_int (13, 0, INTR_ON, kill, "#GP General Protection Exception");
53 intr_register_int (16, 0, INTR_ON, kill, "#MF x87 FPU Floating-Point Error");
55 "#XF SIMD Floating-Point Exception");
56
57 /* Most exceptions can be handled with interrupts turned on.
58 We need to disable interrupts for page faults because the
59 fault address is stored in CR2 and needs to be preserved. */
60 intr_register_int (14, 0, INTR_OFF, page_fault, "#PF Page-Fault Exception");
61}
static void kill(struct intr_frame *)
Definition: exception.c:71
static void page_fault(struct intr_frame *)
Definition: exception.c:120
@ INTR_ON
Definition: interrupt.h:10
@ INTR_OFF
Definition: interrupt.h:9
void intr_register_int(uint8_t vec, int dpl, enum intr_level, intr_handler_func *, const char *name)
Definition: interrupt.c:248
Here is the call graph for this function:
Here is the caller graph for this function:

◆ exception_print_stats()

void exception_print_stats ( void  )
65 {
66 printf ("Exception: %lld page faults\n", page_fault_cnt);
67}
static long long page_fault_cnt
Definition: exception.c:10
int printf(const char *,...) PRINTF_FORMAT(1
Here is the call graph for this function:
Here is the caller graph for this function: