StuBS
core.cc File Reference
#include "machine/core.h"
#include "machine/apic.h"
#include "machine/lapic.h"
Include dependency graph for core.cc:

Namespaces

namespace  Core
 Implements an abstraction for CPU internals.
 

Functions

void Core::init ()
 Initialize this CPU core.
 
void Core::exit ()
 Deinitialize this CPU core.
 
unsigned Core::getID ()
 Get the ID of the current CPU core using LAPIC::getID() with an internal lookup table.
 
unsigned Core::count ()
 Get number of available CPU cores.
 
unsigned Core::countOnline ()
 Get number of successfully started (and currently active) CPU cores.
 
bool Core::isOnline (uint8_t core_id)
 Check if CPU core is currently active.
 

Constants

const unsigned long CPU_CORE_STACK_SIZE = 4096
 Initial size of CPU core stacks.
 
static unsigned char cpu_core_stack [Core::MAX *CPU_CORE_STACK_SIZE]
 Reserved memory for CPU core stacks.
 
unsigned char * cpu_core_stack_pointer = cpu_core_stack
 Pointer to stack memory.
 
static unsigned Core::cores = 0
 Number of available CPU cores.
 
static unsigned Core::core_id [255]
 Lookup table for CPU core IDs with LAPIC ID as index.
 
static unsigned Core::online_cores = 0
 Number of currently online CPU cores.
 
static bool Core::online_core [Core::MAX]
 Lookup table for online CPU cores with CPU core ID as index.
 

Variable Documentation

◆ CPU_CORE_STACK_SIZE

const unsigned long CPU_CORE_STACK_SIZE = 4096

Initial size of CPU core stacks.

Used during startup in boot/startup.asm

◆ cpu_core_stack

unsigned char cpu_core_stack[Core::MAX *CPU_CORE_STACK_SIZE]
static

Reserved memory for CPU core stacks.

◆ cpu_core_stack_pointer

unsigned char* cpu_core_stack_pointer = cpu_core_stack

Pointer to stack memory.

Incremented during startup of each core (bootstrap and application processors) in boot/startup.asm