From 703d68a4c0860ec380969cbf0c3685b237ef44f0 Mon Sep 17 00:00:00 2001 From: AlmuHS Date: Sat, 7 Sep 2019 13:25:24 +0200 Subject: fix: stack out of index --- i386/i386/mp_desc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/i386/i386/mp_desc.c b/i386/i386/mp_desc.c index 15beb455..64eca2b6 100644 --- a/i386/i386/mp_desc.c +++ b/i386/i386/mp_desc.c @@ -236,7 +236,6 @@ static void send_ipi(unsigned icr_h, unsigned icr_l) } -/*TODO: Add delay between IPI*/ void startup_cpu(uint32_t apic_id) { unsigned icr_h = 0; @@ -585,15 +584,15 @@ start_other_cpus(void) stack_start = phystokv(stack_start); - for (cpu = 0; cpu < ncpu; cpu++) + for (cpu = 1; cpu < ncpu; cpu++) { if (cpu != cpu_number()) { //Initialize cpu stack - cpu_stack[cpu] = stack_start; - _cpu_stack_top[cpu] = stack_start + STACK_SIZE; + cpu_stack[cpu-1] = stack_start; + _cpu_stack_top[cpu-1] = stack_start + STACK_SIZE; - stack_ptr = cpu_stack[cpu]; + stack_ptr = cpu_stack[cpu-1]; machine_slot[cpu].running = FALSE; cpu_start(cpu); -- cgit v1.2.3