Non-master processors cannot have cpu_number() == 0.
The synchronisation fails hard if the cpu number is wrong.
Alert the condition if this is the case.

(On AMD fam15h, this assert currently fails, but I haven't
been able to boot it with smp yet either).

---
 i386/i386/mp_desc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/i386/i386/mp_desc.c b/i386/i386/mp_desc.c
index 61a7607b..5fff2a68 100644
--- a/i386/i386/mp_desc.c
+++ b/i386/i386/mp_desc.c
@@ -24,6 +24,7 @@
  * the rights to redistribute these changes.
  */
 
+#include <kern/assert.h>
 #include <kern/cpu_number.h>
 #include <kern/debug.h>
 #include <kern/printf.h>
@@ -280,6 +281,8 @@ cpu_ap_main()
 {
     int cpu = cpu_number();
 
+    assert(cpu > 0);
+
     do {
        cpu_pause();
     } while (bspdone != cpu);
-- 
2.45.2



Reply via email to