mov fs, ax
mov gs, ax
- mov eax, [esp+12*4] ; CPU Number
- push eax ; Pus as argument
+ call GetCPUNum
+ push eax ; Push as argument
call Proc_Scheduler
tAPIC *gpMP_LocalAPIC = NULL;
Uint8 gaAPIC_to_CPU[256] = {0};
tCPU gaCPUs[MAX_CPUS];
+tTSS gaTSSs[MAX_CPUS]; // TSS Array
int giProc_BootProcessorID = 0;
#else
tThread *gCurrentThread = NULL;
#if USE_PAE
Uint32 *gPML4s[4] = NULL;
#endif
-tTSS *gTSSs = NULL;
+tTSS *gTSSs = NULL; // Pointer to TSS array
tTSS gTSS0 = {0};
// --- Error Recovery ---
char gaDoubleFaultStack[1024];
Warning("Too many CPUs detected (%i), only using %i of them", giNumCPUs, MAX_CPUS);
giNumCPUs = MAX_CPUS;
}
+ gTSSs = gaTSSs;
}
else {
Log("No MP Table was found, assuming uniprocessor\n");
gCurrentThread = thread;
#endif
+ //Log("CPU = %i", CPU);
+
// Update Kernel Stack pointer
gTSSs[CPU].ESP0 = thread->KernelStack-4;
lidt [gIDTPtr]
mov eax, [gpMP_LocalAPIC]
- xor ecx, ecx
- mov cl, BYTE [eax+0x20]
+ mov ecx, [eax+0x20] ; Read ID
+ shr ecx, 24
+ ;xchg bx, bx ; MAGIC BREAK
; CL is now local APIC ID
mov cl, BYTE [gaAPIC_to_CPU+ecx]
; CL is now the CPU ID
mov BYTE [gaCPUs+ecx*8+1], 1
; Decrement the remaining CPU count
dec DWORD [giNumInitingCPUs]
- xchg bx, bx ; MAGIC BREAK
; Set TSS
shl cx, 3
add cx, 0x30
ltr cx
; CPU is now marked as initialised
sti
- xchg bx, bx ; MAGIC BREAK
+ ;xchg bx, bx ; MAGIC BREAK
.hlt:
hlt
jmp .hlt