typedef signed long Sint32;
typedef signed long long Sint64;
typedef Uint size_t;
+typedef char BOOL;
typedef Uint64 tPAddr;
typedef Uint32 tVAddr;
typedef struct {
- Uint gs, fs, es, ds;
- Uint edi, esi, ebp, kesp;
+ Uint gs, fs, es, ds;
+ Uint edi, esi, ebp, kesp;
Uint ebx, edx, ecx, eax;
- Uint int_num, err_code;
- Uint eip, cs;
+ Uint int_num, err_code;
+ Uint eip, cs;
Uint eflags, esp, ss;
} tRegs;
#include <signal.h>
#include <proc.h>
+/**
+ * \brief IPC Message
+ */
typedef struct sMessage
{
- struct sMessage *Next;
- Uint Source;
- Uint Length;
- Uint8 Data[];
-} tMsg; // sizeof = 12+
+ struct sMessage *Next; //!< Next message in thread's inbox
+ tTID Source; //!< Source thread ID
+ Uint Length; //!< Length of message data in bytes
+ Uint8 Data[]; //!< Message data
+} tMsg;
+/**
+ * \brief Core threading structure
+ *
+ */
typedef struct sThread
{
// --- threads.c's
#define GETMSG_IGNORE ((void*)-1)
+// === GLOBALS ===
+extern BOOL gaThreads_NoTaskSwitch[MAX_CPUS];
+
// === FUNCTIONS ===
extern tThread *Proc_GetCurThread(void);
extern tThread *Threads_GetThread(Uint TID);
tThread *gSleepingThreads = NULL; // Sleeping Threads
tThread *gDeleteThreads = NULL; // Threads to delete
int giNumCPUs = 1; // Number of CPUs
+BOOL gaThreads_NoTaskSwitch[MAX_CPUS]; // Disables task switches for each core (Pseudo-IF)
// === CODE ===
/**
{
tThread *thread;
int ticket;
- int number;
+ int number;
// If this CPU has the lock, we must let it complete
if( CPU_HAS_LOCK( &glThreadListLock ) )
return Last;
+ // Same if the current CPU has any lock
+ if( gaThreads_NoTaskSwitch[CPU] )
+ return Last;
+
+
// Lock thread list
SHORTLOCK( &glThreadListLock );
ret = AST_NewIf(Parser, cond, true, false);
}
return ret;
+
case TOK_RWD_FOR:
{
tAST_Node *init=NULL, *cond=NULL, *inc=NULL, *code;
ret = AST_NewLoop(Parser, init, 0, cond, inc, code);
}
return ret;
+
case TOK_RWD_DO:
case TOK_RWD_WHILE:
TODO(Parser, "Implement do and while\n");