Changeset View
Changeset View
Standalone View
Standalone View
sys/i386/i386/gdb_machdep.c
Show All 30 Lines | |||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/kdb.h> | #include <sys/kdb.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/proc.h> | #include <sys/proc.h> | ||||
#include <sys/signal.h> | #include <sys/signal.h> | ||||
#include <machine/endian.h> | |||||
#include <machine/frame.h> | |||||
#include <machine/gdb_machdep.h> | #include <machine/gdb_machdep.h> | ||||
#include <machine/pcb.h> | #include <machine/pcb.h> | ||||
#include <machine/reg.h> | |||||
#include <machine/trap.h> | #include <machine/trap.h> | ||||
#include <machine/frame.h> | |||||
#include <machine/endian.h> | |||||
#include <gdb/gdb.h> | #include <gdb/gdb.h> | ||||
#include <gdb/gdb_int.h> | |||||
void * | void * | ||||
gdb_cpu_getreg(int regnum, size_t *regsz) | gdb_cpu_getreg(int regnum, size_t *regsz) | ||||
{ | { | ||||
static uint32_t _kcodesel = GSEL(GCODE_SEL, SEL_KPL); | static uint32_t _kcodesel = GSEL(GCODE_SEL, SEL_KPL); | ||||
static uint32_t _kdatasel = GSEL(GDATA_SEL, SEL_KPL); | static uint32_t _kdatasel = GSEL(GDATA_SEL, SEL_KPL); | ||||
static uint32_t _kprivsel = GSEL(GPRIV_SEL, SEL_KPL); | static uint32_t _kprivsel = GSEL(GPRIV_SEL, SEL_KPL); | ||||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | gdb_cpu_signal(int type, int code) | ||||
case T_NMI: return (SIGTRAP); | case T_NMI: return (SIGTRAP); | ||||
case T_FPOPFLT: return (SIGILL); | case T_FPOPFLT: return (SIGILL); | ||||
case T_TSSFLT: return (SIGSEGV); | case T_TSSFLT: return (SIGSEGV); | ||||
case T_SEGNPFLT: return (SIGSEGV); | case T_SEGNPFLT: return (SIGSEGV); | ||||
case T_STKFLT: return (SIGSEGV); | case T_STKFLT: return (SIGSEGV); | ||||
case T_XMMFLT: return (SIGFPE); | case T_XMMFLT: return (SIGFPE); | ||||
} | } | ||||
return (SIGEMT); | return (SIGEMT); | ||||
} | |||||
void | |||||
gdb_cpu_stop_reason(int type, int code) | |||||
cem: Would this make sense in a x86/gdb_machdep? It looks identical to amd64. | |||||
Done Inline ActionsNormally yes, but I don't think it's worth introducing a new file for this one function. I'd be more tempted just to leave it unimplemented on i386 if that feels better than duplicating. mhorne: Normally yes, but I don't think it's worth introducing a new file for this one function. I'd be… | |||||
{ | |||||
uintmax_t val; | |||||
val = 0; | |||||
if (type == T_TRCTRAP) { | |||||
/* NB: 'code' contains the value of dr6 at the trap. */ | |||||
if ((code & DBREG_DR6_B(0)) != 0) { | |||||
val = rdr0(); | |||||
} | |||||
if ((code & DBREG_DR6_B(1)) != 0) { | |||||
val = rdr1(); | |||||
} | |||||
if ((code & DBREG_DR6_B(2)) != 0) { | |||||
val = rdr2(); | |||||
} | |||||
if ((code & DBREG_DR6_B(3)) != 0) { | |||||
val = rdr3(); | |||||
} | |||||
/* | |||||
* TODO: validate the bits in DR7 to differentiate between a | |||||
* watchpoint trap and a hardware breakpoint trap (currently | |||||
* unsupported). | |||||
*/ | |||||
if (val != 0) { | |||||
gdb_tx_str("watch:"); | |||||
gdb_tx_varhex(val); | |||||
gdb_tx_char(';'); | |||||
} | |||||
} | |||||
} | } |
Would this make sense in a x86/gdb_machdep? It looks identical to amd64.