summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libcpu
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2003-03-18 19:22:33 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2003-03-18 19:22:33 +0000
commitab504d3415d3eba180221d451b3fd38c4c5c1898 (patch)
treea2a60ea36ce4c96caed770c8f442fd0153d36ed6 /c/src/lib/libcpu
parent2003-03-18 Till Straumann <strauman@slac.stanford.edu> (diff)
downloadrtems-ab504d3415d3eba180221d451b3fd38c4c5c1898.tar.bz2
2003-03-18 Till Straumann <strauman@slac.stanford.edu>
PR 356/bsps * cpu.c: This patch makes RTEMS/PowerPC eabi compliant.
Diffstat (limited to 'c/src/lib/libcpu')
-rw-r--r--c/src/lib/libcpu/powerpc/new-exceptions/ChangeLog5
-rw-r--r--c/src/lib/libcpu/powerpc/new-exceptions/cpu.c21
2 files changed, 26 insertions, 0 deletions
diff --git a/c/src/lib/libcpu/powerpc/new-exceptions/ChangeLog b/c/src/lib/libcpu/powerpc/new-exceptions/ChangeLog
index d481015e17..ef6b4c5687 100644
--- a/c/src/lib/libcpu/powerpc/new-exceptions/ChangeLog
+++ b/c/src/lib/libcpu/powerpc/new-exceptions/ChangeLog
@@ -1,3 +1,8 @@
+2003-03-18 Till Straumann <strauman@slac.stanford.edu>
+
+ PR 356/bsps
+ * cpu.c: This patch makes RTEMS/PowerPC eabi compliant.
+
2003-03-06 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: Remove AC_CONFIG_AUX_DIR.
diff --git a/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c b/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c
index 32589213ae..9dcd1b4da2 100644
--- a/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c
+++ b/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c
@@ -70,6 +70,9 @@ void _CPU_Context_Initialize(
unsigned32 sp;
sp = (unsigned32)stack_base + size - CPU_MINIMUM_STACK_FRAME_SIZE;
+
+ sp &= ~(CPU_STACK_ALIGNMENT-1);
+
*((unsigned32 *)sp) = 0;
the_context->gpr1 = sp;
@@ -109,6 +112,24 @@ void _CPU_Context_Initialize(
#endif
the_context->pc = (unsigned32)entry_point;
+
+#if (PPC_ABI == PPC_ABI_SVR4)
+ { unsigned r13 = 0;
+ asm volatile ("mr %0, 13" : "=r" ((r13)));
+
+ the_context->gpr13 = r13;
+ }
+#elif (PPC_ABI == PPC_ABI_EABI)
+ { unsigned32 r2 = 0;
+ unsigned r13 = 0;
+ asm volatile ("mr %0,2; mr %1,13" : "=r" ((r2)), "=r" ((r13)));
+
+ the_context->gpr2 = r2;
+ the_context->gpr13 = r13;
+ }
+#else
+#error unsupported PPC_ABI
+#endif
}