From d14e4924c55e3016d1ddf7a38a7e93460ca10ac8 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Mon, 4 Feb 2013 10:38:16 +0100 Subject: Add x86 hardware debugging register support This adds using the x86 hardware debugging registers, either from the kernel through db_set_hw_watchpoint, or from userland through i386_DEBUG_STATE. While the kernel is using the registers, the userland values are ignored. * i386/i386/db_interface.c (kernel_dr, ids): New variables. (db_load_context, db_get_debug_state, db_set_debug_state, db_dr, db_set_hw_watchpoint): New functions. (kdb_trap): Use get_dr* instead of dr_addr[]. * i386/i386/db_interface.h (db_user_to_kernel_address, db_set_hw_watchpoint) (db_dr, db_get_debug_state, db_set_debug_state, db_load_context): Add functions prototypes. (dr0, dr1, dr2, dr3): Remove functions prototypes. * i386/i386/locore.S (dr6, dr0, dr1, dr2, dr3): Remove functions. (dr_msk, dr_addr): Remove variables. * i386/include/mach/i386/thread_status.h (i386_DEBUG_STATE): Add macro. (i386_debug_state): Add structure. (i386_DEBUG_STATE_COUNT): Add macro. * i386/i386/thread.h: Include . (i386_machine_state): Add `struct i386_debug_state ids' field. * i386/i386/pcb.c: Include . (switch_ktss): Call db_load_context. (thread_setstatus, thread_getstatus): Add I386_DEBUG_STATE case. * i386/i386/proc_reg.h (get_dr0, set_dr0, get_dr1, set_dr1, get_dr2, set_dr2, get_dr3, set_dr3, get_dr6, set_dr6, get_dr7, set_dr7): Add macros. --- i386/include/mach/i386/thread_status.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'i386/include') diff --git a/i386/include/mach/i386/thread_status.h b/i386/include/mach/i386/thread_status.h index 5f20355..ba1e3de 100644 --- a/i386/include/mach/i386/thread_status.h +++ b/i386/include/mach/i386/thread_status.h @@ -56,6 +56,7 @@ #define i386_ISA_PORT_MAP_STATE 3 #define i386_V86_ASSIST_STATE 4 #define i386_REGS_SEGS_STATE 5 +#define i386_DEBUG_STATE 6 /* * This structure is used for both @@ -144,4 +145,10 @@ struct v86_interrupt_table { #define i386_V86_ASSIST_STATE_COUNT \ (sizeof(struct i386_v86_assist_state)/sizeof(unsigned int)) +struct i386_debug_state { + unsigned int dr[8]; +}; +#define i386_DEBUG_STATE_COUNT \ + (sizeof(struct i386_debug_state)/sizeof(unsigned int)) + #endif /* _MACH_I386_THREAD_STATUS_H_ */ -- cgit v1.2.3