From ab504d3415d3eba180221d451b3fd38c4c5c1898 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 18 Mar 2003 19:22:33 +0000 Subject: 2003-03-18 Till Straumann PR 356/bsps * cpu.c: This patch makes RTEMS/PowerPC eabi compliant. --- c/src/lib/libcpu/powerpc/new-exceptions/ChangeLog | 5 +++++ c/src/lib/libcpu/powerpc/new-exceptions/cpu.c | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) (limited to 'c/src/lib/libcpu') 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 + + PR 356/bsps + * cpu.c: This patch makes RTEMS/PowerPC eabi compliant. + 2003-03-06 Ralf Corsepius * 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 } -- cgit v1.2.3