From: Thomas Veerman Date: Fri, 25 Jan 2013 13:29:29 +0000 (+0100) Subject: libcsu: store argc and argv on the stack X-Git-Tag: v3.2.1~63 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=fe892c5e668ec7d4e7994787c6294a5adbc865a8;p=minix.git libcsu: store argc and argv on the stack --- diff --git a/lib/csu/arch/earm/crt0.S b/lib/csu/arch/earm/crt0.S index 1359874bf..67a872031 100644 --- a/lib/csu/arch/earm/crt0.S +++ b/lib/csu/arch/earm/crt0.S @@ -36,16 +36,32 @@ RCSID("$NetBSD: crt0.S,v 1.1 2012/08/13 02:49:04 matt Exp $") STRONG_ALIAS(_start,__start) _ENTRY(__start) +#ifdef __minix + mov r5, r2 /* cleanup */ + mov r4, r1 /* obj_main */ + mov r3, r0 /* ps_strings */ + /* Get argc, argv, and envp from stack */ + ldr r0, [sp, #0x0000] + add r1, sp, #0x0004 + add r2, r1, r0, lsl #2 + add r2, r2, #0x0004 +#else /* * We need to swap ps_strings and cleanup */ mov ip, r0 /* ps_strings -> tmp */ mov r0, r2 /* cleanup -> ps_strings */ mov r2, ip /* tmp -> ps_strings */ - +#endif /* __minix */ /* Ensure the stack is properly aligned before calling C code. */ bic sp, sp, #7 +#ifdef __minix + /* Store argc and argv on the stack */ + sub sp, sp, #8 + str r5, [sp, #4] + str r4, [sp, #0] +#endif /* * void ___start(void (*cleanup)(void), * const Obj_Entry *obj,