diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-05-18 15:47:23 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-06-04 09:54:31 +0200 |
commit | 1869bb7101de25205f325287419aaa25a13143c7 (patch) | |
tree | 99dd5d871ed47673a9e95a9ba5f8d5ff791e31a3 /c/src/lib/libcpu/powerpc/new-exceptions/cpu.c | |
parent | Fix C files which had two semi-colons at EOL (diff) | |
download | rtems-1869bb7101de25205f325287419aaa25a13143c7.tar.bz2 |
powerpc: Simplify context switch
PowerPC cores with the SPE (Signal Processing Extension) have 64-bit
general-purpose registers. The SPE context switch code has been merged
with the standard context switch code. The context switch may use cache
operations to increase the performance. It will be ensured that the
context is 32-byte aligned (PPC_DEFAULT_CACHE_LINE_SIZE). This
increases the overall memory size of the context area in the thread
control block slightly. The general-purpose registers GPR2 and GPR13
are no longer part of the context. The BSP must initialize these
registers during startup (usually initialized by the __eabi() function).
The new BSP option BSP_USE_DATA_CACHE_BLOCK_TOUCH can be used to enable
the dcbt instruction in the context switch.
The new BSP option BSP_USE_SYNC_IN_CONTEXT_SWITCH can be used to enable
sync and isync instructions in the context switch. This should be not
necessary in most cases.
Diffstat (limited to 'c/src/lib/libcpu/powerpc/new-exceptions/cpu.c')
-rw-r--r-- | c/src/lib/libcpu/powerpc/new-exceptions/cpu.c | 34 |
1 files changed, 5 insertions, 29 deletions
diff --git a/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c b/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c index 1a346091eb..5c0f8d11cb 100644 --- a/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c +++ b/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c @@ -65,6 +65,7 @@ void _CPU_Context_Initialize( bool is_fp ) { + ppc_context *the_ppc_context; uint32_t msr_value; uint32_t sp; @@ -122,35 +123,10 @@ void _CPU_Context_Initialize( memset( the_context, 0, sizeof( *the_context ) ); - PPC_CONTEXT_SET_SP( the_context, sp ); - PPC_CONTEXT_SET_PC( the_context, (uint32_t) entry_point ); - PPC_CONTEXT_SET_MSR( the_context, msr_value ); - -#ifndef __SPE__ -#if (PPC_ABI == PPC_ABI_SVR4) - /* - * 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) - { 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; - } -#else -#error unsupported PPC_ABI -#endif -#endif /* __SPE__ */ + the_ppc_context = ppc_get_context( the_context ); + the_ppc_context->gpr1 = sp; + the_ppc_context->msr = msr_value; + the_ppc_context->lr = (uint32_t) entry_point; #ifdef __ALTIVEC__ _CPU_Context_initialize_altivec(the_context); |