summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/csu/mips64/md_init.h48
1 files changed, 19 insertions, 29 deletions
diff --git a/lib/csu/mips64/md_init.h b/lib/csu/mips64/md_init.h
index 464c4bafef7..66c7c7fa7dc 100644
--- a/lib/csu/mips64/md_init.h
+++ b/lib/csu/mips64/md_init.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: md_init.h,v 1.4 2013/12/04 00:20:31 deraadt Exp $ */
+/* $OpenBSD: md_init.h,v 1.5 2013/12/23 18:16:39 kettenis Exp $ */
/*-
* Copyright (c) 2001 Ross Harvey
@@ -87,6 +87,23 @@
" jal " #func " \n" \
".previous")
+#define MD_CRT0_START \
+ __asm( \
+ ".text \n" \
+ " .align 3 \n" \
+ " .globl __start \n" \
+ " .ent __start \n" \
+ " .type __start, @function \n" \
+ "__start: \n" \
+ " lui $gp, %hi(%neg(%gp_rel(__start))) \n" \
+ " addiu $gp, $gp, %lo(%neg(%gp_rel(__start))) \n" \
+ " daddu $gp, $gp, $t9 \n" \
+ " move $a0, $sp \n" \
+ " move $a1, $v0 \n" \
+ " dla $t9, ___start \n" \
+ " jr $t9 \n" \
+ " .end __start \n" \
+ " .previous")
struct kframe {
long kargc;
@@ -95,38 +112,11 @@ struct kframe {
char kenvstr[1]; /* size varies */
};
-#define MD_START __start
-#define MD_START_ARGS void
-
-/*
- * XXX no cleanup() callback passed to __start yet. Need to pull
- * it from v0 in ASM?
- */
-#define MD_NO_CLEANUP
-
-
-/*
- * Do GP register setup and find the kframe struct. Differs depending
- * on shared lib stuff or not.
- * XXX just above the saved frame pointer?
- * kfp = (struct kframe *) (&param-1);
- */
-#if defined(_NO_ABICALLS)
-#define SETUP_KFP(kfp) \
- asm(" dla $28,_gp \n" \
- " daddiu %0,$29,32" : "=r" (kfp))
-#else
-#define SETUP_KFP(kfp) \
- asm(" daddiu %0,$29,48" : "=r" (kfp))
-#endif
-
-
+#define MD_START_ARGS struct kframe *kfp, void (*cleanup)(void)
#define MD_START_SETUP \
- struct kframe *kfp; \
char **argv, **envp; \
int argc; \
\
- SETUP_KFP(kfp); \
argc = kfp->kargc; \
argv = &kfp->kargv[0]; \
environ = envp = argv + argc + 1;