summaryrefslogtreecommitdiffstats
path: root/cpukit/score/cpu/or1k/or1k-context-initialize.c
diff options
context:
space:
mode:
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;
+}