~ubuntu-branches/ubuntu/maverick/libsigsegv/maverick

« back to all changes in this revision

Viewing changes to src/fault-linux-m68k.c

  • Committer: Bazaar Package Importer
  • Author(s): Will Newton
  • Date: 2003-09-18 17:18:26 UTC
  • Revision ID: james.westby@ubuntu.com-20030918171826-yotjezeu45jmtnkt
Tags: upstream-2.1
ImportĀ upstreamĀ versionĀ 2.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Fault handler information subroutine.  Linux/m68k version.
 
2
 * Taken from gcc-3.2/boehm-gc/os_dep.c.
 
3
 *
 
4
 * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
 
5
 * Copyright (c) 1991-1995 by Xerox Corporation.  All rights reserved.
 
6
 * Copyright (c) 1996-1999 by Silicon Graphics.  All rights reserved.
 
7
 * Copyright (c) 1999 by Hewlett-Packard Company.  All rights reserved.
 
8
 *
 
9
 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
 
10
 * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
 
11
 *
 
12
 * Permission is hereby granted to use or copy this program
 
13
 * for any purpose,  provided the above notices are retained on all copies.
 
14
 * Permission to modify the code and to distribute modified code is granted,
 
15
 * provided the above notices are retained, and a notice that the code was
 
16
 * modified is included with the above copyright notice.
 
17
 */
 
18
 
 
19
static void *
 
20
get_fault_addr (struct sigcontext *scp)
 
21
{
 
22
  int format = (scp->sc_formatvec >> 12) & 0xf;
 
23
  unsigned long *framedata = (unsigned long *) (scp + 1);
 
24
  unsigned long ea;
 
25
 
 
26
  switch (format)
 
27
    {
 
28
    case 10: case 11: /* 68020/030 */
 
29
      ea = framedata[2];
 
30
      return (void *) ea;
 
31
    case 7: /* 68040 */
 
32
      ea = framedata[3];
 
33
      break;
 
34
    case 4: /* 68060 */
 
35
      ea = framedata[0];
 
36
      break;
 
37
    default:
 
38
      return (void *) 0;
 
39
    }
 
40
  if (framedata[1] & 0x08000000)
 
41
    /* Correct addr on misaligned access.  */
 
42
    ea = (ea + 4095) & ~4095;
 
43
  return (void *) ea;
 
44
}