/*
- * AcessOS Microkernel Version
+ * Acess2 Kernel (x86)
+ * - By John Hodge (thePowersGang)
+ *
* proc.c
+ * - Low level thread management
*/
+#define DEBUG 0
#include <acess.h>
#include <threads.h>
#include <proc.h>
*/
tThread *Proc_SpawnWorker(void (*Fcn)(void*), void *Data)
{
- tThread *new;
Uint stack_contents[4];
+ LOG("(Fcn=%p,Data=%p)", Fcn, Data);
// Create new thread
- new = Threads_CloneThreadZero();
+ tThread *new = Threads_CloneThreadZero();
+ LOG("new=%p", new);
if(!new) {
Warning("Proc_SpawnWorker - Out of heap space!\n");
return NULL;
// Create a new worker stack (in PID0's address space)
new->KernelStack = MM_NewWorkerStack(stack_contents, sizeof(stack_contents));
+ LOG("new->KernelStack = %p", new->KernelStack);
// Save core machine state
new->SavedState.ESP = new->KernelStack - sizeof(stack_contents);
// Mark as active
new->Status = THREAD_STAT_PREINIT;
Threads_AddActive( new );
+ LOG("Added to active");
return new;
}