31 #define _DEBUG_INSTRUCTION_EXECUTION_
149 #ifdef _DEBUG_INSTRUCTION_EXECUTION_
157 LOG_ERROR(
"BUG: called with in == NULL");
168 void *in,
int size,
int be)
210 #ifdef _DEBUG_INSTRUCTION_EXECUTION_
217 LOG_DEBUG(
"in: 0x%8.8x", *(uint32_t *)in);
219 LOG_ERROR(
"BUG: called with in == NULL");
227 uint32_t *r0, uint32_t *pc)
282 uint32_t
mask, uint32_t *core_regs[16])
298 for (i = 0; i <= 15; i++) {
312 uint32_t *buf_u32 =
buffer;
313 uint16_t *buf_u16 =
buffer;
326 for (i = 0; i <= 15; i++) {
328 if (
mask & (1 << i)) {
367 LOG_DEBUG(
"xpsr: %8.8" PRIx32
", spsr: %i", xpsr, spsr);
392 uint8_t xpsr_im,
int rot,
int spsr)
397 LOG_DEBUG(
"xpsr_im: %2.2x, rot: %i, spsr: %i", xpsr_im, rot, spsr);
410 uint32_t
mask, uint32_t core_regs[16])
426 for (i = 0; i <= 15; i++) {
int arm7_9_endianness_callback(jtag_callback_data_t pu8_in, jtag_callback_data_t i_size, jtag_callback_data_t i_be, jtag_callback_data_t i_flip)
int arm7_9_write_memory_opt(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
int arm7_9_examine(struct target *target)
Perform per-target setup that requires JTAG access.
void arm7_9_disable_eice_step(struct target *target)
int arm7_9_read_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
int arm7_9_add_breakpoint(struct target *target, struct breakpoint *breakpoint)
Add a breakpoint to an ARM7/9 target.
int arm7_9_soft_reset_halt(struct target *target)
Issue a software reset and halt to an ARM7/9 target.
const struct command_registration arm7_9_command_handlers[]
int arm7_9_assert_reset(struct target *target)
Asserts the reset (SRST) on an ARM7/9 target.
int arm7_9_poll(struct target *target)
Polls an ARM7/9 target for its current status.
int arm7_9_halt(struct target *target)
Halt an ARM7/9 target.
int arm7_9_remove_breakpoint(struct target *target, struct breakpoint *breakpoint)
Removes a breakpoint from an ARM7/9 target.
int arm7_9_remove_watchpoint(struct target *target, struct watchpoint *watchpoint)
Remove a watchpoint from an ARM7/9 target.
int arm7_9_deassert_reset(struct target *target)
Deassert the reset (SRST) signal on an ARM7/9 target.
int arm7_9_write_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
void arm7_9_enable_eice_step(struct target *target, uint32_t next_pc)
int arm7_9_bulk_write_memory(struct target *target, target_addr_t address, uint32_t count, const uint8_t *buffer)
int arm7_9_step(struct target *target, int current, target_addr_t address, int handle_breakpoints)
int arm7_9_target_request_data(struct target *target, uint32_t size, uint8_t *buffer)
Get some data from the ARM7/9 target.
int arm7_9_add_watchpoint(struct target *target, struct watchpoint *watchpoint)
Add a watchpoint to an ARM7/9 target.
int arm7_9_check_reset(struct target *target)
int arm7_9_init_arch_info(struct target *target, struct arm7_9_common *arm7_9)
int arm7_9_resume(struct target *target, int current, target_addr_t address, int handle_breakpoints, int debug_execution)
static struct arm7_9_common * target_to_arm7_9(struct target *target)
static void arm7tdmi_store_byte_reg(struct target *target, int num)
static int arm7tdmi_clock_out_inner(struct arm_jtag *jtag_info, uint32_t out, int breakpoint)
static int arm7tdmi_target_create(struct target *target, Jim_Interp *interp)
static int arm7tdmi_examine_debug_reason(struct target *target)
static void arm7tdmi_read_core_regs(struct target *target, uint32_t mask, uint32_t *core_regs[16])
static void arm7tdmi_store_hword_reg(struct target *target, int num)
static int arm7tdmi_clock_out(struct arm_jtag *jtag_info, uint32_t out, int breakpoint)
int arm7tdmi_init_arch_info(struct target *target, struct arm7_9_common *arm7_9, struct jtag_tap *tap)
static void arm7tdmi_branch_resume(struct target *target)
static void arm7tdmi_write_xpsr(struct target *target, uint32_t xpsr, int spsr)
static void arm7tdmi_read_xpsr(struct target *target, uint32_t *xpsr, int spsr)
static void arm7tdmi_build_reg_cache(struct target *target)
static void arm7tdmi_load_word_regs(struct target *target, uint32_t mask)
static void arm7tdmi_load_hword_reg(struct target *target, int num)
static void arm7tdmi_write_pc(struct target *target, uint32_t pc)
static int arm7tdmi_clock_data_in(struct arm_jtag *jtag_info, uint32_t *in)
static void arm7tdmi_branch_resume_thumb(struct target *target)
static void arm7tdmi_free_reg_cache(struct target *target)
static void arm7tdmi_store_word_regs(struct target *target, uint32_t mask)
static void arm7tdmi_load_byte_reg(struct target *target, int num)
struct target_type arm7tdmi_target
Holds methods for ARM7TDMI targets.
static void arm7tdmi_write_xpsr_im8(struct target *target, uint8_t xpsr_im, int rot, int spsr)
void arm7tdmi_deinit_target(struct target *target)
static void arm7tdmi_read_core_regs_target_buffer(struct target *target, uint32_t mask, void *buffer, int size)
static void arm7tdmi_write_core_regs(struct target *target, uint32_t mask, uint32_t core_regs[16])
static int arm7tdmi_clock_data_in_endianness(struct arm_jtag *jtag_info, void *in, int size, int be)
static const int arm7tdmi_num_bits[]
static void arm7tdmi_change_to_arm(struct target *target, uint32_t *r0, uint32_t *pc)
int arm7tdmi_init_target(struct command_context *cmd_ctx, struct target *target)
int arm_blank_check_memory(struct target *target, struct target_memory_check_block *blocks, int num_blocks, uint8_t erased_value)
Runs ARM code in the target to check whether a memory block holds all ones.
int arm_arch_state(struct target *target)
int arm_checksum_memory(struct target *target, target_addr_t address, uint32_t count, uint32_t *checksum)
Runs ARM code in the target to calculate a CRC32 checksum.
struct reg_cache * arm_build_reg_cache(struct target *target, struct arm *arm)
const char * arm_get_gdb_arch(const struct target *target)
int arm_get_gdb_reg_list(struct target *target, struct reg **reg_list[], int *reg_list_size, enum target_register_class reg_class)
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.
int armv4_5_run_algorithm(struct target *target, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_params, target_addr_t entry_point, target_addr_t exit_point, unsigned int timeout_ms, void *arch_info)
static int arm_jtag_scann(struct arm_jtag *jtag_info, uint32_t new_scan_chain, tap_state_t end_state)
static int arm_jtag_set_instr(struct jtag_tap *tap, uint32_t new_instr, void *no_verify_capture, tap_state_t end_state)
static void arm7flip32(jtag_callback_data_t arg)
Macros used to generate various ARM or Thumb opcodes.
#define ARMV4_5_LDMIA(rn, list, s, w)
#define ARMV4_5_MRS(rn, r)
#define ARMV4_5_STRH_IP(rd, rn)
#define ARMV4_5_T_MOV(rd, rm)
#define ARMV4_5_LDRH_IP(rd, rn)
#define ARMV4_5_LDRB_IP(rd, rn)
#define ARMV4_5_T_LDR_PCREL(rd)
#define ARMV4_5_STR(rd, rn)
#define ARMV4_5_STMIA(rn, list, s, w)
#define ARMV4_5_MSR_IM(im, rotate, field, r)
#define ARMV4_5_STRB_IP(rd, rn)
#define ARMV4_5_T_STR(rd, rn)
int arm_semihosting_init(struct target *target)
Initialize ARM semihosting support.
uint32_t flip_u32(uint32_t value, unsigned int num)
Inverts the ordering of bits inside a 32-bit word (e.g.
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.
int embeddedice_read_reg(struct reg *reg)
Queue a read for an EmbeddedICE register into the register cache, not checking the value read.
void jtag_add_runtest(unsigned int num_cycles, tap_state_t state)
Goes to TAP_IDLE (if we're not already there), cycle precisely num_cycles in the TAP_IDLE state,...
int jtag_execute_queue(void)
For software FIFO implementations, the queued commands can be executed during this call or earlier.
void jtag_add_dr_scan(struct jtag_tap *active, int in_num_fields, const struct scan_field *in_fields, tap_state_t state)
Generate a DR SCAN using the fields passed to the function.
void jtag_add_callback4(jtag_callback_t f, jtag_callback_data_t data0, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3)
void jtag_add_callback(jtag_callback1_t f, jtag_callback_data_t data0)
A simpler version of jtag_add_callback4().
intptr_t jtag_callback_data_t
Defines the type of data passed to the jtag_callback_t interface.
#define LOG_ERROR(expr ...)
#define LOG_DEBUG(expr ...)
struct reg_cache ** register_get_last_cache_p(struct reg_cache **first)
size_t size
Size of the control block search area.
Structure for items that are common between both ARM7 and ARM9 targets.
void(* enable_single_step)(struct target *target, uint32_t next_pc)
void(* read_xpsr)(struct target *target, uint32_t *xpsr, int spsr)
Function for reading CPSR or SPSR.
void(* store_hword_reg)(struct target *target, int num)
void(* write_xpsr_im8)(struct target *target, uint8_t xpsr_im, int rot, int spsr)
Function for writing an immediate value to CPSR or SPSR.
void(* write_core_regs)(struct target *target, uint32_t mask, uint32_t core_regs[16])
uint32_t arm_bkpt
ARM breakpoint instruction.
int(* bulk_write_memory)(struct target *target, target_addr_t address, uint32_t count, const uint8_t *buffer)
Write target memory in multiples of 4 bytes, optimized for writing large quantities of data.
void(* branch_resume)(struct target *target)
int(* write_memory)(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
Variant specific memory write function that does not dispatch to bulk_write_memory.
struct arm_jtag jtag_info
JTAG information for target.
void(* read_core_regs_target_buffer)(struct target *target, uint32_t mask, void *buffer, int size)
void(* store_byte_reg)(struct target *target, int num)
struct reg_cache * eice_cache
Embedded ICE register cache.
int(* post_debug_entry)(struct target *target)
Callback function called after entering debug mode.
void(* load_word_regs)(struct target *target, uint32_t mask)
void(* load_byte_reg)(struct target *target, int num)
void(* read_core_regs)(struct target *target, uint32_t mask, uint32_t *core_regs[16])
Function for reading the core registers.
void(* load_hword_reg)(struct target *target, int num)
void(* disable_single_step)(struct target *target)
void(* write_pc)(struct target *target, uint32_t pc)
Function for writing to the program counter.
uint16_t thumb_bkpt
Thumb breakpoint instruction.
void(* store_word_regs)(struct target *target, uint32_t mask)
void(* pre_restore_context)(struct target *target)
Callback function called before restoring the processor context.
int dbgreq_adjust_pc
Amount of PC adjustment caused by a DBGREQ.
int(* examine_debug_reason)(struct target *target)
Function for determining why debug state was entered.
void(* branch_resume_thumb)(struct target *target)
void(* change_to_arm)(struct target *target, uint32_t *r0, uint32_t *pc)
Function for changing from Thumb to ARM mode.
void(* write_xpsr)(struct target *target, uint32_t xpsr, int spsr)
Function for writing to CPSR or SPSR.
Represents a generic ARM core, with standard application registers.
enum arm_arch arch
ARM architecture version.
struct reg * pc
Handle to the PC; valid in all core modes.
struct reg_cache * core_cache
This structure defines a single scan field in the scan.
uint8_t * in_value
A pointer to a 32-bit memory location for data scanned out.
const uint8_t * out_value
A pointer to value to be scanned into the device.
unsigned int num_bits
The number of bits this field specifies.
This holds methods shared between all instances of a given target type.
const char * name
Name of this type of target.
enum target_debug_reason debug_reason
enum target_endianness endianness
struct reg_cache * reg_cache