summaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2011-06-07 13:58:23 +0000
committerSebastian Huber <sebastian.huber@embedded-brains.de>2011-06-07 13:58:23 +0000
commit88dcb841e7624156169d2e1f5dbd0d4a9cbfa228 (patch)
treeb7411ba6c01e0e17540543ff2d0dbe10a71ea547 /c
parent2011-06-07 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff)
downloadrtems-88dcb841e7624156169d2e1f5dbd0d4a9cbfa228.tar.bz2
2011-06-07 Sebastian Huber <sebastian.huber@embedded-brains.de>
* new-exceptions/bspsupport/ppc_exc_alignment.c: New file. * Makefile.am: Reflect change above. * new-exceptions/bspsupport/vectors.h: Declare ppc_exc_alignment_handler().
Diffstat (limited to 'c')
-rw-r--r--c/src/lib/libcpu/powerpc/ChangeLog7
-rw-r--r--c/src/lib/libcpu/powerpc/Makefile.am1
-rw-r--r--c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_alignment.c45
-rw-r--r--c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/vectors.h8
4 files changed, 61 insertions, 0 deletions
diff --git a/c/src/lib/libcpu/powerpc/ChangeLog b/c/src/lib/libcpu/powerpc/ChangeLog
index f500392c5d..085f442154 100644
--- a/c/src/lib/libcpu/powerpc/ChangeLog
+++ b/c/src/lib/libcpu/powerpc/ChangeLog
@@ -1,5 +1,12 @@
2011-06-07 Sebastian Huber <sebastian.huber@embedded-brains.de>
+ * new-exceptions/bspsupport/ppc_exc_alignment.c: New file.
+ * Makefile.am: Reflect change above.
+ * new-exceptions/bspsupport/vectors.h: Declare
+ ppc_exc_alignment_handler().
+
+2011-06-07 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
* new-exceptions/cpu_asm.S: Use BSP_DATA_CACHE_ENABLED instead of
PPC_USE_DATA_CACHE.
diff --git a/c/src/lib/libcpu/powerpc/Makefile.am b/c/src/lib/libcpu/powerpc/Makefile.am
index 5c562a62e6..b8ef2d354d 100644
--- a/c/src/lib/libcpu/powerpc/Makefile.am
+++ b/c/src/lib/libcpu/powerpc/Makefile.am
@@ -41,6 +41,7 @@ new_exceptions_exc_bspsupport_rel_SOURCES = \
new-exceptions/bspsupport/ppc_exc_global_handler.c \
new-exceptions/bspsupport/ppc_exc_categories.c \
new-exceptions/bspsupport/ppc_exc_address.c \
+ new-exceptions/bspsupport/ppc_exc_alignment.c \
new-exceptions/bspsupport/ppc_exc_prologue.c
new_exceptions_exc_bspsupport_rel_CPPFLAGS = $(AM_CPPFLAGS)
diff --git a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_alignment.c b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_alignment.c
new file mode 100644
index 0000000000..781fd3a8e9
--- /dev/null
+++ b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_alignment.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2011 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp/vectors.h>
+
+int ppc_exc_alignment_handler(BSP_Exception_frame *frame, unsigned excNum)
+{
+ unsigned opcode = *(unsigned *) frame->EXC_SRR0;
+
+ /* Do we have a dcbz instruction? */
+ if ((opcode & 0xffe007ff) == 0x7c0007ec) {
+ unsigned clsz = (unsigned) rtems_cache_get_data_line_size();
+ unsigned a = (opcode >> 16) & 0x1f;
+ unsigned b = (opcode >> 11) & 0x1f;
+ unsigned *regs = &frame->GPR0;
+ unsigned *current = (unsigned *)
+ (((a == 0 ? 0 : regs [a]) + regs [b]) & (clsz - 1));
+ unsigned *end = current + clsz / 4;
+
+ while (current != end) {
+ *current = 0;
+ ++current;
+ }
+
+ frame->EXC_SRR0 += 4;
+
+ return 0;
+ } else {
+ return -1;
+ }
+}
diff --git a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/vectors.h b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/vectors.h
index 7eace74ed5..adaccb56cb 100644
--- a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/vectors.h
+++ b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/vectors.h
@@ -509,6 +509,14 @@ extern uint32_t (*ppc_exc_get_DAR)(void);
void
ppc_exc_wrapup(BSP_Exception_frame *f);
+/**
+ * @brief Standard aligment handler.
+ *
+ * @retval 0 Performed a dcbz instruction.
+ * @retval -1 Otherwise.
+ */
+int ppc_exc_alignment_handler(BSP_Exception_frame *frame, unsigned excNum);
+
/** @} */
/*