summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-08-10 13:09:22 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-08-22 14:19:00 +0200
commit7837728b13076fce67b67025ad7a02890748c94c (patch)
treeda6e613a9b93d446de8cccb5742c5cdea040a42a
parentpowerpc: 64-bit support for CPU_SIZEOF_POINTER (diff)
downloadrtems-7837728b13076fce67b67025ad7a02890748c94c.tar.bz2
powerpc: 64-bit _CPU_Context_Initialize() support
Update #3082.
-rw-r--r--c/src/lib/libcpu/powerpc/new-exceptions/cpu.c16
-rw-r--r--c/src/lib/libcpu/powerpc/rtems/powerpc/powerpc.h4
-rw-r--r--cpukit/score/cpu/powerpc/rtems/score/cpu.h4
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 71dce73eab..bee5eb2091 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 8934585a92..8b2cf1e371 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 fbebbf643e..72fc48318f 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,