|
PatchworkOS
19e446b
A non-POSIX operating system.
|
CPU. More...
CPU.
Modules | |
| CLI | |
| Clear Interrupt Flag (CLI) Handling. | |
| GDT | |
| Global Descriptor Table. | |
| IDT | |
| Interrupt Descriptor Table. | |
| Interrupts | |
| Interrupt Handling. | |
| IPI | |
| Inter-Processor Interrupts (IPIs) | |
| IRQ | |
| Interrupt Requests (IRQs) | |
| Per-CPU Data | |
| Per CPU data. | |
| Port I/O | |
| I/O port operations and reservations. | |
| SIMD | |
| SIMD context management. | |
| Stack Pointer | |
| Helpers for managing stacks. | |
| Syscall | |
| System Call Interface. | |
| TSS | |
| Task State Segment. | |
Data Structures | |
| struct | cpu_t |
| CPU structure. More... | |
Macros | |
| #define | CPU_OFFSET_SELF 0x0 |
The offset of the self member in the cpu_t structure. | |
| #define | CPU_OFFSET_SYSCALL_RSP 0x10 |
The offset of the syscall_ctx_t pointer in the cpu_t structure. | |
| #define | CPU_OFFSET_USER_RSP 0x18 |
The offset of the userRsp member in the cpu_t structure. | |
| #define | CPU_OFFSET_ID 0x8 |
The offset of the id member in the cpu_t structure. | |
| #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. | |
| #define | CPU_STACK_CANARY 0x1234567890ABCDEFULL |
| CPU stack canary value. | |
| #define | CPU_FOR_EACH(cpu) |
| Macro to iterate over all CPUs. | |
Typedefs | |
| typedef uint16_t | cpu_id_t |
| Type used to identify a CPU. | |
Functions | |
| void | cpu_init (cpu_t *cpu) |
| Initializes a CPU structure. | |
| void | cpu_stacks_overflow_check (void) |
| Checks the current CPU for stack overflows. | |
| uint64_t | cpu_halt_others (void) |
| Halts all other CPUs. | |
| uintptr_t | cpu_interrupt_stack_top (void) |
| Gets the top of the interrupt stack for the current CPU. | |
| static uint16_t | cpu_amount (void) |
| Gets the number of identified CPUs. | |
| static cpu_t * | cpu_get_by_id (cpu_id_t id) |
| Gets a CPU structure by its ID. | |
| static cpu_t * | cpu_get_next (cpu_t *current) |
| Gets the next CPU in the CPU array. | |
Variables | |
| cpu_t * | _cpus [CPU_MAX] |
| Array of pointers to cpu_t structures for each CPU, indexed by CPU ID. | |
| uint16_t | _cpuAmount |
| The number of CPUs currently identified. | |
| #define CPU_OFFSET_SELF 0x0 |
| #define CPU_OFFSET_SYSCALL_RSP 0x10 |
The offset of the syscall_ctx_t pointer in the cpu_t structure.
| #define CPU_OFFSET_USER_RSP 0x18 |
| #define CPU_OFFSET_ID 0x8 |
| #define CPU_ID_INVALID UINT16_MAX |
| #define CPU_STACK_CANARY 0x1234567890ABCDEFULL |
| #define CPU_FOR_EACH | ( | cpu | ) |
Macro to iterate over all CPUs.
The main reason for using this macro is to avoid changes the the internal implementation of how CPUs are stored affecting other parts of the code.
| cpu | Loop variable, a pointer to the current cpu_t. |
| void cpu_init | ( | cpu_t * | cpu | ) |
Initializes a CPU structure.
Will note initialize percpu data, use percpu_update() after calling this function.
| cpu | The CPU structure to initialize. |
Definition at line 27 of file cpu.c.
| void cpu_stacks_overflow_check | ( | void | ) |
| uint64_t cpu_halt_others | ( | void | ) |
| uintptr_t cpu_interrupt_stack_top | ( | void | ) |
|
inlinestatic |
|
extern |
The number of CPUs currently identified.
Use cpu_amount() over this variable.