ret = Threads_WaitTID(Regs->Arg1, (void*)Regs->Arg2);
break;
+ // -- Get the physical address of a page
case SYS_GETPHYS:
ret = MM_GetPhysAddr(Regs->Arg1);
break;
+
// -- Map an address
case SYS_MAP: MM_Map(Regs->Arg1, Regs->Arg2); break;
+
// -- Allocate an address
case SYS_ALLOCATE: ret = MM_Allocate(Regs->Arg1); break;
+
// -- Unmap an address
case SYS_UNMAP: MM_Deallocate(Regs->Arg1); break;
// -- Get Thread/Process IDs
case SYS_GETTID: ret = Threads_GetTID(); break;
case SYS_GETPID: ret = Threads_GetPID(); break;
+
// -- Get User/Group IDs
case SYS_GETUID: ret = Threads_GetUID(); break;
case SYS_GETGID: ret = Threads_GetGID(); break;
void Threads_SetTickets(int Num);
int Threads_WaitTID(int TID, int *status);
tThread *Threads_GetThread(Uint TID);
+void Threads_AddToDelete(tThread *Thread);
tThread *Threads_int_GetPrev(tThread **List, tThread *Thread);
void Threads_Exit(int TID, int Status);
void Threads_Kill(tThread *Thread, int Status);
{
case THREAD_STAT_ZOMBIE:
t->Status = THREAD_STAT_DEAD;
- *status = 0;
+ if(status) *status = 0;
+ Threads_AddToDelete( t );
break;
default:
- *status = -1;
+ if(status) *status = -1;
break;
}
return ret;
return NULL;
}
+/**
+ * \fn void Threads_AddToDelete(tThread *Thread)
+ * \brief Adds a thread to the delete queue
+ */
+void Threads_AddToDelete(tThread *Thread)
+{
+ // Add to delete queue
+ if(gDeleteThreads) {
+ Thread->Next = gDeleteThreads;
+ gDeleteThreads = Thread;
+ } else {
+ Thread->Next = NULL;
+ gDeleteThreads = Thread;
+ }
+}
+
/**
* \fn tThread *Threads_int_GetPrev(tThread *List, tThread *Thread)
* \brief Gets the previous entry in a thead linked list
if(Status == -1)
{
Thread->Status = THREAD_STAT_DEAD;
- // Add to delete queue
- if(gDeleteThreads) {
- Thread->Next = gDeleteThreads;
- gDeleteThreads = Thread;
- } else {
- Thread->Next = NULL;
- gDeleteThreads = Thread;
- }
+ Threads_AddToDelete( Thread );
} else {
Thread->Status = THREAD_STAT_ZOMBIE;
}
SYSCALL0 yield, SYS_YIELD
SYSCALL0 sleep, SYS_SLEEP
SYSCALL1 wait, SYS_WAIT
+SYSCALL2 waittid, SYS_WAITTID
SYSCALL0 gettid, SYS_GETTID
SYSCALL0 getpid, SYS_GETPID
void _SysDebug(char *str, ...);
// --- Proc ---
void sleep();
+void wait(int miliseconds);
+ int waittid(int id, int *status);
int clone(int flags, void *stack);
int execve(char *path, char **argv, char **envp);
// --- VFS ---