kernel: Ignore all non-bootstrap processors
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
apio 2023-04-22 12:25:43 +02:00
parent 60694f651f
commit 5d56638851
Signed by: apio
GPG Key ID: B8A7D06E42258954
3 changed files with 13 additions and 0 deletions

View File

@ -26,6 +26,8 @@ namespace CPU
void get_stack_trace_at(Registers* regs, void (*callback)(u64, void*), void* arg); void get_stack_trace_at(Registers* regs, void (*callback)(u64, void*), void* arg);
void print_stack_trace_at(Registers* regs); void print_stack_trace_at(Registers* regs);
u16 get_processor_id();
[[noreturn]] void bootstrap_switch_stack(u64 stack, void* function); [[noreturn]] void bootstrap_switch_stack(u64 stack, void* function);
void pause(); void pause();

View File

@ -335,6 +335,14 @@ namespace CPU
{ {
asm volatile("pause"); asm volatile("pause");
} }
u16 get_processor_id()
{
unsigned int unused;
unsigned int ebx = 0;
__get_cpuid(1, &unused, &ebx, &unused, &unused);
return (u16)(ebx >> 24);
}
} }
// called by kernel_yield // called by kernel_yield

View File

@ -17,6 +17,9 @@ void Init::check_magic()
kerrorln("ERROR: Invalid magic value from bootloader"); kerrorln("ERROR: Invalid magic value from bootloader");
CPU::efficient_halt(); CPU::efficient_halt();
} }
// Stop all secondary processors for now
if (CPU::get_processor_id() != bootboot.bspid) { CPU::efficient_halt(); }
} }
void Init::early_init() void Init::early_init()