iPXE
|
GDB architecture-specific bits for x86. More...
#include <stddef.h>
#include <stdio.h>
#include <errno.h>
#include <assert.h>
#include <ipxe/uaccess.h>
#include <ipxe/gdbstub.h>
#include <librm.h>
Go to the source code of this file.
Macros | |
#define | NUM_HWBP 4 |
Number of hardware breakpoints. More... | |
#define | DR7_G(bp) ( 2 << ( 2 * (bp) ) ) |
Debug register 7: Global breakpoint enable. More... | |
#define | DR7_GE ( 1 << 9 ) |
Debug register 7: Global exact breakpoint enable. More... | |
#define | DR7_RWLEN_WRITE 0x11110000 |
Debug register 7: Break on data writes. More... | |
#define | DR7_RWLEN_ACCESS 0x33330000 |
Debug register 7: Break on data access. More... | |
#define | DR7_RWLEN_1 0x00000000 |
Debug register 7: One-byte length. More... | |
#define | DR7_RWLEN_2 0x44440000 |
Debug register 7: Two-byte length. More... | |
#define | DR7_RWLEN_4 0xcccc0000 |
Debug register 7: Four-byte length. More... | |
#define | DR7_RWLEN_8 0x88880000 |
Debug register 7: Eight-byte length. More... | |
#define | DR7_RWLEN_MASK(bp) ( 0xf0000 << ( 4 * (bp) ) ) |
Debug register 7: Breakpoint R/W and length mask. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static void | gdbmach_update (void) |
Update debug registers. More... | |
static int | gdbmach_find (unsigned long addr, unsigned int rwlen) |
Find reusable or available hardware breakpoint. More... | |
int | gdbmach_set_breakpoint (int type, unsigned long addr, size_t len, int enable) |
Set hardware breakpoint. More... | |
__asmcall void | gdbmach_handler (int signo, gdbreg_t *regs) |
Handle exception. More... | |
void | gdbmach_init (void) |
Initialise GDB. More... | |
Variables | |
static unsigned long | dr [NUM_HWBP] |
Hardware breakpoint addresses (debug registers 0-3) More... | |
static unsigned long | dr7 = DR7_GE |
Active value of debug register 7. More... | |
static void * | gdbmach_vectors [] |
CPU exception vectors. More... | |
GDB architecture-specific bits for x86.
Definition in file gdbmach.c.
#define DR7_GE ( 1 << 9 ) |
#define DR7_RWLEN_WRITE 0x11110000 |
#define DR7_RWLEN_ACCESS 0x33330000 |
#define DR7_RWLEN_1 0x00000000 |
#define DR7_RWLEN_2 0x44440000 |
#define DR7_RWLEN_4 0xcccc0000 |
#define DR7_RWLEN_8 0x88880000 |
#define DR7_RWLEN_MASK | ( | bp | ) | ( 0xf0000 << ( 4 * (bp) ) ) |
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Update debug registers.
Definition at line 81 of file gdbmach.c.
References __asm__(), __volatile__(), dr, and dr7.
Referenced by gdbmach_set_breakpoint().
|
static |
Find reusable or available hardware breakpoint.
addr | Linear address |
rwlen | Control bits |
bp | Hardware breakpoint, or negative error |
Definition at line 98 of file gdbmach.c.
References addr, bp, dr, dr7, DR7_G, DR7_RWLEN_MASK, ENOENT, and NUM_HWBP.
Referenced by gdbmach_set_breakpoint().
int gdbmach_set_breakpoint | ( | int | type, |
unsigned long | addr, | ||
size_t | len, | ||
int | enable | ||
) |
Set hardware breakpoint.
type | GDB breakpoint type |
addr | Virtual address |
len | Length |
enable | Enable (not disable) breakpoint |
rc | Return status code |
Definition at line 133 of file gdbmach.c.
References addr, bp, DBGC, dr, dr7, DR7_G, DR7_RWLEN_1, DR7_RWLEN_2, DR7_RWLEN_4, DR7_RWLEN_8, DR7_RWLEN_ACCESS, DR7_RWLEN_MASK, DR7_RWLEN_WRITE, ENOBUFS, ENOTSUP, GDBMACH_AWATCH, gdbmach_find(), gdbmach_update(), GDBMACH_WATCH, len, type, and virt_to_phys().
Referenced by gdbstub_breakpoint().
Handle exception.
signo | GDB signal number |
regs | Register dump |
Definition at line 201 of file gdbmach.c.
References __asm__(), __volatile__(), DBGC, DBGC2_HDA, dr, dr7, DR7_GE, GDBMACH_NREGS, gdbstub_handler(), and regs.
void gdbmach_init | ( | void | ) |
Initialise GDB.
Definition at line 241 of file gdbmach.c.
References gdbmach_vectors, and set_interrupt_vector().
Referenced by gdbstub_start().
|
static |
Hardware breakpoint addresses (debug registers 0-3)
Definition at line 72 of file gdbmach.c.
Referenced by gdbmach_find(), gdbmach_handler(), gdbmach_set_breakpoint(), and gdbmach_update().
|
static |
Active value of debug register 7.
Definition at line 75 of file gdbmach.c.
Referenced by gdbmach_find(), gdbmach_handler(), gdbmach_set_breakpoint(), and gdbmach_update().
|
static |
CPU exception vectors.
Note that we cannot intercept anything from INT8 (double fault) upwards, since these overlap by default with IRQ0-7.
Definition at line 228 of file gdbmach.c.
Referenced by gdbmach_init().