Rename processor_id to acpi_processor_uid and other minor bug fixes
diff --git a/STIVALE2.md b/STIVALE2.md
index fef82551..52d08827 100644
--- a/STIVALE2.md
+++ b/STIVALE2.md
@@ -385,22 +385,25 @@ struct stivale2_struct_tag_smp {
```c
struct stivale2_smp_info {
- uint32_t processor_id; // Processor ID as specified by MADT
- uint32_t lapic_id; // LAPIC ID as specified by MADT
- uint64_t target_stack; // The stack that will be loaded in ESP/RSP
- // once the goto_address field is loaded.
- // This MUST point to a valid stack of at least
- // 256 bytes in size, and 16-byte aligned.
- uint64_t goto_address; // This address is polled by the started APs
- // until the kernel on another CPU performs an
- // atomic write to this field.
- // When that happens, bootloader code will
- // load up ESP/RSP with the stack value as
- // specified in target_stack.
- // It will then proceed to load a pointer to
- // this very structure into either register
- // RDI for 64-bit or on the stack for 32-bit,
- // then, goto_address is called and execution is
- // handed off.
+ uint32_t acpi_processor_uid; // ACPI Processor UID as specified by MADT
+ uint32_t lapic_id; // LAPIC ID as specified by MADT
+ uint64_t target_stack; // The stack that will be loaded in ESP/RSP
+ // once the goto_address field is loaded.
+ // This MUST point to a valid stack of at least
+ // 256 bytes in size, and 16-byte aligned.
+ uint64_t goto_address; // This address is polled by the started APs
+ // until the kernel on another CPU performs an
+ // atomic write to this field.
+ // When that happens, bootloader code will
+ // load up ESP/RSP with the stack value as
+ // specified in target_stack.
+ // It will then proceed to load a pointer to
+ // this very structure into either register
+ // RDI for 64-bit or on the stack for 32-bit,
+ // then, goto_address is called (a bogus return
+ // address is pushed onto the stack) and execution
+ // is handed off.
+ // All general purpose registers are cleared
+ // except ESP/RSP, and RDI in 64-bit mode.
} __attribute__((packed));
```
diff --git a/limine.bin b/limine.bin
index 2848241b..41dc7cc6 100644
Binary files a/limine.bin and b/limine.bin differ
diff --git a/stage2/lib/smp.c b/stage2/lib/smp.c
index f9f23f74..f63316a2 100644
--- a/stage2/lib/smp.c
+++ b/stage2/lib/smp.c
@@ -23,7 +23,7 @@ struct madt_header {
struct madt_lapic {
struct madt_header;
- uint8_t processor_id;
+ uint8_t acpi_processor_uid;
uint8_t lapic_id;
uint32_t flags;
} __attribute__((packed));
@@ -115,6 +115,9 @@ struct smp_information *init_smp(size_t *cpu_count,
struct smp_information *info_struct =
balloc_aligned(sizeof(struct smp_information), 1);
+ info_struct->acpi_processor_uid = lapic->acpi_processor_uid;
+ info_struct->lapic_id = lapic->lapic_id;
+
// Try to start the AP
if (!smp_start_ap(lapic->lapic_id, &gdtr, info_struct,
longmode ? 1 : 0, (uint32_t)pagemap.top_level)) {
diff --git a/stage2/lib/smp.h b/stage2/lib/smp.h
index 0c96b2a3..28a87b09 100644
--- a/stage2/lib/smp.h
+++ b/stage2/lib/smp.h
@@ -7,7 +7,7 @@
#include <mm/vmm64.h>
struct smp_information {
- uint32_t processor_id;
+ uint32_t acpi_processor_uid;
uint32_t lapic_id;
uint64_t stack_addr;
uint64_t goto_address;
