aboutsummaryrefslogtreecommitdiffstats
path: root/libsigsegv/src/fault-netbsd-alpha.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2010-07-16 14:52:31 +0300
committerArnold D. Robbins <arnold@skeeve.com>2010-07-16 14:52:31 +0300
commit3ba50a15ebd976f7a88393e2e45dc14b6478b9a9 (patch)
tree6a6bbe6bed1141051fefe94b2d39eacd4854235a /libsigsegv/src/fault-netbsd-alpha.c
parent6a2caf2157d87b4b582b2494bdd7d6a688dd0b1f (diff)
downloadegawk-3ba50a15ebd976f7a88393e2e45dc14b6478b9a9.tar.gz
egawk-3ba50a15ebd976f7a88393e2e45dc14b6478b9a9.tar.bz2
egawk-3ba50a15ebd976f7a88393e2e45dc14b6478b9a9.zip
Move to gawk-3.1.7.
Diffstat (limited to 'libsigsegv/src/fault-netbsd-alpha.c')
-rw-r--r--libsigsegv/src/fault-netbsd-alpha.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/libsigsegv/src/fault-netbsd-alpha.c b/libsigsegv/src/fault-netbsd-alpha.c
new file mode 100644
index 00000000..6ca67bc1
--- /dev/null
+++ b/libsigsegv/src/fault-netbsd-alpha.c
@@ -0,0 +1,39 @@
+/* Fault handler information subroutine. NetBSD/Alpha version.
+ * Taken from gcc-3.3/boehm-gc/os_dep.c.
+ *
+ * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
+ * Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved.
+ * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
+ * Copyright (c) 1999 by Hewlett-Packard Company. All rights reserved.
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+/* Decodes the machine instruction which was responsible for the sending of the
+ SIGBUS signal. Luckily this is much easier than, say, on the PowerPC. */
+
+static void *
+get_fault_addr (struct sigcontext *scp)
+{
+ unsigned int instr = *((unsigned int *)(scp->sc_pc));
+ unsigned long faultaddr;
+
+ /* Instructions which access memory have operands of the form ARG_MEM or
+ ARG_FMEM, consisting of
+ - a base register specification (PRB) in bits 20..16,
+ - a memory displacement (MDISP) in bits 15..0,
+ - an general register specification (RA) or a floating-point register
+ specification (FA) in bits 25..21.
+ See binutils-2.13.90.0.16/opcodes/alpha-opc.c. */
+
+ faultaddr = scp->sc_regs[(instr >> 16) & 0x1f];
+ faultaddr += (unsigned long) (long) (((int)instr << 16) >> 16);
+ return (void *) faultaddr;
+}