diff options
author | Eric Andersen <andersen@codepoet.org> | 2002-10-01 17:25:57 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2002-10-01 17:25:57 +0000 |
commit | 29d00ff0330e6ba6b1caf79410877a453d7fe8d1 (patch) | |
tree | 2fa25d6bd59e3b603dfd646785244864417908a3 /libc/sysdeps | |
parent | adda937b5dbe4ba553fff9cdd5420321d46e7c99 (diff) |
Patch from Marshall M. Midden <m4@brecis.com> to fixup crt0 for
mips where I had made a mess
Diffstat (limited to 'libc/sysdeps')
-rw-r--r-- | libc/sysdeps/linux/mips/crt0.S | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/libc/sysdeps/linux/mips/crt0.S b/libc/sysdeps/linux/mips/crt0.S index 7ff3b253f..fd1f4b9d4 100644 --- a/libc/sysdeps/linux/mips/crt0.S +++ b/libc/sysdeps/linux/mips/crt0.S @@ -24,25 +24,23 @@ __start: .set reorder #endif - move $31, zero + move $31, zero /* no return, but since the jal kills $31, skip this */ lw a0, 0($29) /* argc */ - addu a1, $29, 4 /* argv */ - addu a2, a0, 1 /* load envp */ - sll a2, a2, 2 - add a2, a2, a1 - - /* Store the address of _init in a3 as an argument to __uClibc_start_main() */ - la a3, _init - - /* Push _fini onto the stack as the final argument to __uClibc_start_main() - I don't think I am doing this properly but it at least compiles... - */ - la t0, _fini - sw t0,16(sp) + addu a1, $29, 4 /* get to start of argv */ + addu a2, a0, 1 /* argv[0] program name (ordinal->cardinal) */ + sll a2, a2, 2 /* multiple by 4 */ + add a2, a2, a1 /* a2 now points to start of envp */ + la a3, _init /* a3 is address of _init */ + addiu sp, sp, -24 /* 16 + 4 rounded up to multiple of 8 */ + /* multiple of 8 for longlong/double support */ + la v0, _fini + sw v0, 16(sp) /* stack has 5th argument, address of _fini */ /* Ok, now run uClibc's main() -- shouldn't return */ jal __uClibc_start_main + addiu sp, sp, 24 /* undo stack argument */ + /* Crash if somehow `exit' returns anyways. */ hlt: b hlt |