source: rtems/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_alignment.c @ 88dcb841

4.115
Last change on this file since 88dcb841 was 88dcb841, checked in by Sebastian Huber <sebastian.huber@…>, on 06/07/11 at 13:58:23

2011-06-07 Sebastian Huber <sebastian.huber@…>

  • new-exceptions/bspsupport/ppc_exc_alignment.c: New file.
  • Makefile.am: Reflect change above.
  • new-exceptions/bspsupport/vectors.h: Declare ppc_exc_alignment_handler().
  • Property mode set to 100644
File size: 1.1 KB
Line 
1/*
2 * Copyright (c) 2011 embedded brains GmbH.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Obere Lagerstr. 30
6 *  82178 Puchheim
7 *  Germany
8 *  <rtems@embedded-brains.de>
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.com/license/LICENSE.
13 *
14 * $Id$
15 */
16
17#include <rtems.h>
18#include <bsp/vectors.h>
19
20int ppc_exc_alignment_handler(BSP_Exception_frame *frame, unsigned excNum)
21{
22  unsigned opcode = *(unsigned *) frame->EXC_SRR0;
23
24  /* Do we have a dcbz instruction? */
25  if ((opcode & 0xffe007ff) == 0x7c0007ec) {
26    unsigned clsz = (unsigned) rtems_cache_get_data_line_size();
27    unsigned a = (opcode >> 16) & 0x1f;
28    unsigned b = (opcode >> 11) & 0x1f;
29    unsigned *regs = &frame->GPR0;
30    unsigned *current = (unsigned *)
31      (((a == 0 ? 0 : regs [a]) + regs [b]) & (clsz - 1));
32    unsigned *end = current + clsz / 4;
33
34    while (current != end) {
35      *current = 0;
36      ++current;
37    }
38
39    frame->EXC_SRR0 += 4;
40
41    return 0;
42  } else {
43    return -1;
44  }
45}
Note: See TracBrowser for help on using the repository browser.