smp: Remove dead 32-bit trampoline code

This commit is contained in:
mintsuki 2023-09-23 13:27:58 -05:00
parent 3fde8f0158
commit 87a88bf565
4 changed files with 6 additions and 40 deletions

View File

@ -951,7 +951,7 @@ FEAT_START
#if defined (__x86_64__) || defined (__i386__) #if defined (__x86_64__) || defined (__i386__)
uint32_t bsp_lapic_id; uint32_t bsp_lapic_id;
smp_info = init_smp(&cpu_count, &bsp_lapic_id, smp_info = init_smp(&cpu_count, &bsp_lapic_id,
true, paging_mode, paging_mode,
pagemap, smp_request->flags & LIMINE_SMP_X2APIC, nx_available, pagemap, smp_request->flags & LIMINE_SMP_X2APIC, nx_available,
direct_map_offset, true); direct_map_offset, true);
#elif defined (__aarch64__) #elif defined (__aarch64__)

View File

@ -33,7 +33,7 @@ struct trampoline_passed_info {
static bool smp_start_ap(uint32_t lapic_id, struct gdtr *gdtr, static bool smp_start_ap(uint32_t lapic_id, struct gdtr *gdtr,
struct limine_smp_info *info_struct, struct limine_smp_info *info_struct,
bool longmode, int paging_mode, uint32_t pagemap, int paging_mode, uint32_t pagemap,
bool x2apic, bool nx, uint64_t hhdm, bool wp) { bool x2apic, bool nx, uint64_t hhdm, bool wp) {
// Prepare the trampoline // Prepare the trampoline
static void *trampoline = NULL; static void *trampoline = NULL;
@ -53,10 +53,9 @@ static bool smp_start_ap(uint32_t lapic_id, struct gdtr *gdtr,
passed_info->smp_tpl_booted_flag = 0; passed_info->smp_tpl_booted_flag = 0;
passed_info->smp_tpl_pagemap = pagemap; passed_info->smp_tpl_pagemap = pagemap;
passed_info->smp_tpl_target_mode = ((uint32_t)x2apic << 2) passed_info->smp_tpl_target_mode = ((uint32_t)x2apic << 2)
| ((uint32_t)paging_mode << 1) | ((uint32_t)(paging_mode == PAGING_MODE_X86_64_5LVL) << 1)
| ((uint32_t)nx << 3) | ((uint32_t)nx << 3)
| ((uint32_t)wp << 4) | ((uint32_t)wp << 4);
| ((uint32_t)longmode << 0);
passed_info->smp_tpl_gdt = *gdtr; passed_info->smp_tpl_gdt = *gdtr;
passed_info->smp_tpl_hhdm = hhdm; passed_info->smp_tpl_hhdm = hhdm;
@ -92,7 +91,6 @@ static bool smp_start_ap(uint32_t lapic_id, struct gdtr *gdtr,
struct limine_smp_info *init_smp(size_t *cpu_count, struct limine_smp_info *init_smp(size_t *cpu_count,
uint32_t *_bsp_lapic_id, uint32_t *_bsp_lapic_id,
bool longmode,
int paging_mode, int paging_mode,
pagemap_t pagemap, pagemap_t pagemap,
bool x2apic, bool x2apic,
@ -200,7 +198,7 @@ struct limine_smp_info *init_smp(size_t *cpu_count,
// Try to start the AP // Try to start the AP
if (!smp_start_ap(lapic->lapic_id, &gdtr, info_struct, if (!smp_start_ap(lapic->lapic_id, &gdtr, info_struct,
longmode, paging_mode, (uintptr_t)pagemap.top_level, paging_mode, (uintptr_t)pagemap.top_level,
x2apic, nx, hhdm, wp)) { x2apic, nx, hhdm, wp)) {
print("smp: FAILED to bring-up AP\n"); print("smp: FAILED to bring-up AP\n");
continue; continue;
@ -237,7 +235,7 @@ struct limine_smp_info *init_smp(size_t *cpu_count,
// Try to start the AP // Try to start the AP
if (!smp_start_ap(x2lapic->x2apic_id, &gdtr, info_struct, if (!smp_start_ap(x2lapic->x2apic_id, &gdtr, info_struct,
longmode, paging_mode, (uintptr_t)pagemap.top_level, paging_mode, (uintptr_t)pagemap.top_level,
true, nx, hhdm, wp)) { true, nx, hhdm, wp)) {
print("smp: FAILED to bring-up AP\n"); print("smp: FAILED to bring-up AP\n");
continue; continue;

View File

@ -12,7 +12,6 @@
struct limine_smp_info *init_smp(size_t *cpu_count, struct limine_smp_info *init_smp(size_t *cpu_count,
uint32_t *_bsp_lapic_id, uint32_t *_bsp_lapic_id,
bool longmode,
int paging_mode, int paging_mode,
pagemap_t pagemap, pagemap_t pagemap,
bool x2apic, bool x2apic,

View File

@ -56,9 +56,6 @@ smp_trampoline_start:
.nox2apic: .nox2apic:
lea esp, [ebx + (temp_stack.top - smp_trampoline_start)] lea esp, [ebx + (temp_stack.top - smp_trampoline_start)]
test dword [ebx + (passed_info.target_mode - smp_trampoline_start)], (1 << 0)
jz parking32
mov eax, cr4 mov eax, cr4
bts eax, 5 bts eax, 5
mov cr4, eax mov cr4, eax
@ -123,34 +120,6 @@ smp_trampoline_start:
jmp rax jmp rax
bits 32
parking32:
mov edi, dword [ebx + (passed_info.smp_info_struct - smp_trampoline_start)]
mov eax, 1
lock xchg dword [ebx + (passed_info.booted_flag - smp_trampoline_start)], eax
xor eax, eax
.loop:
lock xadd dword [edi + 16], eax
test eax, eax
jnz .out
pause
jmp .loop
.out:
mov esp, dword [edi + 8]
push 0
push edi
push eax
xor eax, eax
xor ebx, ebx
xor ecx, ecx
xor edx, edx
xor esi, esi
xor edi, edi
xor ebp, ebp
ret
bits 64 bits 64
parking64: parking64:
mov ebx, ebx mov ebx, ebx