Improve NetBSD support: Allow VMA determination with fewer system calls.
[libsigsegv/ericb.git] / src / fault-linux-m68k-old.c
blob8562e30e43892aaf41a4a77f89b2da32c92ebf20
1 /* Fault handler information subroutine. Linux/m68k version.
2 * Taken from gcc-3.2/boehm-gc/os_dep.c.
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.
9 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
10 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
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.
19 static void *
20 get_fault_addr (struct sigcontext *scp)
22 int format = (scp->sc_formatvec >> 12) & 0xf;
23 unsigned long *framedata = (unsigned long *) (scp + 1);
24 unsigned long ea;
26 switch (format)
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;
40 if (framedata[1] & 0x08000000)
41 /* Correct addr on misaligned access. */
42 ea = (ea + 4095) & ~4095;
43 return (void *) ea;