summaryrefslogtreecommitdiffstats
path: root/cpukit/score/cpu/or1k/or1k-context-initialize.c
diff options
context:
space:
mode:
authorHesham ALMatary <heshamelmatary@gmail.com>2014-08-12 10:57:42 -0500
committerJoel Sherrill <joel.sherrill@oarcorp.com>2014-08-12 13:40:45 -0500
commit94d45f6ffe22c640566ddc4432adcb97ab6c907f (patch)
treeb942d29910c969239427a139bc6f5ff50efe6edc /cpukit/score/cpu/or1k/or1k-context-initialize.c
parentbsp/lpc24xx: Add LPC40XX variants (diff)
downloadrtems-94d45f6ffe22c640566ddc4432adcb97ab6c907f.tar.bz2
Add support for OpenRISC - Fixed issues
This work is based on the old or32 port (that has been removed back in 2005) authored by Chris Ziomkowski. The patch includes the basic functions every port should implement like: context switch, exception handling, OpenRISC ABI and machine definitions and configurations.
Diffstat (limited to 'cpukit/score/cpu/or1k/or1k-context-initialize.c')
-rw-r--r--cpukit/score/cpu/or1k/or1k-context-initialize.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/cpukit/score/cpu/or1k/or1k-context-initialize.c b/cpukit/score/cpu/or1k/or1k-context-initialize.c
new file mode 100644
index 0000000000..7ac2875ce7
--- /dev/null
+++ b/cpukit/score/cpu/or1k/or1k-context-initialize.c
@@ -0,0 +1,43 @@
+/*
+ * COPYRIGHT (c) 2014 Hesham ALMatary <heshamelmatary@gmail.com>
+ *
+ * COPYRIGHT (c) 1989-2006
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include <string.h>
+
+#include <rtems/score/cpu.h>
+#include <rtems/score/interr.h>
+#include <rtems/score/or1k-utility.h>
+
+void _CPU_Context_Initialize(
+ Context_Control *context,
+ void *stack_area_begin,
+ size_t stack_area_size,
+ uint32_t new_level,
+ void (*entry_point)( void ),
+ bool is_fp,
+ void *tls_area
+)
+{
+ uint32_t stack = (uint32_t) stack_area_begin;
+ uint32_t sr;
+
+ sr = _OR1K_mfspr(CPU_OR1K_SPR_SR);
+
+ memset(context, 0, sizeof(*context));
+
+ context->r1 = stack;
+ context->r2 = stack;
+ context->r9 = (uint32_t) entry_point;
+ context->sr = sr;
+}