dd 0x0000FFFF, 0x00CF9200 ; 10 PL0 Data
dd 0x0000FFFF, 0x00CFFA00 ; 18 PL3 Code
dd 0x0000FFFF, 0x00CFF200 ; 20 PL3 Data
- dd 26*4-1, 0x00408900 ; Double Fault TSS
- times MAX_CPUS dd 26*4-1, 0x00408900
+ dd 26*4-1, 0x00408900 ; 28 Double Fault TSS
+ times MAX_CPUS dd 26*4-1, 0x00408900 ; 30+ TSSes
[global gGDTPtr]
gGDTPtr:
dw GDT_SIZE-1
iret
+[global GetCPUNum]
+GetCPUNum:
+ xor eax, eax
+ ltr ax
+ sub ax, 0x30
+ shr ax, 3 ; ax /= 8
+ ret
[section .usertext]
User_Syscall_RetAndExit:
extern tIDT gIDT[];
extern void APStartup(void); // 16-bit AP startup code
extern Uint GetEIP(void); // start.asm
+extern int GetCPUNum(void); // start.asm
extern Uint32 gaInitPageDir[1024]; // start.asm
extern void Kernel_Stack_Top;
extern tSpinlock glThreadListLock;
tThread *Proc_GetCurThread(void)
{
#if USE_MP
- return gaCPUs[ gaAPIC_to_CPU[gpMP_LocalAPIC->ID.Val&0xFF] ].Current;
+ //return gaCPUs[ gaAPIC_to_CPU[gpMP_LocalAPIC->ID.Val&0xFF] ].Current;
+ return gaCPUs[ GetCPUNum() ].Current;
#else
return gCurrentThread;
#endif
extern void Threads_Dump(void);
extern tThread *Threads_CloneTCB(Uint *Err, Uint Flags);
extern void Proc_ReturnToUser(void);
-extern void GetCPUNum(void);
+extern int GetCPUNum(void);
// === PROTOTYPES ===
void ArchThreads_Init(void);
*Err = -ENOMEM;
return NULL;
}
+ memcpy(new, cur, sizeof(tThread));
new->Next = NULL;
new->IsLocked = 0;
new->PTID = cur->TID;
// Clone Name
- new->ThreadName = malloc(strlen(cur->ThreadName)+1);
- strcpy(new->ThreadName, cur->ThreadName);
+ new->ThreadName = strdup(cur->ThreadName);
// Set Thread Group ID (PID)
if(Flags & CLONE_VM)