# error "Unknown architecture '" #ARCH "'"
#endif
+#if USE_MP
+# define MAX_CPUS 8
+#else
+# define MAX_CPUS 1
+#endif
+
// === MACROS ===
#define LOCK(lockptr) do {int v=1;\
while(v)__asm__ __volatile__("lock xchgl %%eax, (%%edi)":"=a"(v):"a"(1),"D"(lockptr));}while(0)
extern int giNextTID;
extern int giTotalTickets;
extern int giNumActiveThreads;
+extern tThread gThreadZero;
extern tThread *gActiveThreads;
extern tThread *gSleepingThreads;
extern tThread *gDeleteThreads;
// === GLOBALS ===
// --- Current State ---
#if USE_MP
-tThread **gCurrentThread = NULL;
+tThread *gCurrentThread[MAX_CPUS] = NULL;
#else
tThread *gCurrentThread = NULL;
#endif
}
#endif
+ #if USE_MP
+ gCurrentThread[0] = &gThreadZero;
+ #else
+ gCurrentThread = &gThreadZero;
+ #endif
+
// Set timer frequency
outb(0x43, 0x34); // Set Channel 0, Low/High, Rate Generator
outb(0x40, TIMER_DIVISOR&0xFF); // Low Byte of Divisor