mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
[kernel] Save all cpu_data pointers in global array
For the sake of introspection and debugging, I created a new g_cpu_data pointer, which points to an array of cpu_data pointers.
This commit is contained in:
@@ -22,6 +22,7 @@ panic_data g_panic_data;
|
||||
panic_data *g_panic_data_p = &g_panic_data;
|
||||
|
||||
cpu_data g_bsp_cpu_data;
|
||||
cpu_data **g_cpu_data = nullptr;
|
||||
|
||||
|
||||
// Validate the required CPU features are present. Really, the bootloader already
|
||||
@@ -115,6 +116,7 @@ cpu_create(uint16_t id, uint16_t index)
|
||||
GDT *gdt = new GDT {tss};
|
||||
cpu_data *cpu = new cpu_data;
|
||||
memset(cpu, 0, sizeof(cpu_data));
|
||||
g_cpu_data[index] = cpu;
|
||||
|
||||
cpu->self = cpu;
|
||||
cpu->id = id;
|
||||
|
||||
@@ -22,6 +22,8 @@ extern size_t ap_startup_code_size;
|
||||
extern obj::process &g_kernel_process;
|
||||
extern obj::vm_area_guarded &g_kernel_stacks;
|
||||
|
||||
extern cpu_data **g_cpu_data;
|
||||
|
||||
namespace smp {
|
||||
|
||||
volatile size_t ap_startup_count;
|
||||
@@ -35,13 +37,15 @@ start(cpu_data &bsp, void *kpml4)
|
||||
using mem::kernel_stack_pages;
|
||||
using obj::vm_flags;
|
||||
|
||||
|
||||
ap_startup_count = 1; // Count the BSP
|
||||
|
||||
clock &clk = clock::get();
|
||||
|
||||
const auto &ids = device_manager::get().get_apic_ids();
|
||||
|
||||
g_cpu_data = new cpu_data* [ids.count()];
|
||||
g_cpu_data[bsp.index] = &bsp;
|
||||
|
||||
log::info(logs::boot, "Starting %d other CPUs", ids.count() - 1);
|
||||
|
||||
// Since we're using address space outside kernel space, make sure
|
||||
|
||||
Reference in New Issue
Block a user