Rename processor_id to acpi_processor_uid and other minor bug fixes

This commit is contained in:
mintsuki 2020-09-18 19:26:17 +02:00
parent 8b37fe6681
commit dbf38b766a
4 changed files with 25 additions and 19 deletions

View File

@ -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));
```

Binary file not shown.

View File

@ -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)) {

View File

@ -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;