39 "#BR BOUND Range Exceeded Exception");
49 "#NM Device Not Available Exception");
55 "#XF SIMD Floating-Point Exception");
89 printf (
"%s: dying due to interrupt %#04x (%s).\n",
100 PANIC (
"Kernel bug - unexpected interrupt in kernel");
105 printf (
"Interrupt %#04x (%s) in unknown segment %04x\n",
137 asm (
"movl %%cr2, %0" :
"=r" (fault_addr));
154 printf (
"Page fault at %p: %s error %s page in %s context.\n",
156 not_present ?
"not present" :
"rights violation",
157 write ?
"writing" :
"reading",
158 user ?
"user" :
"kernel");
#define PANIC(...)
Halts the OS, printing the source file name, line number, and function name, plus a user-specific mes...
static void page_fault(struct intr_frame *)
Page fault handler.
static long long page_fault_cnt
Number of page faults processed.
void exception_print_stats(void)
Prints exception statistics.
static void kill(struct intr_frame *)
Handler for an exception (probably) caused by a user process.
void exception_init(void)
Registers handlers for interrupts that can be caused by user programs.
#define PF_W
0: read, 1: write.
#define PF_P
Page fault error code bits that describe the cause of the exception.
#define PF_U
0: kernel, 1: user process.
#define SEL_UCSEG
Segment selectors.
void intr_register_int(uint8_t vec_no, int dpl, enum intr_level level, intr_handler_func *handler, const char *name)
Registers internal interrupt VEC_NO to invoke HANDLER, which is named NAME for debugging purposes.
enum intr_level intr_enable(void)
Enables interrupts and returns the previous interrupt status.
const char * intr_name(uint8_t vec)
Returns the name of interrupt VEC.
void intr_dump_frame(const struct intr_frame *f)
Dumps interrupt frame F to the console, for debugging.
@ INTR_ON
Interrupts enabled.
@ INTR_OFF
Interrupts disabled.
int printf(const char *format,...)
Writes formatted output to the console.
int write(int fd, const void *buffer, unsigned size)
#define SEL_KCSEG
Kernel code selector.
uint16_t uint16_t uint16_t uint16_t uint32_t vec_no
Saved DS segment register.
uint32_t error_code
Error code.
const char * thread_name(void)
Returns the name of the running thread.
void thread_exit(void)
Deschedules the current thread and destroys it.