From c4ae8409ba034fcd7092d891381c3711e62d5b25 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Sat, 4 Nov 2006 19:53:15 +0000 Subject: mips64 patch from Atsushi Nemoto: miscellaneous asm routines --- libc/sysdeps/linux/mips/crt1.S | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'libc/sysdeps/linux/mips/crt1.S') diff --git a/libc/sysdeps/linux/mips/crt1.S b/libc/sysdeps/linux/mips/crt1.S index 35dc8c42e..2e38cf07c 100644 --- a/libc/sysdeps/linux/mips/crt1.S +++ b/libc/sysdeps/linux/mips/crt1.S @@ -37,6 +37,7 @@ #include +#include #include @@ -83,6 +84,7 @@ __start: #ifdef __PIC__ +#if _MIPS_SIM == _MIPS_SIM_ABI32 .set noreorder move $0, $31 /* Save old ra. */ bal 10f /* Find addr of cpload. */ @@ -91,19 +93,30 @@ __start: .cpload $31 move $31, $0 .set reorder +#else + move $0, $31; /* Save old ra. */ + .set noreorder + bal 10f /* Find addr of .cpsetup. */ + nop +10: + .set reorder + .cpsetup $31, $25, 10b + move $31, $0 +#endif #else la $28, _gp /* Setup GP correctly if we're non-PIC. */ move $31, $0 #endif - la $4, main /* main */ - lw $5, 0($29) /* argc */ - addiu $6, $29, 4 /* argv */ + PTR_LA $4, main /* main */ + PTR_L $5, 0($29) /* argc */ + PTR_ADDIU $6, $29, PTRSIZE /* argv */ /* Allocate space on the stack for seven arguments and * make sure the stack is aligned to double words (8 bytes) */ +#if _MIPS_SIM == _MIPS_SIM_ABI32 and $29, -2 * 4 subu $29, 32 la $7, _init /* init */ @@ -111,6 +124,13 @@ __start: sw $8, 16($29) /* fini */ sw $2, 20($29) /* rtld_fini */ sw $29, 24($29) /* stack_end */ +#else + and $29, -2 * PTRSIZE + PTR_LA $7, _init /* init */ + PTR_LA $8, _fini /* fini */ + move $9, $2 /* rtld_fini */ + move $10, $29 /* stack_end */ +#endif jal __uClibc_main hlt: /* Crash if somehow `__uClibc_main' returns anyway. */ -- cgit v1.2.3