miniOS
x86_64 hobby kernel with SMP, VFS, and POSIX process model
Loading...
Searching...
No Matches
cpu_t Struct Reference

#include <smp.h>

Collaboration diagram for cpu_t:

Public Attributes

struct cpu_tself
uint32_t cpu_id
uint32_t lapic_id
struct threadidle_thread
uint8_tkstack_base
struct threadrun_queue_head
struct threadrun_queue_tail
uint32_t queue_depth
struct threadcurrent_thread
uint64_t kstack_top
uint64_t user_rsp_scratch

Detailed Description

cpu_t - Per-CPU state block; GS.base on each CPU points to this struct.

The first field MUST be a self-pointer at offset 0 (gs:0) so cpu_local() works with a single mov %gs:0, %0 instruction regardless of cpu count. Fields at fixed GS offsets are used by assembly: current_thread at gs:56, kstack_top at gs:64, user_rsp_scratch at gs:72.

Member Data Documentation

◆ cpu_id

uint32_t cpu_t::cpu_id

◆ current_thread

struct thread* cpu_t::current_thread

◆ idle_thread

struct thread* cpu_t::idle_thread

◆ kstack_base

uint8_t* cpu_t::kstack_base

◆ kstack_top

uint64_t cpu_t::kstack_top

◆ lapic_id

uint32_t cpu_t::lapic_id

◆ queue_depth

uint32_t cpu_t::queue_depth

◆ run_queue_head

struct thread* cpu_t::run_queue_head

◆ run_queue_tail

struct thread* cpu_t::run_queue_tail

◆ self

struct cpu_t* cpu_t::self

◆ user_rsp_scratch

uint64_t cpu_t::user_rsp_scratch

The documentation for this struct was generated from the following file:
  • include/miniOS/arch/x86_64/smp.h