summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlmuHS <almuhs@github.com>2019-09-07 13:25:24 +0200
committerAlmuHS <almuhs@github.com>2019-09-07 13:25:24 +0200
commit703d68a4c0860ec380969cbf0c3685b237ef44f0 (patch)
tree1655219c734b0a56e61f0ecd0abcce9c69d64401
parentbfd72848153b28b69986f2c38eb37c53e99a0f12 (diff)
fix: stack out of index
-rw-r--r--i386/i386/mp_desc.c9
1 files 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);