![]() |
Max OS 0.3
|
Represents a CPU core in the system. More...
#include <cpu.h>
Public Member Functions | |
| Core (hardwarecommunication::madt_processor_apic_t *madt_item) | |
| Constructs a new Core object from the MADT entry. | |
| void | wake_up (CPU *cpu) |
| Wakes up the core by sending the appropriate IPIs. (see core_loader.s for startup code) | |
| void | init () |
| Initialises the core by setting up the GDT, IDT, TSS, SSE and APIC. | |
Public Attributes | |
| bool | xsave_enabled = false |
| Whether XSAVE is enabled. | |
| bool | avx_enabled = false |
| Whether AVX is enabled. | |
| uint8_t | id |
| The ID of this core. | |
| tss_t | tss = { } |
| The Task State Segment for this core. | |
| bool | active = false |
| Whether this core is active. | |
| hardwarecommunication::LocalAPIC * | local_apic = nullptr |
| The local APIC for this core. | |
| GlobalDescriptorTable * | gdt = nullptr |
| The GDT for this core. | |
| processes::Scheduler * | scheduler = nullptr |
| The scheduler for this core. | |
Protected Member Functions | |
| void | init_tss () |
| Initialises the task state segment for this core. | |
| void | init_sse () |
| Initialises the SSE instructions. | |
Protected Attributes | |
| hardwarecommunication::madt_processor_apic_t * | m_madt |
| The MADT entry for this core. | |
| bool | m_enabled = false |
| Whether the core is enabled. | |
| bool | m_can_enable = false |
| Whether the core can be enabled. | |
| bool | m_bsp = false |
| Whether this core is the bootstrap processor. | |
| uint8_t | m_apic_id |
| The ID of the apic for this core. | |
| uint64_t | m_stack = 0 |
| The stack pointer for this core. | |
Friends | |
| class | CPU |
|
explicit |
Constructs a new Core object from the MADT entry.
| madt_item | The MADT entry for this core |
Definition at line 37 of file cpu.cpp.
References MaxOS::Logger::DEBUG(), m_apic_id, m_can_enable, m_enabled, and m_madt.
| void Core::init | ( | ) |
Initialises the core by setting up the GDT, IDT, TSS, SSE and APIC.
Definition at line 228 of file cpu.cpp.
References active, MaxOS::drivers::clock::Clock::active_clock(), gdt, init_sse(), init_tss(), MaxOS::hardwarecommunication::InterruptManager::load_current(), and local_apic.
|
protected |
Initialises the SSE instructions.
Definition at line 167 of file cpu.cpp.
References ASSERT, avx_enabled, MaxOS::system::CPU::check_cpu_feature(), MaxOS::Logger::DEBUG(), and xsave_enabled.
Referenced by init().
|
protected |
Initialises the task state segment for this core.
Definition at line 110 of file cpu.cpp.
References MaxOS::system::BOOT_STACK_SIZE, MaxOS::Logger::DEBUG(), gdt, m_stack, and tss.
Referenced by init().
Wakes up the core by sending the appropriate IPIs. (see core_loader.s for startup code)
| cpu |
Definition at line 59 of file cpu.cpp.
References active, MaxOS::drivers::clock::Clock::active_clock(), MaxOS::system::BOOT_STACK_SIZE, core_boot_info, MaxOS::Logger::DEBUG(), id, MaxOS::memory::MemoryManager::kmalloc(), m_apic_id, m_bsp, m_stack, and MaxOS::Logger::WARNING().
| bool MaxOS::system::Core::active = false |
| bool MaxOS::system::Core::avx_enabled = false |
| GlobalDescriptorTable* MaxOS::system::Core::gdt = nullptr |
| uint8_t MaxOS::system::Core::id |
The ID of this core.
Definition at line 240 of file cpu.h.
Referenced by MaxOS::processes::GlobalScheduler::print_running_header(), and wake_up().
| hardwarecommunication::LocalAPIC* MaxOS::system::Core::local_apic = nullptr |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
The stack pointer for this core.
Definition at line 225 of file cpu.h.
Referenced by init_tss(), and wake_up().
| processes::Scheduler* MaxOS::system::Core::scheduler = nullptr |
The scheduler for this core.
Definition at line 246 of file cpu.h.
Referenced by MaxOS::processes::GlobalScheduler::core_scheduler().
| tss_t MaxOS::system::Core::tss = { } |
The Task State Segment for this core.
Definition at line 241 of file cpu.h.
Referenced by init_tss().
| bool MaxOS::system::Core::xsave_enabled = false |