X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Farch%2Fx86%2Finclude%2Fproc.h;h=0a1d754863296692ba881d5f359e584f9b4b6403;hb=53436af44ded8bc345d4d3d1a9fe25de4d6f23bc;hp=6e559bede1e2b90d0638c47f7057b40389ead75d;hpb=8bc40333b1401d7616b225945fee53d972c2f418;p=tpg%2Facess2.git diff --git a/Kernel/arch/x86/include/proc.h b/Kernel/arch/x86/include/proc.h index 6e559bed..0a1d7548 100644 --- a/Kernel/arch/x86/include/proc.h +++ b/Kernel/arch/x86/include/proc.h @@ -5,52 +5,21 @@ #ifndef _PROC_H #define _PROC_H +#include + // === CONSTANTS === #define GETMSG_IGNORE ((void*)-1) // === TYPES === -typedef struct sMessage { - struct sMessage *Next; - Uint Source; - Uint Length; - Uint8 Data[]; -} tMsg; // sizeof = 12+ - -typedef struct sThread { - struct sThread *Next; - int IsLocked; - int Status; //!< Thread Status - - Uint TID; //!< Thread ID - Uint TGID; //!< Thread Group (Process) - Uint UID, GID; //!< User and Group - char *ThreadName; //!< Name of thread - - Uint ESP, EBP, EIP; //!< State on switch - #if USE_PAE - Uint64 PML4[3]; //!< Address Space - #else - Uint CR3; //!< Memory Space - #endif - - Uint KernelStack; //!< Thread's Kernel Stack - - tMsg *Messages; //!< Message Queue - tMsg *LastMessage; //!< Last Message (speeds up insertion) - - int Quantum, Remaining; //!< Quantum Size and remaining timesteps - int NumTickets; //!< Priority - Chance of gaining CPU - - Uint Config[NUM_CFG_ENTRIES]; //!< Per-process configuration -} tThread; // sizeof = 68 - -enum { - THREAD_STAT_NULL, - THREAD_STAT_ACTIVE, - THREAD_STAT_SLEEPING, - THREAD_STAT_WAITING, - THREAD_STAT_DEAD -}; +#if USE_MP +typedef struct sCPU +{ + Uint8 APICID; + Uint8 State; // 0: Unavaliable, 1: Idle, 2: Active + Uint16 Resvd; + tThread *Current; +} tCPU; +#endif typedef struct sTSS { Uint32 Link; @@ -65,19 +34,10 @@ typedef struct sTSS { Uint32 ES, CS, DS, SS, FS, GS; Uint32 LDTR; Uint16 Resvd, IOPB; // IO Permissions Bitmap -} tTSS; - -// === GLOBALS === -extern tThread *gCurrentThread; +} __attribute__((packed)) tTSS; // === FUNCTIONS === extern void Proc_Start(); extern int Proc_Clone(Uint *Err, Uint Flags); -extern void Proc_Exit(); -extern void Proc_Yield(); -extern void Proc_Sleep(); -extern void Proc_SetTickets(int Num); -extern tThread *Proc_GetThread(Uint TID); -extern void Thread_Wake(tThread *Thread); #endif