void Proc_IdleTask(void *unused);
//void Proc_Start(void);
//tThread *Proc_GetCurThread(void);
- int Proc_NewKThread(void (*Fcn)(void*), void *Data);
+// int Proc_NewKThread(void (*Fcn)(void*), void *Data);
// int Proc_Clone(Uint *Err, Uint Flags);
// int Proc_SpawnWorker(void);
Uint Proc_MakeUserStack(void);
void Proc_StartUser(Uint Entrypoint, Uint Base, int ArgC, char **ArgV, int DataSize)
{
- Uint *stack = (void*)Proc_MakeUserStack();
+ Uint *stack;
char **envp;
int i;
Uint delta;
Uint16 ss, cs;
- LOG("stack = 0x%x", stack);
// Copy Arguments
- stack = (void*)( Proc_MakeUserStack() - DataSize );
+ stack = (void*)Proc_MakeUserStack();
+ if(!stack) {
+ Log_Error("Proc", "Unable to create user stack!");
+ Threads_Exit(0, -1);
+ }
+ stack -= (DataSize+7)/8;
+ LOG("stack = 0x%x", stack);
+ Log("stack = %p, DataSize = %i", stack, DataSize);
memcpy( stack, ArgV, DataSize );
free(ArgV);