42 uint32_t op1, uint32_t op2, uint32_t crn, uint32_t crm,
54 cpnum, op1, crn, crm, op2);
66 uint32_t
op, uint32_t crm, uint64_t *value)
89 uint32_t op1, uint32_t op2, uint32_t crn, uint32_t crm,
101 cpnum, op1, crn, crm, op2);
113 uint32_t
op, uint32_t crm, uint64_t value)
171 uint32_t value_r0, value_r1;
200 r->
name, value_r0, value_r1);
305 r->
name, value_r0, value_r1);
391 for (
unsigned int i = 0; i < 2; i++) {
409 for (
unsigned int i = 2; i < 16; i++) {
451 xp->
dirty = disable =
false;
457 xp->
dirty = disable =
true;
469 disable ?
"disable" :
"enable",
470 (xp->
number < 16) ?
"break" :
"watch",
505 for (
unsigned int i = 0; i < dpm->
nbp; i++) {
517 for (
unsigned int i = 0; i < dpm->
nwp; i++) {
542 for (
unsigned int i = 2; i < cache->
num_regs; i++) {
629 for (
unsigned int i = 0; i < 2; i++) {
797 for (
unsigned int i = 0; i < cache->
num_regs; i++) {
827 (r->
num == 16) ? 17 : r->
num);
872 control |= (1 << (
addr & 3)) << 5;
877 control |= (3 << (
addr & 2)) << 5;
925 for (
unsigned int i = 0; i < dpm->
nbp; i++) {
926 if (!dpm->
dbp[i].
bp) {
944 for (
unsigned int i = 0; i < dpm->
nbp; i++) {
945 if (dpm->
dbp[i].
bp == bp) {
1001 for (
unsigned int i = 0; i < dpm->
nwp; i++) {
1002 if (!dpm->
dwp[i].
wp) {
1018 for (
unsigned int i = 0; i < dpm->
nwp; i++) {
1019 if (dpm->
dwp[i].
wp == wp) {
1135 dpm->
nbp = 1 + ((dpm->
didr >> 24) & 0xf);
1136 dpm->
nwp = 1 + ((dpm->
didr >> 28) & 0xf);
1137 dpm->
dbp = calloc(dpm->
nbp,
sizeof(*dpm->
dbp));
1138 dpm->
dwp = calloc(dpm->
nwp,
sizeof(*dpm->
dwp));
1140 if (!dpm->
dbp || !dpm->
dwp) {
1167 for (i = 0; i < dpm->
nbp; i++) {
1171 for (i = 0; i < dpm->
nwp; i++) {
Holds the interface to ARM cores.
struct reg * arm_reg_current(struct arm *arm, unsigned int regnum)
Returns handle to the register currently mapped to a given number.
struct reg_cache * arm_build_reg_cache(struct target *target, struct arm *arm)
arm_mode
Represent state of an ARM core.
void arm_free_reg_cache(struct arm *arm)
static struct arm * target_to_arm(const struct target *target)
Convert target handle to generic ARM target state handle.
void arm_set_cpsr(struct arm *arm, uint32_t cpsr)
Configures host-side ARM records to reflect the specified CPSR.
void arm_dpm_report_dscr(struct arm_dpm *dpm, uint32_t dscr)
int arm_dpm_read_current_registers(struct arm_dpm *dpm)
Read basic registers of the current context: R0 to R15, and CPSR; sets the core mode (such as USR or ...
int arm_dpm_modeswitch(struct arm_dpm *dpm, enum arm_mode mode)
static enum arm_mode dpm_mapmode(struct arm *arm, unsigned int num, enum arm_mode mode)
static int dpm_write_pc_core_state(struct arm_dpm *dpm, struct reg *r)
Write to program counter and switch the core state (arm/thumb) according to the address.
int arm_dpm_setup(struct arm_dpm *dpm)
Hooks up this DPM to its associated target; call only once.
static int arm_dpm_full_context(struct target *target)
static int dpm_remove_watchpoint(struct target *target, struct watchpoint *wp)
static int dpm_maybe_update_bpwp(struct arm_dpm *dpm, bool bpwp, struct dpm_bpwp *xp, bool *set_p)
int arm_dpm_read_reg(struct arm_dpm *dpm, struct reg *r, unsigned int regnum)
int arm_dpm_write_dirty_registers(struct arm_dpm *dpm, bool bpwp)
Writes all modified core registers for all processor modes.
static int dpm_mcr(struct target *target, int cpnum, uint32_t op1, uint32_t op2, uint32_t crn, uint32_t crm, uint32_t value)
static int dpm_write_reg_u64(struct arm_dpm *dpm, struct reg *r, unsigned int regnum)
static int dpm_write_reg(struct arm_dpm *dpm, struct reg *r, unsigned int regnum)
void arm_dpm_report_wfar(struct arm_dpm *dpm, uint32_t addr)
static int arm_dpm_write_core_reg(struct target *target, struct reg *r, int regnum, enum arm_mode mode, uint8_t *value)
static int dpm_mrrc(struct target *target, int cpnum, uint32_t op, uint32_t crm, uint64_t *value)
static int dpm_mrc(struct target *target, int cpnum, uint32_t op1, uint32_t op2, uint32_t crn, uint32_t crm, uint32_t *value)
static int dpm_mcrr(struct target *target, int cpnum, uint32_t op, uint32_t crm, uint64_t value)
static int arm_dpm_read_core_reg(struct target *target, struct reg *r, int regnum, enum arm_mode mode)
static int dpm_bpwp_setup(struct arm_dpm *dpm, struct dpm_bpwp *xp, uint32_t addr, uint32_t length)
static int dpm_watchpoint_setup(struct arm_dpm *dpm, unsigned int index_t, struct watchpoint *wp)
static int dpm_add_watchpoint(struct target *target, struct watchpoint *wp)
static int dpm_read_reg_u64(struct arm_dpm *dpm, struct reg *r, unsigned int regnum)
static int dpm_remove_breakpoint(struct target *target, struct breakpoint *bp)
int arm_dpm_initialize(struct arm_dpm *dpm)
Reinitializes DPM state at the beginning of a new debug session or after a reset which may have affec...
static int dpm_add_breakpoint(struct target *target, struct breakpoint *bp)
This is the interface to the Debug Programmers Model for ARMv6 and ARMv7 processors.
#define DSCR_ENTRY_BKPT_INSTR
#define DSCR_ENTRY_IMPRECISE_WATCHPT
#define DSCR_ENTRY_PRECISE_WATCHPT
#define DSCR_ENTRY_EXT_DBG_REQ
#define DSCR_ENTRY_BREAKPOINT
#define DSCR_ENTRY_HALT_REQ
Macros used to generate various ARM or Thumb opcodes.
#define ARMV5_T_MCRR(cp, op, rt, rt2, crm)
#define ARMV5_T_MRRC(cp, op, rt, rt2, crm)
#define ARMV4_5_MRC(cp, op1, rd, crn, crm, op2)
#define ARMV4_5_MRS(rn, r)
#define ARMV4_5_MCR(cp, op1, rd, crn, crm, op2)
#define ARMV4_5_VMOV(op, rt2, rt, m, vm)
#define ARMV4_5_MSR_GP(rm, field, r)
static uint32_t buf_get_u32(const uint8_t *_buffer, unsigned int first, unsigned int num)
Retrieves num bits from _buffer, starting at the first bit, returning the bits in a 32-bit word.
static void buf_set_u32(uint8_t *_buffer, unsigned int first, unsigned int num, uint32_t value)
Sets num bits in _buffer, starting at the first bit, using the bits in value.
#define WATCHPOINT_IGNORE_DATA_VALUE_MASK
#define ERROR_COMMAND_SYNTAX_ERROR
The JTAG interface can be implemented with a software or hardware fifo.
#define LOG_TARGET_INFO(target, fmt_str,...)
#define LOG_TARGET_WARNING(target, fmt_str,...)
#define LOG_TARGET_ERROR(target, fmt_str,...)
#define LOG_TARGET_DEBUG(target, fmt_str,...)
struct reg_cache ** register_get_last_cache_p(struct reg_cache **first)
target_addr_t addr
Start address to search for the control block.
This wraps an implementation of DPM primitives.
target_addr_t wp_addr
Target dependent watchpoint address.
int(* instr_read_data_dcc)(struct arm_dpm *dpm, uint32_t opcode, uint32_t *data)
Runs one instruction, reading data from dcc after execution.
uint64_t didr
Cache of DIDR.
int(* instr_write_data_r0)(struct arm_dpm *dpm, uint32_t opcode, uint32_t data)
Runs one instruction, writing data to R0 before execution.
int(* bpwp_enable)(struct arm_dpm *dpm, unsigned int index_value, uint32_t addr, uint32_t control)
Enables one breakpoint or watchpoint by writing to the hardware registers.
int(* finish)(struct arm_dpm *dpm)
Invoke after a series of instruction operations.
int(* instr_write_data_dcc)(struct arm_dpm *dpm, uint32_t opcode, uint32_t data)
Runs one instruction, writing data to DCC before execution.
int(* prepare)(struct arm_dpm *dpm)
Invoke before a series of instruction operations.
int(* instr_read_data_r0)(struct arm_dpm *dpm, uint32_t opcode, uint32_t *data)
Runs one instruction, reading data from r0 after execution.
int(* instr_read_data_r0_r1)(struct arm_dpm *dpm, uint32_t opcode, uint64_t *data)
Runs two instructions, reading data from r0 and r1 after execution.
int(* bpwp_disable)(struct arm_dpm *dpm, unsigned int index_value)
Disables one breakpoint or watchpoint by clearing its hardware control registers.
int(* instr_cpsr_sync)(struct arm_dpm *dpm)
Optional core-specific operation invoked after CPSR writes.
int(* instr_write_data_r0_r1)(struct arm_dpm *dpm, uint32_t opcode, uint64_t data)
Runs two instructions, writing data to R0 and R1 before execution.
uint32_t dscr
Recent value of DSCR.
Represents a generic ARM core, with standard application registers.
int(* full_context)(struct target *target)
Retrieve all core registers, for display.
int(* mrrc)(struct target *target, int cpnum, uint32_t op, uint32_t crm, uint64_t *value)
Read coprocessor to two registers.
int(* mrc)(struct target *target, int cpnum, uint32_t op1, uint32_t op2, uint32_t crn, uint32_t crm, uint32_t *value)
Read coprocessor register.
enum arm_mode core_mode
Record the current core mode: SVC, USR, or some other mode.
struct reg * cpsr
Handle to the CPSR/xPSR; valid in all core modes.
struct reg * pc
Handle to the PC; valid in all core modes.
int(* write_core_reg)(struct target *target, struct reg *reg, int num, enum arm_mode mode, uint8_t *value)
int(* mcrr)(struct target *target, int cpnum, uint32_t op, uint32_t crm, uint64_t value)
Write coprocessor from two registers.
int(* read_core_reg)(struct target *target, struct reg *reg, int num, enum arm_mode mode)
Retrieve a single core register.
struct reg_cache * core_cache
struct arm_dpm * dpm
Handle for the debug module, if one is present.
int(* mcr)(struct target *target, int cpnum, uint32_t op1, uint32_t op2, uint32_t crn, uint32_t crm, uint32_t value)
Write coprocessor register.
struct target * target
Backpointer to the target.
enum arm_state core_state
Record the current core state: ARM, Thumb, or otherwise.
enum breakpoint_type type
int(* add_breakpoint)(struct target *target, struct breakpoint *breakpoint)
int(* add_watchpoint)(struct target *target, struct watchpoint *watchpoint)
int(* remove_breakpoint)(struct target *target, struct breakpoint *breakpoint)
int(* remove_watchpoint)(struct target *target, struct watchpoint *watchpoint)
enum target_debug_reason debug_reason
struct reg_cache * reg_cache
struct target_type * type
#define ERROR_TARGET_RESOURCE_NOT_AVAILABLE