[rtems commit] powerpc: 64-bit _CPU_Context_Initialize() support
Sebastian Huber
sebh at rtems.org
Tue Aug 22 14:52:51 UTC 2017
Module: rtems
Branch: master
Commit: 7837728b13076fce67b67025ad7a02890748c94c
Changeset: http://git.rtems.org/rtems/commit/?id=7837728b13076fce67b67025ad7a02890748c94c
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Thu Aug 10 13:09:22 2017 +0200
powerpc: 64-bit _CPU_Context_Initialize() support
Update #3082.
---
c/src/lib/libcpu/powerpc/new-exceptions/cpu.c | 16 +++++++++-------
c/src/lib/libcpu/powerpc/rtems/powerpc/powerpc.h | 4 ++++
cpukit/score/cpu/powerpc/rtems/score/cpu.h | 4 ++--
3 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c b/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c
index 71dce73..bee5eb2 100644
--- a/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c
+++ b/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c
@@ -55,8 +55,8 @@ void _CPU_Initialize(void)
*/
void _CPU_Context_Initialize(
Context_Control *the_context,
- uint32_t *stack_base,
- uint32_t size,
+ void *stack_base,
+ size_t size,
uint32_t new_level,
void *entry_point,
bool is_fp,
@@ -65,13 +65,15 @@ void _CPU_Context_Initialize(
{
ppc_context *the_ppc_context;
uint32_t msr_value;
- uint32_t sp;
+ uintptr_t sp;
+ uintptr_t stack_alignment;
- sp = (uint32_t)stack_base + size - PPC_MINIMUM_STACK_FRAME_SIZE;
+ sp = (uintptr_t) stack_base + size - PPC_MINIMUM_STACK_FRAME_SIZE;
- sp &= ~(CPU_STACK_ALIGNMENT-1);
+ stack_alignment = CPU_STACK_ALIGNMENT;
+ sp &= ~(stack_alignment - 1);
- *((uint32_t*)sp) = 0;
+ sp = (uintptr_t) memset((void *) sp, 0, PPC_MINIMUM_STACK_FRAME_SIZE);
_CPU_MSR_GET( msr_value );
@@ -117,7 +119,7 @@ void _CPU_Context_Initialize(
the_ppc_context->gpr1 = sp;
the_ppc_context->msr = msr_value;
- the_ppc_context->lr = (uint32_t) entry_point;
+ the_ppc_context->lr = (uintptr_t) entry_point;
the_ppc_context->isr_dispatch_disable = 0;
#if defined(__ALTIVEC__) && !defined(PPC_MULTILIB_ALTIVEC)
diff --git a/c/src/lib/libcpu/powerpc/rtems/powerpc/powerpc.h b/c/src/lib/libcpu/powerpc/rtems/powerpc/powerpc.h
index 8934585..8b2cf1e 100644
--- a/c/src/lib/libcpu/powerpc/rtems/powerpc/powerpc.h
+++ b/c/src/lib/libcpu/powerpc/rtems/powerpc/powerpc.h
@@ -631,7 +631,11 @@ extern "C" {
#define PPC_MSR_DISABLE_MASK (PPC_MSR_ME|PPC_MSR_EE|PPC_MSR_CE)
+#if defined(__powerpc64__)
+#define PPC_MINIMUM_STACK_FRAME_SIZE 32
+#else
#define PPC_MINIMUM_STACK_FRAME_SIZE PPC_STACK_ALIGNMENT
+#endif
#ifdef __cplusplus
}
diff --git a/cpukit/score/cpu/powerpc/rtems/score/cpu.h b/cpukit/score/cpu/powerpc/rtems/score/cpu.h
index fbebbf6..72fc483 100644
--- a/cpukit/score/cpu/powerpc/rtems/score/cpu.h
+++ b/cpukit/score/cpu/powerpc/rtems/score/cpu.h
@@ -818,8 +818,8 @@ static inline CPU_Counter_ticks _CPU_Counter_difference(
void _CPU_Context_Initialize(
Context_Control *the_context,
- uint32_t *stack_base,
- uint32_t size,
+ void *stack_base,
+ size_t size,
uint32_t new_level,
void *entry_point,
bool is_fp,
More information about the vc
mailing list