45 #define DR7_G( bp ) ( 2 << ( 2 * (bp) ) ) 48 #define DR7_GE ( 1 << 9 ) 51 #define DR7_RWLEN_WRITE 0x11110000 54 #define DR7_RWLEN_ACCESS 0x33330000 57 #define DR7_RWLEN_1 0x00000000 60 #define DR7_RWLEN_2 0x44440000 63 #define DR7_RWLEN_4 0xcccc0000 66 #define DR7_RWLEN_8 0x88880000 69 #define DR7_RWLEN_MASK( bp ) ( 0xf0000 << ( 4 * (bp) ) ) 103 for ( i = 0 ; i <
NUM_HWBP ; i++ ) {
176 return ( enable ? -
ENOBUFS : 0 );
179 DBGC ( &
dr[0],
"GDB bp %d at %p+%zx type %d (%sabled)\n",
180 bp, ( (
void * )
addr ),
len,
type, ( enable ?
"en" :
"dis" ) );
183 dr7 = ( (
dr7 & ~mask ) | ( rwlen & mask ) );
202 unsigned long dr7_disabled =
DR7_GE;
203 unsigned long dr6_clear = 0;
209 DBGC ( &
dr[0],
"GDB signal %d\n", signo );
212 DBGC ( &
dr[0],
"GDB signal %d returning\n", signo );
#define DR7_RWLEN_MASK(bp)
Debug register 7: Breakpoint R/W and length mask.
uint32_t type
Operating system type.
#define ENOENT
No such file or directory.
int gdbmach_set_breakpoint(int type, unsigned long addr, size_t len, int enable)
Set hardware breakpoint.
void gdbmach_init(void)
Initialise GDB.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
static __always_inline unsigned long virt_to_phys(volatile const void *addr)
Convert virtual address to a physical address.
Access to external ("user") memory.
#define DR7_RWLEN_1
Debug register 7: One-byte length.
#define DR7_GE
Debug register 7: Global exact breakpoint enable.
#define ENOTSUP
Operation not supported.
static int gdbmach_find(unsigned long addr, unsigned int rwlen)
Find reusable or available hardware breakpoint.
#define __asmcall
Declare a function with standard calling conventions.
#define NUM_HWBP
Number of hardware breakpoints.
__asmcall void gdbmach_handler(int signo, gdbreg_t *regs)
Handle exception.
#define DR7_RWLEN_ACCESS
Debug register 7: Break on data access.
__asm__ __volatile__("call *%9" :"=a"(result), "=c"(discard_ecx), "=d"(discard_edx) :"d"(0), "a"(code), "b"(0), "c"(in_phys), "D"(0), "S"(out_phys), "m"(hypercall))
void gdbstub_handler(int signo, gdbreg_t *regs)
Interrupt handler.
void gdbmach_sigstkflt(void)
static unsigned long dr[NUM_HWBP]
Hardware breakpoint addresses (debug registers 0-3)
void gdbmach_sigfpe(void)
void gdbmach_sigtrap(void)
#define DR7_RWLEN_2
Debug register 7: Two-byte length.
static void * gdbmach_vectors[]
CPU exception vectors.
__asm__(".section \".rodata\", \"a\", " PROGBITS "\n\t" "\nprivate_key_data:\n\t" ".size private_key_data, ( . - private_key_data )\n\t" ".equ private_key_len, ( . - private_key_data )\n\t" ".previous\n\t")
#define DR7_G(bp)
Debug register 7: Global breakpoint enable.
static void gdbmach_update(void)
Update debug registers.
#define ENOBUFS
No buffer space available.
void set_interrupt_vector(unsigned int intr, void *vector)
Set interrupt vector.
void gdbmach_sigill(void)
static unsigned long dr7
Active value of debug register 7.
#define DR7_RWLEN_8
Debug register 7: Eight-byte length.
#define NULL
NULL pointer (VOID *)
#define DR7_RWLEN_WRITE
Debug register 7: Break on data writes.
#define DR7_RWLEN_4
Debug register 7: Four-byte length.