|
PatchworkOS
|
CPU. More...
Modules | |
| GDT | |
| Global Descriptor Table. | |
| IDT | |
| Interrupt Descriptor Table. | |
| Interrupts | |
| Interrupt Handling. | |
| IRQ | |
| Interrupt Request handling. | |
| Port I/O | |
| Port I/O operations. | |
| SIMD | |
| SIMD context management. | |
| SMP | |
| Symmetric multi processing. | |
| Stack Pointer | |
| Helpers for managing stacks. | |
| Syscalls | |
| System Calls. | |
| Trampoline | |
| Trampoline for CPU initialization. | |
| TSS | |
| Task State Segment. | |
Data Structures | |
| struct | cpu_t |
| CPU structure. More... | |
Macros | |
| #define | CPU_STACK_CANARY 0x1234567890ABCDEFULL |
| CPU stack canary value. | |
| #define | CPU_MAX UINT8_MAX |
| Maximum number of CPUs supported. | |
| #define | CPU_ID_BOOTSTRAP 0 |
| ID of the bootstrap CPU. | |
| #define | CPU_ID_INVALID UINT16_MAX |
| Invalid CPU ID. | |
Typedefs | |
| typedef uint16_t | cpuid_t |
| Type used to identify a CPU. | |
Functions | |
| uint64_t | cpu_init (cpu_t *cpu, cpuid_t id) |
| Initializes a CPU structure as part of the boot process. | |
| void | cpu_stacks_overflow_check (cpu_t *cpu) |
| Checks for CPU stack overflows. | |
CPU.
| #define CPU_ID_INVALID UINT16_MAX |
| #define CPU_STACK_CANARY 0x1234567890ABCDEFULL |
Initializes a CPU structure as part of the boot process.
Must be called on the CPU that will be represented by the cpu structure.
| cpu | The CPU structure to initialize. |
| id | The ID of the CPU. |
0. On failure, ERR and errno is set. Definition at line 16 of file cpu.c.
References stack_pointer_t::bottom, CONFIG_INTERRUPT_STACK_PAGES, CPU_STACK_CANARY, cpu_t::doubleFaultStack, ERR, cpu_t::exceptionStack, gdt_cpu_load(), gdt_cpu_tss_load(), cpu_t::id, id, idt_cpu_load(), cpu_t::interrupt, interrupt_ctx_init(), cpu_t::interruptStack, lapic_cpu_init(), lapic_self_id(), cpu_t::lapicId, LOG_ERR, MSR_CPU_ID, msr_write(), cpu_t::sched, sched_cpu_ctx_init(), simd_cpu_init(), stack_pointer_deinit_buffer(), stack_pointer_init_buffer(), cpu_t::stat, statistics_cpu_ctx_init(), syscalls_cpu_init(), cpu_t::timer, timer_ctx_init(), cpu_t::tss, tss_init(), TSS_IST_DOUBLE_FAULT, TSS_IST_EXCEPTION, TSS_IST_INTERRUPT, tss_ist_load(), cpu_t::vmm, vmm_cpu_ctx_init(), cpu_t::wait, and wait_cpu_ctx_init().
Referenced by smp_bootstrap_init(), and trampoline_c_entry().
| void cpu_stacks_overflow_check | ( | cpu_t * | cpu | ) |
Checks for CPU stack overflows.
Checks the canary values at the bottom of each CPU stack and if its been modified panics.
| cpu | The CPU to check. |
Definition at line 69 of file cpu.c.
References stack_pointer_t::bottom, CPU_STACK_CANARY, cpu_t::doubleFaultStack, cpu_t::exceptionStack, cpu_t::id, cpu_t::interruptStack, NULL, and panic().
Referenced by interrupt_handler().