49 asm volatile(
"sti" :::
"memory");
75 LOG_WARN(
"unhandled user space exception in process pid=%d tid=%d vector=%lld error=0x%llx rip=0x%llx "
76 "cr2=0x%llx errno='%s'\n",
88 panic(frame,
"unhandled kernel exception");
104 panic(frame,
"Interrupt handler called while already in an interrupt");
156 panic(frame,
"Unknown vector");
#define assert(expression)
void interrupt_ctx_init(interrupt_ctx_t *ctx)
Initializes the CLI context.
void interrupt_handler(interrupt_frame_t *frame)
Handles CPU interrupts.
#define INTERRUPT_FRAME_IN_USER_SPACE(frame)
Checks if a interrupt frame is from user space.
void interrupt_disable(void)
Disable interrupts and increment the disableDepth.
void interrupt_enable(void)
Decrement the CLI depth and enable interrupts if depth reaches zero and interrupts were previously en...
@ INTERRUPT_TIMER
The timer subsystem interrupt.
@ INTERRUPT_NOTE
Nofify that a note is available.
@ INTERRUPT_DIE
Kills and frees the current thread.
@ INTERRUPT_TLB_SHOOTDOWN
TLB shootdown interrupt.
@ EXTERNAL_INTERRUPT_BASE
@ INTERRUPT_HALT
Halt the CPU.
void irq_dispatch(interrupt_frame_t *frame)
Dispatch an IRQ.
static cpu_t * smp_self_unsafe(void)
Returns a pointer to the cpu_t structure of the current CPU.
void cpu_stacks_overflow_check(cpu_t *cpu)
Checks for CPU stack overflows.
void lapic_eoi(void)
Send an End Of Interrupt (EOI) signal to the local apic.
void statistics_interrupt_begin(interrupt_frame_t *frame, cpu_t *self)
Called at the beginning of an interrupt.
void statistics_interrupt_end(interrupt_frame_t *frame, cpu_t *self)
Called at the end of an interrupt.
void note_interrupt_handler(interrupt_frame_t *frame, cpu_t *self)
Note interrupt handler.
void panic_stack_trace(const interrupt_frame_t *frame)
Print a stack trace from a interrupt frame.
NORETURN void panic(const interrupt_frame_t *frame, const char *format,...)
Panic the kernel, printing a message and halting.
#define LOG_WARN(format,...)
void vmm_shootdown_handler(interrupt_frame_t *frame, cpu_t *self)
TLB shootdown interrupt handler.
void process_kill(process_t *process, uint64_t status)
Kills a process.
uint64_t thread_handle_page_fault(const interrupt_frame_t *frame)
Handles a page fault that occurred in the currently running thread.
thread_t * sched_thread_unsafe(void)
Retrieves the currently running thread without disabling interrupts.
void sched_invoke(interrupt_frame_t *frame, cpu_t *self, schedule_flags_t flags)
The main scheduling function.
@ SCHED_DIE
Kill and free the currently running thread.
void timer_interrupt_handler(interrupt_frame_t *frame, cpu_t *self)
Handle timer interrupt.
#define EFAULT
Bad address.
#define ERR
Integer error value.
static void exception_handler(interrupt_frame_t *frame)
#define RFLAGS_INTERRUPT_ENABLE
static uint64_t cr2_read()
static uint64_t rflags_read()
_PUBLIC char * strerror(int errnum)
interrupt_ctx_t interrupt
Per-CPU Interrupt Context.
Thread of execution structure.
process_t * process
The parent process that the thread executes within.
tid_t id
The thread id, unique within a process_t.