|
PatchworkOS
|
Interrupt Handling. More...
Data Structures | |
| struct | interrupt_frame_t |
| Trap Frame Structure. More... | |
| struct | interrupt_ctx_t |
| Per-CPU Interrupt Context. More... | |
Macros | |
| #define | INTERRUPT_FRAME_IN_USER_SPACE(frame) ((frame)->ss == (GDT_SS_RING3) && (frame)->cs == (GDT_CS_RING3)) |
| Checks if a interrupt frame is from user space. | |
Functions | |
| void | interrupt_ctx_init (interrupt_ctx_t *ctx) |
| Initializes the CLI context. | |
| 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 enabled. | |
| void | interrupt_handler (interrupt_frame_t *frame) |
| Handles CPU interrupts. | |
Variables | |
| void * | vectorTable [INTERRUPT_AMOUNT] |
| Pointers to functions to handle each vector. | |
Interrupt Handling.
This module provides structures and functions for handling CPU interrupts.
| #define INTERRUPT_FRAME_IN_USER_SPACE | ( | frame | ) | ((frame)->ss == (GDT_SS_RING3) && (frame)->cs == (GDT_CS_RING3)) |
Checks if a interrupt frame is from user space.
| frame | The interrupt frame to check. |
Definition at line 76 of file interrupt.h.
| enum interrupt_t |
CPU vector identifiers.
External interrupts (IRQ's) are defined in irq_t.
Definition at line 96 of file interrupt.h.
| enum page_fault_errors_t |
Page Fault Error Codes.
Will be stored in the error code of the interrupt frame on a page fault.
| Enumerator | |
|---|---|
| PAGE_FAULT_PRESENT | |
| PAGE_FAULT_WRITE | |
| PAGE_FAULT_USER | |
| PAGE_FAULT_RESERVED | |
| PAGE_FAULT_INSTRUCTION | |
| PAGE_FAULT_PROTECTION_KEY | |
| PAGE_FAULT_SHADOW_STACK | |
| PAGE_FAULT_SOFTWARE_GUARD_EXT | |
Definition at line 22 of file interrupt.h.
| void interrupt_ctx_init | ( | interrupt_ctx_t * | ctx | ) |
Initializes the CLI context.
| cli | The CLI context to initialize. |
Definition at line 19 of file interrupt.c.
References interrupt_ctx_t::disableDepth, interrupt_ctx_t::inInterrupt, and interrupt_ctx_t::oldRflags.
Referenced by cpu_init().
| void interrupt_disable | ( | void | ) |
Disable interrupts and increment the disableDepth.
Must have a matching interrupt_enable() call to re-enable interrupts when depth reaches zero.
Definition at line 26 of file interrupt.c.
References interrupt_ctx_t::disableDepth, cpu_t::interrupt, interrupt_ctx_t::oldRflags, rflags_read(), and smp_self_unsafe().
Referenced by apic_timer_ticks_per_ns(), lock_acquire(), rwlock_read_acquire(), rwlock_write_acquire(), smp_self(), and timer_acquire().
| void interrupt_enable | ( | void | ) |
Decrement the CLI depth and enable interrupts if depth reaches zero and interrupts were previously enabled.
Definition at line 38 of file interrupt.c.
References assert, interrupt_ctx_t::disableDepth, cpu_t::interrupt, interrupt_ctx_t::oldRflags, RFLAGS_INTERRUPT_ENABLE, rflags_read(), and smp_self_unsafe().
Referenced by apic_timer_ticks_per_ns(), lock_acquire(), lock_release(), rwlock_read_release(), rwlock_write_release(), smp_put(), and timer_release().
| void interrupt_handler | ( | interrupt_frame_t * | frame | ) |
Handles CPU interrupts.
This will be called from vector_common in vectors.s.
| frame | The interrupt frame containing the CPU state at the time of the exception. |
Definition at line 92 of file interrupt.c.
References assert, cpu_stacks_overflow_check(), EXCEPTION_AMOUNT, exception_handler(), EXTERNAL_INTERRUPT_BASE, interrupt_ctx_t::inInterrupt, cpu_t::interrupt, INTERRUPT_DIE, INTERRUPT_FRAME_IN_USER_SPACE, INTERRUPT_HALT, INTERRUPT_NOTE, INTERRUPT_TIMER, INTERRUPT_TLB_SHOOTDOWN, IRQ_AMOUNT, irq_dispatch(), lapic_eoi(), note_interrupt_handler(), panic(), interrupt_frame_t::rflags, RFLAGS_INTERRUPT_ENABLE, SCHED_DIE, sched_invoke(), smp_self_unsafe(), statistics_interrupt_begin(), statistics_interrupt_end(), timer_interrupt_handler(), interrupt_frame_t::vector, and vmm_shootdown_handler().
|
extern |
Pointers to functions to handle each vector.
Referenced by idt_init().