summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c
diff options
context:
space:
mode:
authorTill Straumann <strauman@slac.stanford.edu>2008-07-16 22:04:06 +0000
committerTill Straumann <strauman@slac.stanford.edu>2008-07-16 22:04:06 +0000
commit6ce3f7b7e2bf811fc1bf6914d11d238a5b06e271 (patch)
tree762cf6cfb14ba0ac3dbb32e58ab2cf453098a467 /c/src/lib/libcpu/powerpc/new-exceptions/cpu.c
parent2008-07-16 Till Straumann <strauman@slac.stanford.edu> (diff)
downloadrtems-6ce3f7b7e2bf811fc1bf6914d11d238a5b06e271.tar.bz2
2008-07-16 Till Straumann <strauman@slac.stanford.edu>
* new-exceptions/cpu.c: propagate R2 to all task contexts even if the ABI is SVR4. Cannot hurt...
Diffstat (limited to 'c/src/lib/libcpu/powerpc/new-exceptions/cpu.c')
-rw-r--r--c/src/lib/libcpu/powerpc/new-exceptions/cpu.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c b/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c
index c80e1fe1d0..4f1de2114f 100644
--- a/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c
+++ b/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c
@@ -126,9 +126,15 @@ void _CPU_Context_Initialize(
the_context->pc = (uint32_t)entry_point;
#if (PPC_ABI == PPC_ABI_SVR4)
- { unsigned r13 = 0;
- asm volatile ("mr %0, 13" : "=r" ((r13)));
+ /*
+ * SVR4 says R2 is for 'system-reserved' use; it cannot hurt to
+ * propagate R2 to all task contexts.
+ */
+ { uint32_t 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;
}
#elif (PPC_ABI == PPC_ABI_EABI)