Adjust stivale2 SMP spec a little to add an extra argument to the smp_info struct

This commit is contained in:
mintsuki 2020-09-19 00:50:16 +02:00
parent c3c3c5dd6f
commit 4927abcfaf
6 changed files with 13 additions and 4 deletions

View File

@ -378,8 +378,10 @@ This tag reports to the kernel info about the firmware.
struct stivale2_struct_tag_smp {
uint64_t identifier; // Identifier: 0x34d1d96339647025
uint64_t next;
uint64_t cpu_count; // Total number of logical CPUs (including BSP)
struct stivale2_smp_info smp_info[];
uint64_t cpu_count; // Total number of logical CPUs (excluding BSP)
struct stivale2_smp_info smp_info[]; // Array of smp_info structs, one per
// additional logical processor, note
// that the BSP does not have one.
} __attribute__((packed));
```
@ -405,5 +407,10 @@ struct stivale2_smp_info {
// is handed off.
// All general purpose registers are cleared
// except ESP/RSP, and RDI in 64-bit mode.
uint64_t extra_argument; // This field is here for the kernel to use
// for whatever it wants. Writes here should
// be performed before writing to goto_address
// so that the receiving processor can safely
// retrieve the data.
} __attribute__((packed));
```

Binary file not shown.

View File

@ -89,7 +89,7 @@ struct smp_information *init_smp(size_t *cpu_count,
asm volatile ("sgdt %0" :: "m"(gdtr));
struct smp_information *ret = balloc_aligned(0, 1);
*cpu_count = 1;
*cpu_count = 0;
// Parse the MADT entries
for (uint8_t *madt_ptr = (uint8_t *)madt->madt_entries_begin;

View File

@ -11,6 +11,7 @@ struct smp_information {
uint32_t lapic_id;
uint64_t stack_addr;
uint64_t goto_address;
uint64_t extra_argument;
} __attribute__((packed));
struct smp_information *init_smp(size_t *cpu_count,

View File

@ -100,8 +100,8 @@ parking32:
.out:
mov esp, dword [edi + 8]
push 0
push eax
push edi
push eax
xor eax, eax
xor ebx, ebx
xor ecx, ecx

View File

@ -136,6 +136,7 @@ struct stivale2_smp_info {
uint32_t lapic_id;
uint64_t target_stack;
uint64_t goto_address;
uint64_t extra_argument;
} __attribute__((packed));
struct stivale2_struct_tag_smp {