From 306a9ae49fc8aa882fc6b5ce7c37d097d8603f34 Mon Sep 17 00:00:00 2001 From: Travis Geiselbrecht Date: Sun, 18 Feb 2007 04:11:43 +0000 Subject: [PATCH] should be a fix for #1018. The new cpu detect code was running on each cpu as they come up, storing away cpuid info into the current cpu structure. Trouble was the code was running before the current thread pointer was set on each cpu, so it was always looking up cpu 0's structure and saving there, leaving the other ones uninitialized. Surprisingly this works fine on my machine, but obviously fails on others (cpuid info would have been zeroed probably). Solution is to change the order that things are brought up on each cpu to set the current thread pointer first. I don't really like that solution but it'll work for now. Added a comment to the effect. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20154 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/system/kernel/main.c b/src/system/kernel/main.c index 756c516316..c08b18f347 100644 --- a/src/system/kernel/main.c +++ b/src/system/kernel/main.c @@ -166,9 +166,14 @@ _start(kernel_args *bootKernelArgs, int currentCPU) resume_thread(thread); } else { // this is run for each non boot processor after they've been set loose + + // the order here is pretty important, and kind of arch specific, so it's sort of a hack at the moment. + // thread_* will set the current thread pointer, which lets low level code know what cpu it's on + // cpu_* will detect the current cpu and do any pending low level setup + // smp_* will set up the low level smp routines + thread_per_cpu_init(currentCPU); cpu_init_percpu(&sKernelArgs, currentCPU); smp_per_cpu_init(&sKernelArgs, currentCPU); - thread_per_cpu_init(currentCPU); enable_interrupts(); }