Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/csu/arch/sh3 New ___start() C function takes 3 arguments...



details:   https://anonhg.NetBSD.org/src/rev/baa2ee77a73c
branches:  trunk
changeset: 773353:baa2ee77a73c
user:      uwe <uwe%NetBSD.org@localhost>
date:      Tue Jan 31 20:17:57 2012 +0000

description:
New ___start() C function takes 3 arguments instead of 6 and fetches
argc, argv and environ from ps_strings instead.  Adjust the trampoline
accordingly.

Fix brain fart in previous: direct jump is jmp @rN, not bsrf rN.

diffstat:

 lib/csu/arch/sh3/crt0.S |  20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diffs (41 lines):

diff -r 36eb52b5ea15 -r baa2ee77a73c lib/csu/arch/sh3/crt0.S
--- a/lib/csu/arch/sh3/crt0.S   Tue Jan 31 20:12:47 2012 +0000
+++ b/lib/csu/arch/sh3/crt0.S   Tue Jan 31 20:17:57 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.S,v 1.3 2012/01/29 23:27:24 uwe Exp $ */
+/* $NetBSD: crt0.S,v 1.4 2012/01/31 20:17:57 uwe Exp $ */
 
 /*
  * Copyright (c) 1998 Christos Zoulas
@@ -37,21 +37,23 @@
 
 #include <machine/asm.h>
 
-RCSID("$NetBSD: crt0.S,v 1.3 2012/01/29 23:27:24 uwe Exp $")
+RCSID("$NetBSD: crt0.S,v 1.4 2012/01/31 20:17:57 uwe Exp $")
 
 STRONG_ALIAS(_start,__start)
 
 /*
- * Kernel setregs() passes all arguments in registers to avoid
- * copyout.  This trampoline pushes 5th and 6th arguments into stack,
- * where C ABI expects them to be, and calls the real startup code
- * written in C.
+ * Kernel setregs() passes arguments for the 6-argument version of
+ * ___start (but with 5th and 6th in registers, to avoid copyout).
+ * Since we now use 3-argument version of ___start - that obtains
+ * argc, argv and environ from ps_strings - move its arguments to
+ * proper registers.
  */
 _ENTRY(__start)
        mov.l   .L___start, r0
-       mov.l   r9, @-sp
-       braf    r0
-        mov.l  r8, @-sp
+       mov     r7, r4          ! void (*cleanup)(void)
+       mov     r8, r5          ! const Obj_Entry *obj
+       jmp     @r0
+        mov    r9, r6          ! struct ps_strings *ps_strings
 
        .p2align 2
 .L___start:    .long   _C_LABEL(___start)



Home | Main Index | Thread Index | Old Index