aboutsummaryrefslogtreecommitdiff
path: root/sys/amd64
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2006-08-17 21:26:56 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2006-08-17 21:26:56 +0000
commitbc06fad1cd23533d1d5bcf6e396de6917a83422b (patch)
tree26c990c4d8565b611012186d14e590fd5cfd97be /sys/amd64
parent46811cc287c3b5a754f9b40f47207e20d760452c (diff)
Notes
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/gdb_machdep.c24
-rw-r--r--sys/amd64/include/gdb_machdep.h9
2 files changed, 26 insertions, 7 deletions
diff --git a/sys/amd64/amd64/gdb_machdep.c b/sys/amd64/amd64/gdb_machdep.c
index 6a50d7d857ab..5775c8f21578 100644
--- a/sys/amd64/amd64/gdb_machdep.c
+++ b/sys/amd64/amd64/gdb_machdep.c
@@ -91,3 +91,27 @@ gdb_cpu_setreg(int regnum, void *val)
kdb_frame->tf_rip = *(register_t *)val;
}
}
+
+int
+gdb_cpu_signal(int type, int code)
+{
+
+ switch (type & ~T_USER) {
+ case 0: return (SIGFPE); /* Divide by zero. */
+ case 1: return (SIGTRAP); /* Debug exception. */
+ case 3: return (SIGTRAP); /* Breakpoint. */
+ case 4: return (SIGSEGV); /* into instr. (overflow). */
+ case 5: return (SIGURG); /* bound instruction. */
+ case 6: return (SIGILL); /* Invalid opcode. */
+ case 7: return (SIGFPE); /* Coprocessor not present. */
+ case 8: return (SIGEMT); /* Double fault. */
+ case 9: return (SIGSEGV); /* Coprocessor segment overrun. */
+ case 10: return (SIGTRAP); /* Invalid TSS (also single-step). */
+ case 11: return (SIGSEGV); /* Segment not present. */
+ case 12: return (SIGSEGV); /* Stack exception. */
+ case 13: return (SIGSEGV); /* General protection. */
+ case 14: return (SIGSEGV); /* Page fault. */
+ case 16: return (SIGEMT); /* Coprocessor error. */
+ }
+ return (SIGEMT);
+}
diff --git a/sys/amd64/include/gdb_machdep.h b/sys/amd64/include/gdb_machdep.h
index a914b9ba2d3c..d007eef40526 100644
--- a/sys/amd64/include/gdb_machdep.h
+++ b/sys/amd64/include/gdb_machdep.h
@@ -31,7 +31,7 @@
#define GDB_BUFSZ 500
#define GDB_NREGS 56
-#define GDB_REG_PC 18
+#define GDB_REG_PC 16
static __inline size_t
gdb_cpu_regsz(int regnum)
@@ -40,12 +40,6 @@ gdb_cpu_regsz(int regnum)
}
static __inline int
-gdb_cpu_signal(int type, int code __unused)
-{
- return (type);
-}
-
-static __inline int
gdb_cpu_query(void)
{
return (0);
@@ -53,5 +47,6 @@ gdb_cpu_query(void)
void *gdb_cpu_getreg(int, size_t *);
void gdb_cpu_setreg(int, void *);
+int gdb_cpu_signal(int, int);
#endif /* !_MACHINE_GDB_MACHDEP_H_ */