From: John Hodge Date: Sun, 16 Oct 2011 14:31:05 +0000 (+0800) Subject: Kernel/x86_64 - Unbroke user stack creation X-Git-Tag: rel0.13~57 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=d710f435ed0d2b804ea82dba2dd122c4d6e5d08d;p=tpg%2Facess2.git Kernel/x86_64 - Unbroke user stack creation --- diff --git a/Kernel/arch/x86_64/proc.c b/Kernel/arch/x86_64/proc.c index d05e9ae6..e3d7e90b 100644 --- a/Kernel/arch/x86_64/proc.c +++ b/Kernel/arch/x86_64/proc.c @@ -594,16 +594,22 @@ 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);