summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDale S. Rahn <rahnds@cvs.openbsd.org>1998-07-05 00:00:01 +0000
committerDale S. Rahn <rahnds@cvs.openbsd.org>1998-07-05 00:00:01 +0000
commit49d15ae928c1c02925704490e1ac7bc70825079e (patch)
tree408fa911cb56446c2e1e7c5f1fc54b2e467cda4e
parent42f6909fcf313bc7d56469429281e8ad4bfc65a5 (diff)
Changes to support profiling on the powerpc port, startup code.
-rw-r--r--lib/csu/powerpc/crt0.s30
1 files changed, 26 insertions, 4 deletions
diff --git a/lib/csu/powerpc/crt0.s b/lib/csu/powerpc/crt0.s
index 964a05f3861..1c41855bd0b 100644
--- a/lib/csu/powerpc/crt0.s
+++ b/lib/csu/powerpc/crt0.s
@@ -1,6 +1,6 @@
- .data 1
+ .section ".data"
.comm environ, 4
.globl __progname
__progname:
@@ -9,10 +9,11 @@ L1: .long 0 # null string plus padding
- .text
+ .section ".text"
.globl start
start:
.globl _start
+ .type _start,@function
_start:
# squirrel away the arguments for main
@@ -21,7 +22,14 @@ _start:
mr 15, 5
mr 16, 6
+ # make certain space exists on the stack for the
+ # 'stw X, 4(1)' at the beginning of functions.
+ subi 1, 1, 16
+ li 0, 0
+ stw 0, 0(1)
+
# determine the program name (__progname)
+ mr 4, 14
lwz 28, 0(4) # r28 = argv[0] (program name)
cmpwi 28, 0 # argv[0] == NULL?
beq call_main # yep forget setup of progname
@@ -38,10 +46,20 @@ no_slash_found:
stw 28, __progname@L(31)
lis 26, environ@HA
- stw 5, environ@L(26)
+ stw 15, environ@L(26)
-call_main:
.globl __init
+call_main:
+#ifdef MCRT0
+ addis 3, 3, _mcleanup@ha
+ addi 3, 3, _mcleanup@l
+ bl atexit
+ addis 3, 3, eprol@ha
+ addi 3, 3, eprol@l
+ addis 4, 4, _etext@ha
+ addi 4, 4, _etext@l
+ bl monstartup
+#endif
bl __init
# recover those saved registers
mr 3, 13
@@ -56,9 +74,13 @@ call_main:
mr 3, 13
bl exit
+eprol:
+#if 0
.globl __main
__main:
+#endif
.globl __eabi
+ .type __eabi,@function
__eabi:
blr