summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/powerpc/shared/start
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2003-03-18 19:20:55 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2003-03-18 19:20:55 +0000
commit64f8ae44ccb651e550fe5d7369feda6b3f21fcb6 (patch)
treeafd706051b15ea39a81e286f4c6642cd4dcb9510 /c/src/lib/libbsp/powerpc/shared/start
parent2003-03-18 Till Straumann <strauman@slac.stanford.edu> (diff)
downloadrtems-64f8ae44ccb651e550fe5d7369feda6b3f21fcb6.tar.bz2
2003-03-18 Till Straumann <strauman@slac.stanford.edu>
PR 356/bsps This patch makes RTEMS/powerpc/shared EABI compliant. * irq/irq_init.c, start/Makefile.am, start/start.S, startup/bspstart.c, startup/pgtbl_setup.c, vectors/vectors.h, vectors/vectors_init.c: zero_bss() should clear not only bss but sbss and sbss2 also (this is probably a bugfix, as sbss/sbss2 are probably used even if -msdata=eabi is not specified). * start/rtems_crti.S: New file which must be linked immediately after ecrti.o. rtems_crti.o contains a code snippet who lets __init() return immediately. Also, a new entry point '_init' to the C++ Ctors is generated for use by the RTEMS Thread_Handler.
Diffstat (limited to 'c/src/lib/libbsp/powerpc/shared/start')
-rw-r--r--c/src/lib/libbsp/powerpc/shared/start/Makefile.am4
-rw-r--r--c/src/lib/libbsp/powerpc/shared/start/rtems_crti.S35
-rw-r--r--c/src/lib/libbsp/powerpc/shared/start/start.S4
3 files changed, 40 insertions, 3 deletions
diff --git a/c/src/lib/libbsp/powerpc/shared/start/Makefile.am b/c/src/lib/libbsp/powerpc/shared/start/Makefile.am
index 52836016ed..0ba9486deb 100644
--- a/c/src/lib/libbsp/powerpc/shared/start/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/shared/start/Makefile.am
@@ -3,8 +3,8 @@
##
-S_FILES = start.S
+S_FILES = start.S rtems_crti.S
-EXTRA_DIST = start.S
+EXTRA_DIST = start.S rtems_crti.S
include $(top_srcdir)/../../../../../automake/local.am
diff --git a/c/src/lib/libbsp/powerpc/shared/start/rtems_crti.S b/c/src/lib/libbsp/powerpc/shared/start/rtems_crti.S
new file mode 100644
index 0000000000..0b606663c3
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/shared/start/rtems_crti.S
@@ -0,0 +1,35 @@
+/* rtems_crti.S */
+#include <asm.h>
+#include <rtems/score/cpu.h>
+#include <libcpu/io.h>
+
+ /* terminate the __init() function and create
+ * a new head '_init' for use by RTEMS to
+ * invoke C++ global constructors
+ * NOTE: it is essential that this snippet
+ * is hooked between ecrti and crtbegin
+ *
+ * ecrti has the following .init section:
+ * __init:
+ * stwu r1,-16(r1)
+ * mflr r0
+ * stw r0,20(r1)
+ *
+ * The reason for this is that we want to call
+ * __eabi() at an early stage but prevent __eabi()
+ * from branching to __init (C++ exception init
+ * and global CTORs). Hence we make __init a no-op
+ * and create a new entry point:
+ */
+ .section ".init","ax"
+ .align 2
+ lwz r0,r20(r1)
+ mtlr r0
+ addi r1,r1,16
+ blr
+ .globl _init
+ .type _init,@function
+_init:
+ stwu r1,-16(r1)
+ mflr r0
+ stw r0,20(r1)
diff --git a/c/src/lib/libbsp/powerpc/shared/start/start.S b/c/src/lib/libbsp/powerpc/shared/start/start.S
index 4746ab3a46..1a468ba3f5 100644
--- a/c/src/lib/libbsp/powerpc/shared/start/start.S
+++ b/c/src/lib/libbsp/powerpc/shared/start/start.S
@@ -27,7 +27,8 @@
mtmsr r10 ; \
li r10,0x63 ; \
sc
-
+
+
.text
.globl __rtems_entry_point
.type __rtems_entry_point,@function
@@ -86,6 +87,7 @@ __rtems_entry_point:
enter_C_code:
bl MMUon
+ bl __eabi /* setup EABI and SYSV environment */
bl zero_bss
/*
* restore prep boot params