PatchworkOS  966e257
A non-POSIX operating system.
Loading...
Searching...
No Matches
cpu.c File Reference
#include <errno.h>
#include <kernel/cpu/cpu.h>
#include <kernel/cpu/gdt.h>
#include <kernel/cpu/idt.h>
#include <kernel/cpu/interrupt.h>
#include <kernel/cpu/ipi.h>
#include <kernel/cpu/simd.h>
#include <kernel/cpu/syscall.h>
#include <kernel/cpu/tss.h>
#include <kernel/drivers/perf.h>
#include <kernel/log/log.h>
#include <kernel/log/panic.h>
#include <kernel/mem/vmm.h>
#include <kernel/sched/sched.h>
#include <kernel/sync/lock.h>
#include <kernel/sync/rwlock.h>
#include <kernel/utils/map.h>
#include <stdatomic.h>
#include <stdint.h>
#include <sys/list.h>
Include dependency graph for cpu.c:

Go to the source code of this file.

Functions

void cpu_init_early (cpu_t *cpu)
 Only initialize the parts of the CPU structure needed for early boot.
 
void cpu_init (cpu_t *cpu)
 Initializes the CPU represented by the cpu_t structure.
 
uint64_t cpu_handler_register (cpu_func_t func)
 Registers a CPU event handler for all CPUs.
 
void cpu_handler_unregister (cpu_func_t func)
 Unregisters a previously registered CPU event handler.
 
void cpu_handlers_check (cpu_t *cpu)
 Checks if any handlers have been registered since the last check, and invokes them if so.
 
void cpu_stacks_overflow_check (cpu_t *cpu)
 Checks for CPU stack overflows.
 
static void cpu_halt_ipi_handler (ipi_func_data_t *data)
 
uint64_t cpu_halt_others (void)
 Halts all other CPUs.
 
uintptr_t cpu_interrupt_stack_top (cpu_t *cpu)
 Gets the top of the interrupt stack for a CPU.
 

Variables

cpu_t_cpus [CPU_MAX] = {0}
 Array of pointers to cpu_t structures for each CPU, indexed by CPU ID.
 
uint16_t _cpuAmount = 0
 The number of CPUs currently identified.
 
static cpu_handler_t eventHandlers [CPU_MAX_EVENT_HANDLERS] = {0}
 
static uint64_t eventHandlerCount = 0
 
static lock_t eventHandlerLock = LOCK_CREATE()
 

Function Documentation

◆ cpu_halt_ipi_handler()

static void cpu_halt_ipi_handler ( ipi_func_data_t data)
static

Definition at line 213 of file cpu.c.

Here is the caller graph for this function:

Variable Documentation

◆ eventHandlers

cpu_handler_t eventHandlers[CPU_MAX_EVENT_HANDLERS] = {0}
static

Definition at line 26 of file cpu.c.

◆ eventHandlerCount

uint64_t eventHandlerCount = 0
static

Definition at line 27 of file cpu.c.

◆ eventHandlerLock

lock_t eventHandlerLock = LOCK_CREATE()
static

Definition at line 28 of file cpu.c.