diff options
author | imp <imp@FreeBSD.org> | 2010-01-06 12:15:10 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2010-01-06 12:15:10 +0000 |
commit | 1f8a98e4fcfb340aa5706d95f5c5bec3c2c04a53 (patch) | |
tree | a743093452246c44a8aaa764cf4d9686f73c18d7 | |
parent | 2fa2f73b380b7657d64ae5bd0025fd23c8e72397 (diff) | |
download | FreeBSD-src-1f8a98e4fcfb340aa5706d95f5c5bec3c2c04a53.zip FreeBSD-src-1f8a98e4fcfb340aa5706d95f5c5bec3c2c04a53.tar.gz |
Revert r200892, 200893 and 200894. There's companion changes
elsewhere that aren't quite ready, and these break the world in the
mean time.
-rw-r--r-- | lib/csu/mips/crt1.c | 83 | ||||
-rw-r--r-- | lib/csu/mips/crti.S | 29 | ||||
-rw-r--r-- | lib/csu/mips/crtn.S | 3 |
3 files changed, 17 insertions, 98 deletions
diff --git a/lib/csu/mips/crt1.c b/lib/csu/mips/crt1.c index 6173404..746cee2 100644 --- a/lib/csu/mips/crt1.c +++ b/lib/csu/mips/crt1.c @@ -1,4 +1,6 @@ /*- + * Copyright 1996-1998 John D. Polstra. + * All rights reserved. * Copyright (c) 1995 Christopher G. Demetriou * All rights reserved. * @@ -63,94 +65,37 @@ extern int etext; char **environ; const char *__progname = ""; -struct ps_strings *__ps_strings; void __gccmain(void) {} void __main(void) {} -/* - * Historically, mips has used __start for the beginning address of programs. - * However, the Cavium toolchain (and maybe others) use _start. Define both - * here. The assembler code here tries to juggle the arguments such that they - * are right for all ABIs and then calls __start_mips which is what used to - * be just plain __start, and still is on other BSD ports. - */ - /* The entry function. */ -__asm(" .text \n" -" .align 8 \n" -" .globl _start \n" -" _start: \n" -" .globl __start \n" -" __start: \n" -#if defined(__mips_n32) || defined(__mips_n64) -" .cpsetup $25, $24, __start\n" -#else -" .set noreorder \n" -" .cpload $25 \n" -" .set reorder \n" -#endif -" /* Get cleanup routine and main object set by rtld */\n" -" /* Note that a2 is already set to ps_string by _rtld_start */\n" -" /* move a3, a0 */\n" -" /* move t0, a1 */\n" -" /* Get argc, argv from stack */ \n" -" /* lw a0, 0(sp) */\n" -" /* move a1, sp */\n" -" /* addu a1, 4 */\n" -" \n" -" /* Stack should 8bytes aligned */\n" -" /* required by ABI to pass */\n" -" /* 64-bits arguments */\n" -" /* and sp, ~8 */\n" -" /* subu sp, sp, 20 */\n" -" /* sw t0, 16(sp) */\n" -" \n" -" move $7, $4 /* atexit */\n" -" move $8, $5 /* main_obj entry */\n" -#if defined(__mips_n64) -" ld $4, 0($29) \n" -" move $5, $29 \n" -" addu $5, 8 \n" -#else -" lw $4, 0($29) \n" -" move $5, $29 \n" -" addu $5, 4 \n" -#endif -" \n" -" and $29, 0xfffffff8 \n" -" subu $29, $29, 24 /* args slot + cleanup + 4 bytes padding */ \n" -" sw $8, 16($29) \n" -"\n" -" la $25, __start_mips \n" -" nop \n" -" j $25\n"); -/* ARGSUSED */ - void -__start_mips(int argc, char **argv, struct ps_strings *ps_strings, - void (*cleanup)(void), struct Struct_Obj_Entry *obj __unused) +__start(char **ap, + void (*cleanup)(void), /* from shared loader */ + struct Struct_Obj_Entry *obj, /* from shared loader */ + struct ps_strings *ps_strings) { + int argc; + char **argv; char **env; - const char *s; - env = argv + argc + 1; + argc = * (long *) ap; + argv = ap + 1; + env = ap + 2 + argc; environ = env; - if(argc > 0 && argv[0] != NULL) { + const char *s; __progname = argv[0]; for (s = __progname; *s != '\0'; s++) if (*s == '/') __progname = s + 1; } - __ps_strings = ps_strings; - +#ifndef NOSHARED if (&_DYNAMIC != NULL) atexit(cleanup); - else - _init_tls(); - +#endif #ifdef GCRT atexit(_mcleanup); #endif diff --git a/lib/csu/mips/crti.S b/lib/csu/mips/crti.S index a46a4f0..1a0d23e 100644 --- a/lib/csu/mips/crti.S +++ b/lib/csu/mips/crti.S @@ -5,13 +5,6 @@ __FBSDID("$FreeBSD$"); .align 4 .globl _init .type _init,%function - - /* - * The Cavium toolchain apparently has code that references $fp - * instead of $sp for the .cprestore 16 macro. The move doesn't - * hurt on other toolchains, so unconditionally compile it in for - * now. - */ _init: #ifdef __ABICALLS__ .set noreorder @@ -20,7 +13,7 @@ _init: subu sp, sp, 32 .cprestore 16 sw ra, 28(sp) - move s8, sp /* See note above */ + #else subu sp, sp, 32 sw ra, 28(sp) @@ -31,30 +24,14 @@ _init: .globl _fini .type _fini,%function _fini: - -#if defined (__mips_n64) || defined (__mips_n32) -#ifdef __ABICALLS__ - subu sp, sp, 32 - sw gp, 16(sp) - sw ra, 28(sp) - move s8, sp -#else - subu sp, sp, 32 - sw ra, 28(sp) -#endif /*__ABICALLS__*/ - -#else #ifdef __ABICALLS__ .set noreorder .cpload $25 .set reorder subu sp, sp, 32 - move s8, sp /* See note above */ - .cprestore 16 /* xxx missing in Cavium's version -- why? */ + .cprestore 16 sw ra, 28(sp) #else subu sp, sp, 32 sw ra, 28(sp) -#endif /* __ABICALLS__ */ - -#endif /* __mips_n64 || __mips_n32 */ +#endif diff --git a/lib/csu/mips/crtn.S b/lib/csu/mips/crtn.S index 96a0210..4803994 100644 --- a/lib/csu/mips/crtn.S +++ b/lib/csu/mips/crtn.S @@ -9,9 +9,6 @@ __FBSDID("$FreeBSD$"); .section .fini,"ax",%progbits lw ra, 28(sp) -#if defined(__mips_n64) || defined(__mips_n32) - lw gp, 16(sp) -#endif .set noreorder j ra addu sp, sp, 32 |