66 #include "../../contrib/loaders/debug/xscale/debug_handler.inc"
122 uint8_t buf[4] = { 0 };
147 uint8_t scratch[4] = { 0 };
149 memset(&field, 0,
sizeof(field));
165 uint8_t field0 = 0x0;
166 uint8_t field0_check_value = 0x2;
167 uint8_t field0_check_mask = 0x7;
168 uint8_t field2 = 0x0;
169 uint8_t field2_check_value = 0x0;
170 uint8_t field2_check_mask = 0x1;
179 memset(&fields, 0,
sizeof(fields));
201 LOG_ERROR(
"JTAG error while reading DCSR");
211 field0_check_mask = 0x1;
225 uint8_t *in = (uint8_t *)arg;
238 uint8_t *field0 = malloc(num_words * 1);
239 uint8_t field0_check_value = 0x2;
240 uint8_t field0_check_mask = 0x6;
241 uint32_t *field1 = malloc(num_words * 4);
242 uint8_t field2_check_value = 0x0;
243 uint8_t field2_check_mask = 0x1;
245 int words_scheduled = 0;
252 memset(&fields, 0,
sizeof(fields));
276 while (words_done < num_words) {
279 for (i = words_done; i < num_words; i++) {
284 fields[1].
in_value = (uint8_t *)(field1 + i);
295 LOG_ERROR(
"JTAG error while receiving data from debug handler");
300 for (i = words_done; i < num_words; i++) {
301 if (!(field0[i] & 1)) {
304 for (j = i; j < num_words - 1; j++) {
305 field0[j] = field0[j + 1];
306 field1[j] = field1[j + 1];
311 if (words_scheduled == 0) {
312 if (attempts++ == 1000) {
314 "Failed to receiving data from debug handler after 1000 attempts");
320 words_done += words_scheduled;
323 for (i = 0; i < num_words; i++)
338 uint8_t field0_in = 0x0;
339 uint8_t field0_check_value = 0x2;
340 uint8_t field0_check_mask = 0x6;
341 uint8_t field2_check_value = 0x0;
342 uint8_t field2_check_mask = 0x1;
359 memset(&fields, 0,
sizeof(fields));
391 LOG_ERROR(
"JTAG error while reading TX");
396 LOG_ERROR(
"time out reading TX register");
399 if (!((!(field0_in & 1)) && consume))
409 if (!(field0_in & 1))
420 uint8_t field0_out = 0x0;
421 uint8_t field0_in = 0x0;
422 uint8_t field0_check_value = 0x2;
423 uint8_t field0_check_mask = 0x6;
424 uint8_t field2 = 0x0;
425 uint8_t field2_check_value = 0x0;
426 uint8_t field2_check_mask = 0x1;
432 memset(&fields, 0,
sizeof(fields));
459 LOG_ERROR(
"JTAG error while writing RX");
464 LOG_ERROR(
"time out writing RX register");
467 if (!(field0_in & 1))
483 LOG_ERROR(
"JTAG error while writing RX");
501 static const uint8_t
t0;
502 uint8_t
t1[4] = { 0 };
503 static const uint8_t
t2 = 1;
506 { .num_bits = 32, .out_value =
t1 },
507 { .num_bits = 1, .out_value = &
t2 },
511 while (done_count++ <
count) {
531 LOG_ERROR(
"BUG: size neither 4, 2 nor 1");
546 LOG_ERROR(
"JTAG error while sending data to debug handler");
566 uint8_t field0 = 0x0;
567 uint8_t field0_check_value = 0x2;
568 uint8_t field0_check_mask = 0x7;
569 uint8_t field2 = 0x0;
570 uint8_t field2_check_value = 0x0;
571 uint8_t field2_check_mask = 0x1;
576 if (ext_dbg_brk != -1)
586 memset(&fields, 0,
sizeof(fields));
608 LOG_ERROR(
"JTAG error while writing DCSR");
619 static unsigned int parity(
unsigned int v)
627 return (0x6996 >> v) & 1;
633 uint8_t packet[4] = { 0 };
638 LOG_DEBUG(
"loading miniIC at 0x%8.8" PRIx32, va);
654 memset(&fields, 0,
sizeof(fields));
671 for (word = 0; word < 8; word++) {
675 memcpy(&value, packet,
sizeof(uint32_t));
687 uint8_t packet[4] = { 0 };
701 memset(&fields, 0,
sizeof(fields));
720 uint32_t low_reset_branch, high_reset_branch;
722 for (i = 1; i < 8; i++) {
737 for (i = 1; i < 8; i++) {
753 high_reset_branch = (xscale->
handler_address + 0x20 - 0xffff0000 - 0x8) >> 2;
773 static const char *arch_dbg_reason[] = {
774 "",
"\n(processor reset)",
"\n(trace buffer full)"
778 LOG_ERROR(
"BUG: called for a non-ARMv4/5 target");
783 LOG_USER(
"MMU: %s, D-Cache: %s, I-Cache: %s%s",
807 LOG_USER(
"error while polling TX register, reset CPU");
863 for (i = 1; i <= 7; i++) {
875 LOG_ERROR(
"cpsr contains invalid mode value - communication failure");
878 LOG_DEBUG(
"target entered debug state in %s mode",
893 for (i = 8; i <= 14; i++) {
951 LOG_ERROR(
"Method of Entry is 'Reserved'");
961 uint32_t cache_type_reg;
1012 LOG_ERROR(
"target was in unknown state when halt was requested");
1015 LOG_DEBUG(
"target->state == TARGET_RESET");
1041 "BUG: xscale->ibcr0_used is set, but no breakpoint with that address found");
1106 uint32_t current_pc;
1117 if (!debug_execution)
1132 if (current_pc == 0x0) {
1138 if (handle_breakpoints) {
1154 uint32_t current_opcode;
1157 "BUG: couldn't calculate PC of next instruction, current opcode was 0x%8.8" PRIx32,
1175 LOG_DEBUG(
"writing cpsr with value 0x%8.8" PRIx32,
1178 for (i = 7; i >= 0; i--) {
1182 LOG_DEBUG(
"writing r%i with value 0x%8.8" PRIx32,
1189 LOG_DEBUG(
"writing PC with value 0x%8.8" PRIx32,
1240 LOG_DEBUG(
"writing cpsr with value 0x%8.8" PRIx32,
1243 for (i = 7; i >= 0; i--) {
1246 LOG_DEBUG(
"writing r%i with value 0x%8.8" PRIx32,
1252 LOG_DEBUG(
"wrote PC with value 0x%8.8" PRIx32,
1257 if (!debug_execution) {
1273 uint32_t
address,
bool handle_breakpoints)
1286 uint32_t current_opcode, current_pc;
1291 "BUG: couldn't calculate PC of next instruction, current opcode was 0x%8.8" PRIx32,
1326 LOG_DEBUG(
"writing cpsr with value 0x%8.8" PRIx32,
1329 for (i = 7; i >= 0; i--) {
1335 LOG_DEBUG(
"writing r%i with value 0x%8.8" PRIx32, i,
1344 LOG_DEBUG(
"wrote PC with value 0x%8.8" PRIx32,
1373 uint32_t current_pc;
1388 if (current_pc == 0x0) {
1393 LOG_DEBUG(
"current pc %" PRIx32, current_pc);
1402 if (handle_breakpoints)
1430 LOG_WARNING(
"Reset is not asserted because the target is not examined.");
1431 LOG_WARNING(
"Use a reset button or power cycle the target.");
1510 unsigned int buf_cnt;
1536 binary_size -= buf_cnt,
buffer += buf_cnt) {
1537 uint32_t cache_line[8];
1540 buf_cnt = binary_size;
1544 for (i = 0; i < buf_cnt; i += 4) {
1549 for (; i < 32; i += 4)
1550 cache_line[i / 4] = 0xe1a08008;
1553 if ((
address % 0x400) != 0x0) {
1637 for (i = 1; i < 7; i++) {
1647 for (j = 0;
valid && j <= 16; j++) {
1678 for (j = 8; j <= 14; j++) {
1709 for (i = 1; i < 7; i++) {
1717 for (j = 8; j <= 14; j++) {
1743 for (j = 8; j <= 14; j++) {
1803 buf32 = malloc(4 *
count);
1811 for (i = 0; i <
count; i++) {
1822 *
buffer++ = buf32[i] & 0xff;
1858 LOG_ERROR(
"%s: %s is not implemented. Disable MMU?",
1903 for (i = 0; i <
count; i++) {
1957 LOG_ERROR(
"%s: %s is not implemented. Disable MMU?",
1979 int d_u_cache,
int i_cache)
1982 uint32_t cp15_control;
1992 cp15_control &= ~0x1U;
2008 cp15_control &= ~0x4U;
2016 cp15_control &= ~0x1000U;
2029 int d_u_cache,
int i_cache)
2032 uint32_t cp15_control;
2042 cp15_control |= 0x1U;
2045 cp15_control |= 0x4U;
2048 cp15_control |= 0x1000U;
2088 LOG_ERROR(
"BUG: no hardware comparator available");
2134 LOG_ERROR(
"no breakpoint unit available for hardware breakpoint");
2139 LOG_ERROR(
"only breakpoints of two (Thumb) or four (ARM) bytes length supported");
2220 uint32_t enable = 0;
2240 LOG_ERROR(
"BUG: watchpoint->rw neither read, write nor access");
2247 LOG_ERROR(
"BUG: sufficient hardware comparators unavailable");
2261 dbcon_value |= enable;
2267 dbcon_value |= enable << 2;
2272 LOG_ERROR(
"BUG: no hardware comparator available");
2285 LOG_ERROR(
"no more watchpoint registers available");
2290 LOG_WARNING(
"xscale does not support value, mask arguments; ignoring");
2295 LOG_ERROR(
"xscale requires that watchpoint length is a power of two");
2307 LOG_ERROR(
"insufficient watchpoint registers available");
2312 LOG_ERROR(
"xscale does not support watchpoints with length "
2313 "greater than address");
2340 dbcon_value &= ~0x103;
2343 dbcon_value &= ~0x3;
2348 dbcon_value &= ~0xc;
2384 if (strcmp(
reg->
name,
"XSCALE_DCSR") == 0)
2386 else if (strcmp(
reg->
name,
"XSCALE_TX") == 0) {
2389 }
else if (strcmp(
reg->
name,
"XSCALE_RX") == 0) {
2392 }
else if (strcmp(
reg->
name,
"XSCALE_TXRXCTRL") == 0) {
2421 if (strcmp(
reg->
name,
"XSCALE_DCSR") == 0) {
2424 }
else if (strcmp(
reg->
name,
"XSCALE_RX") == 0) {
2427 }
else if (strcmp(
reg->
name,
"XSCALE_TX") == 0) {
2430 }
else if (strcmp(
reg->
name,
"XSCALE_TXRXCTRL") == 0) {
2477 uint32_t trace_buffer[258];
2478 int is_address[256];
2494 for (i = 255; i >= 0; i--) {
2496 if ((trace_buffer[i] & 0xe0) == 0xc0)
2500 if (((trace_buffer[i] & 0xf0) == 0x90) ||
2501 ((trace_buffer[i] & 0xf0) == 0xd0)) {
2503 is_address[--i] = 1;
2505 is_address[--i] = 1;
2507 is_address[--i] = 1;
2509 is_address[--i] = 1;
2515 for (j = 0; (j < 256) && (trace_buffer[j] == 0) && (!is_address[j]); j++)
2524 if (is_address[0]) {
2527 if (!is_address[i++])
2534 if (((trace_buffer[j] & 0xf0) == 0x90) || ((trace_buffer[j] & 0xf0) == 0xd0))
2538 for (trace_data_p = &xscale->
trace.
data; *trace_data_p;
2539 trace_data_p = &(*trace_data_p)->
next)
2543 (*trace_data_p)->next =
NULL;
2544 (*trace_data_p)->chkpt0 = trace_buffer[256];
2545 (*trace_data_p)->chkpt1 = trace_buffer[257];
2548 (*trace_data_p)->depth = 256 - j;
2551 for (i = j; i < 256; i++) {
2552 (*trace_data_p)->entries[i - j].data = trace_buffer[i];
2584 if (section == -1) {
2593 4, buf, &size_read);
2595 LOG_ERROR(
"error while reading instruction");
2604 2, buf, &size_read);
2606 LOG_ERROR(
"error while reading instruction");
2612 LOG_ERROR(
"BUG: unknown core state encountered");
2650 uint32_t breakpoint_pc = 0;
2652 uint32_t current_pc = 0;
2655 LOG_WARNING(
"No trace image loaded; use 'xscale trace_image'");
2658 while (trace_data) {
2666 for (i = 0; i < trace_data->
depth; i++) {
2668 uint32_t chkpt_reg = 0x0;
2669 uint32_t branch_target = 0;
2673 int trace_msg_type = (trace_data->
entries[i].
data & 0xf0) >> 4;
2680 switch (trace_msg_type) {
2689 exception = (trace_data->
entries[i].
data & 0x70) >> 4;
2692 branch_target = (trace_data->
entries[i].
data & 0xf0) >> 2;
2705 chkpt_reg = trace_data->
chkpt1;
2708 chkpt_reg = trace_data->
chkpt0;
2716 chkpt_reg = trace_data->
chkpt1;
2719 chkpt_reg = trace_data->
chkpt0;
2723 if (current_pc == 0)
2724 branch_target = chkpt_reg;
2733 LOG_WARNING(
"trace is suspect: invalid trace message byte");
2742 if (current_pc == 0) {
2743 current_pc = branch_target;
2750 for (j = 0; j <
count; j++) {
2758 if ((trace_msg_type == 15) || (exception > 0 && exception < 4)) {
2764 if (trace_msg_type == 15)
2777 if ((trace_msg_type == 8) || (trace_msg_type == 12)) {
2785 if (trace_msg_type == 12) {
2786 if (current_pc == 0)
2787 current_pc = chkpt_reg;
2788 else if (current_pc != chkpt_reg)
2789 LOG_WARNING(
"trace is suspect: checkpoint register "
2790 "inconsistent with address from image");
2793 if (current_pc == 0)
2800 if ((trace_msg_type == 9) || (trace_msg_type == 13)) {
2801 current_pc = branch_target;
2804 if ((trace_msg_type == 13) && (chkpt_reg != branch_target))
2805 LOG_WARNING(
"trace is suspect: checkpoint register "
2806 "inconsistent with address from trace buffer");
2812 trace_data = trace_data->
next;
2821 if (current_pc == 0)
2825 int gap_count = (breakpoint_pc - current_pc) /
2829 if (gap_count < 0 || gap_count > 16) {
2830 LOG_WARNING(
"trace is suspect: excessive gap at end of trace");
2835 for (i = 0; i < gap_count; i++) {
2859 (*cache_p)->next = malloc(
sizeof(
struct reg_cache));
2860 cache_p = &(*cache_p)->
next;
2863 (*cache_p)->
name =
"XScale registers";
2864 (*cache_p)->next =
NULL;
2865 (*cache_p)->reg_list = calloc(num_regs,
sizeof(
struct reg));
2866 (*cache_p)->num_regs = num_regs;
2868 for (i = 0; i < num_regs; i++) {
2870 (*cache_p)->reg_list[i].value = calloc(4, 1);
2871 (*cache_p)->reg_list[i].dirty =
false;
2872 (*cache_p)->reg_list[i].valid =
false;
2873 (*cache_p)->reg_list[i].size = 32;
2874 (*cache_p)->reg_list[i].arch_info = &arch_info[i];
2876 (*cache_p)->reg_list[i].exist =
true;
2918 uint32_t high_reset_branch, low_reset_branch;
2945 high_reset_branch = (xscale->
handler_address + 0x20 - 0xffff0000 - 0x8) >> 2;
2950 for (i = 1; i <= 7; i++) {
2969 LOG_INFO(
"%s: hardware has 2 breakpoints and 2 watchpoints",
3009 LOG_ERROR(
"debug_handler.bin: larger than 2kb");
3013 xscale = calloc(1,
sizeof(*xscale));
3048 "xscale debug_handler <address> must be between 0x800 and 0x1fef800 or between 0xfe000800 and 0xfffff800");
3078 LOG_ERROR(
"xscale cache_clean_address <address> must be 64kb aligned");
3111 virtual, &cb, &ret);
3175 bool icache =
false;
3176 if (strcmp(
CMD_NAME,
"icache") == 0)
3196 bool enabled = icache ?
3199 const char *msg = enabled ?
"enabled" :
"disabled";
3205 static const struct {
3223 uint32_t dcsr_value;
3233 if (strcmp(
CMD_ARGV[0],
"all") == 0) {
3236 }
else if (strcmp(
CMD_ARGV[0],
"none") == 0) {
3262 (dcsr_value &
vec_ids[i].
mask) ?
"catch" :
"ignore");
3284 for (idx = 1; idx < 8; idx++)
3287 "low %d: 0x%" PRIx32,
3290 for (idx = 1; idx < 8; idx++)
3293 "high %d: 0x%" PRIx32,
3307 if (idx < 1 || idx >= 8)
3310 if (!err && strcmp(
CMD_ARGV[0],
"low") == 0) {
3313 }
else if (!err && (strcmp(
CMD_ARGV[0],
"high") == 0)) {
3331 uint32_t dcsr_value;
3344 if (strcmp(
"enable",
CMD_ARGV[0]) == 0)
3346 else if (strcmp(
"disable",
CMD_ARGV[0]) == 0)
3353 if (strcmp(
"fill",
CMD_ARGV[1]) == 0) {
3357 if (buffcount < 1) {
3364 }
else if (strcmp(
"wrap",
CMD_ARGV[1]) == 0)
3373 char fill_string[12];
3377 ? fill_string :
"wrap");
3460 while (trace_data) {
3468 for (i = 0; i < trace_data->
depth; i++)
3472 trace_data = trace_data->
next;
3509 uint32_t reg_no = 0;
3577 .
name =
"cache_info",
3578 .handler = xscale_handle_cache_info_command,
3580 .help =
"display information about CPU caches",
3585 .handler = xscale_handle_mmu_command,
3587 .help =
"enable or disable the MMU",
3588 .usage =
"['enable'|'disable']",
3592 .handler = xscale_handle_idcache_command,
3594 .help =
"display ICache state, optionally enabling or "
3596 .usage =
"['enable'|'disable']",
3600 .handler = xscale_handle_idcache_command,
3602 .help =
"display DCache state, optionally enabling or "
3604 .usage =
"['enable'|'disable']",
3607 .name =
"vector_catch",
3608 .handler = xscale_handle_vector_catch_command,
3610 .help =
"set or display mask of vectors "
3611 "that should trigger debug entry",
3612 .usage =
"['all'|'none'|'fiq'|'irq'|'dabt'|'pabt'|'swi'|'undef'|'reset']",
3615 .name =
"vector_table",
3616 .handler = xscale_handle_vector_table_command,
3618 .help =
"set vector table entry in mini-ICache, "
3619 "or display current tables",
3620 .usage =
"[('high'|'low') index code]",
3623 .name =
"trace_buffer",
3624 .handler = xscale_handle_trace_buffer_command,
3626 .help =
"display trace buffer status, enable or disable "
3627 "tracing, and optionally reconfigure trace mode",
3628 .usage =
"['enable'|'disable' ['fill' [number]|'wrap']]",
3631 .name =
"dump_trace",
3632 .handler = xscale_handle_dump_trace_command,
3634 .help =
"dump content of trace buffer to file",
3635 .usage =
"filename",
3638 .name =
"analyze_trace",
3639 .handler = xscale_handle_analyze_trace_buffer_command,
3641 .help =
"analyze content of trace buffer",
3645 .name =
"trace_image",
3646 .handler = xscale_handle_trace_image_command,
3648 .help =
"load image from file to address (default 0)",
3649 .usage =
"filename [offset [filetype]]",
3653 .handler = xscale_handle_cp15,
3655 .help =
"Read or write coprocessor 15 register.",
3656 .usage =
"register [value]",
3662 .
name =
"debug_handler",
3663 .handler = xscale_handle_debug_handler_command,
3665 .help =
"Change address used for debug handler.",
3666 .usage =
"<target> <address>",
3669 .name =
"cache_clean_address",
3670 .handler = xscale_handle_cache_clean_address_command,
3672 .help =
"Change address used for cleaning data cache.",
3687 .help =
"xscale command group",
struct reg * arm_reg_current(struct arm *arm, unsigned int regnum)
Returns handle to the register currently mapped to a given number.
int arm_arch_state(struct target *target)
bool is_arm_mode(unsigned int psr_mode)
Return true iff the parameter denotes a valid ARM processor mode.
int armv4_5_insn_set(struct command_invocation *cmd, struct target *target, const char **insn_set)
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)
int arm_blank_check_memory(struct target *target, struct target_memory_check_block *blocks, unsigned int num_blocks, uint8_t erased_value, unsigned int *checked)
Runs ARM code in the target to check whether a memory block holds all ones.
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)
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.
const struct command_registration arm_command_handlers[]
int arm_init_arch_info(struct target *target, struct arm *arm)
const char * arm_mode_name(unsigned int psr_mode)
Map PSR mode bits to the name of an ARM processor operating mode.
void arm_set_cpsr(struct arm *arm, uint32_t cpsr)
Configures host-side ARM records to reflect the specified CPSR.
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)
int arm_evaluate_opcode(uint32_t opcode, uint32_t address, struct arm_instruction *instruction)
int thumb_evaluate_opcode(uint16_t opcode, uint32_t address, struct arm_instruction *instruction)
Macros used to generate various ARM or Thumb opcodes.
int arm_simulate_step(struct target *target, uint32_t *dry_run_pc)
enum arm_mode armv4_5_number_to_mode(int number)
Map linear number indexing armv4_5_core_reg_map to PSR mode bits.
#define ARMV4_5_CORE_REG_MODE(cache, mode, num)
int armv4_5_identify_cache(uint32_t cache_type_reg, struct armv4_5_cache_common *cache)
int armv4_5_handle_cache_info_command(struct command_invocation *cmd, struct armv4_5_cache_common *armv4_5_cache)
int armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_common *armv4_5_mmu, uint32_t va, uint32_t *cb, uint32_t *val)
void * buf_cpy(const void *from, void *_to, unsigned int size)
Copies size bits out of from and into to.
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.
struct breakpoint * breakpoint_find(struct target *target, target_addr_t address)
static void watchpoint_set(struct watchpoint *watchpoint, unsigned int number)
#define WATCHPOINT_IGNORE_DATA_VALUE_MASK
static void breakpoint_hw_set(struct breakpoint *breakpoint, unsigned int hw_number)
void command_print(struct command_invocation *cmd, const char *format,...)
#define CMD
Use this macro to access the command being handled, rather than accessing the variable directly.
#define CMD_NAME
Use this macro to access the name of the command being handled, rather than accessing the variable di...
#define CMD_ARGV
Use this macro to access the arguments for the command being handled, rather than accessing the varia...
#define ERROR_COMMAND_SYNTAX_ERROR
#define CMD_ARGC
Use this macro to access the number of arguments for the command being handled, rather than accessing...
#define COMMAND_PARSE_ENABLE(in, out)
parses an enable/disable command argument
#define COMMAND_PARSE_NUMBER(type, in, out)
parses the string in into out as a type, or prints a command error and passes the error code to the c...
#define CMD_CTX
Use this macro to access the context of the command being handled, rather than accessing the variable...
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
#define ERROR_COMMAND_ARGUMENT_INVALID
uint64_t buffer
Pointer to data buffer to send over SPI.
uint32_t size
Size of dw_spi_transaction::buffer.
uint32_t address
Starting address. Sector aligned.
int fileio_write_u32(struct fileio *fileio, uint32_t data)
int fileio_close(struct fileio *fileio)
int fileio_open(struct fileio **fileio, const char *url, enum fileio_access access_type, enum fileio_type type)
void image_close(struct image *image)
int image_read_section(struct image *image, int section, target_addr_t offset, uint32_t size, uint8_t *buffer, size_t *size_read)
int image_open(struct image *image, const char *url, const char *type_string)
void jtag_add_dr_scan_check(struct jtag_tap *active, int in_num_fields, struct scan_field *in_fields, enum tap_state state)
A version of jtag_add_dr_scan() that uses the check_value/mask fields.
void jtag_add_reset(int req_tlr_or_trst, int req_srst)
A reset of the TAP state machine can be requested.
void jtag_add_runtest(unsigned int num_cycles, enum tap_state 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_pathmove(unsigned int num_states, const enum tap_state *path)
Application code must assume that interfaces will implement transitions between states with different...
void jtag_add_dr_scan(struct jtag_tap *active, int in_num_fields, const struct scan_field *in_fields, enum tap_state state)
Generate a DR SCAN using the fields passed to the function.
void jtag_add_sleep(uint32_t us)
void jtag_check_value_mask(struct scan_field *field, uint8_t *value, uint8_t *mask)
Execute jtag queue and check value with an optional mask.
void jtag_add_ir_scan(struct jtag_tap *active, struct scan_field *in_fields, enum tap_state state)
Generate an IR SCAN with a list of scan fields with one entry for each enabled TAP.
void jtag_add_callback(jtag_callback1_t f, jtag_callback_data_t data0)
A simpler version of jtag_add_callback4().
tap_state
Defines JTAG Test Access Port states.
intptr_t jtag_callback_data_t
Defines the type of data passed to the jtag_callback_t interface.
void alive_sleep(uint64_t ms)
#define LOG_USER(expr ...)
#define LOG_WARNING(expr ...)
#define LOG_TARGET_ERROR(target, fmt_str,...)
#define LOG_ERROR(expr ...)
#define LOG_LEVEL_IS(FOO)
#define LOG_INFO(expr ...)
#define LOG_DEBUG(expr ...)
struct reg_cache ** register_get_last_cache_p(struct reg_cache **first)
void register_cache_invalidate(struct reg_cache *cache)
Marks the contents of the register cache as invalid (and clean).
static const char * str_enabled_disabled(bool value)
union arm_instruction::@73 info
struct arm_b_bl_bx_blx_instr b_bl_bx_blx
Represents a generic ARM core, with standard application registers.
int(* full_context)(struct target *target)
Retrieve all core registers, for display.
enum arm_core_type core_type
Indicates what registers are in the ARM state core register set.
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(* 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 reg * spsr
Handle to the SPSR; valid only in core modes with an SPSR.
unsigned int common_magic
int(* write_memory)(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
int(* read_memory)(struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
int(* get_ttb)(struct target *target, uint32_t *result)
int(* enable_mmu_caches)(struct target *target, int mmu, int d_u_cache, int i_cache)
int(* disable_mmu_caches)(struct target *target, int mmu, int d_u_cache, int i_cache)
struct armv4_5_cache_common armv4_5_cache
enum breakpoint_type type
When run_command is called, a new instance will be created on the stack, filled with the proper value...
const struct command_registration * chain
If non-NULL, the commands in chain will be registered in the same context and scope of this registrat...
unsigned int num_sections
struct imagesection * sections
target_addr_t base_address
uint8_t * cur_instr
current instruction
unsigned int ir_length
size of instruction register
int(* get)(struct reg *reg)
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.
uint8_t * check_value
The value used to check the 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.
uint8_t * check_mask
The mask to go with check_value.
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
struct breakpoint * breakpoints
struct watchpoint * watchpoints
uint8_t static_low_vectors_set
uint32_t static_high_vectors[8]
uint32_t static_low_vectors[8]
uint32_t cache_clean_address
uint32_t cp15_control_reg
uint8_t static_high_vectors_set
struct reg_cache * reg_cache
struct armv4_5_mmu_common armv4_5_mmu
unsigned int common_magic
struct xscale_trace trace
unsigned int num_checkpoints
struct xscale_trace_data * next
struct xscale_trace_entry * entries
uint32_t last_instruction
enum xscale_trace_entry_type type
struct xscale_trace_data * data
enum arm_state core_state
int target_call_event_callbacks(struct target *target, enum target_event event)
struct target * get_target(const char *id)
void target_free_all_working_areas(struct target *target)
int target_halt(struct target *target)
void target_buffer_set_u16(struct target *target, uint8_t *buffer, uint16_t value)
void target_buffer_set_u32(struct target *target, uint8_t *buffer, uint32_t value)
int target_write_u16(struct target *target, target_addr_t address, uint16_t value)
int target_write_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
Write count items of size bytes to the memory of target at the address given.
int target_write_u32(struct target *target, target_addr_t address, uint32_t value)
const char * target_state_name(const struct target *t)
Return the name of this targets current state.
int target_read_u32(struct target *target, target_addr_t address, uint32_t *value)
uint16_t target_buffer_get_u16(struct target *target, const uint8_t *buffer)
int target_read_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
Read count items of size bytes from the memory of target at the address given.
struct target * get_current_target(struct command_context *cmd_ctx)
uint32_t target_buffer_get_u32(struct target *target, const uint8_t *buffer)
#define ERROR_TARGET_NOT_HALTED
static bool target_was_examined(const struct target *target)
#define ERROR_TARGET_UNALIGNED_ACCESS
#define ERROR_TARGET_INVALID
@ TARGET_EVENT_DEBUG_RESUMED
@ TARGET_EVENT_DEBUG_HALTED
static const char * target_name(const struct target *target)
Returns the instance-specific name of the specified target.
#define ERROR_TARGET_NOT_EXAMINED
#define ERROR_TARGET_TIMEOUT
#define ERROR_TARGET_RESOURCE_NOT_AVAILABLE
#define ERROR_TARGET_DATA_ABORT
#define ERROR_TARGET_FAILURE
#define ERROR_TRACE_INSTRUCTION_UNAVAILABLE
#define ERROR_TRACE_IMAGE_UNAVAILABLE
static uint16_t le_to_h_u16(const uint8_t *buf)
#define ARRAY_SIZE(x)
Compute the number of elements of a variable length array.
static uint32_t be_to_h_u32(const uint8_t *buf)
static uint16_t be_to_h_u16(const uint8_t *buf)
static uint32_t le_to_h_u32(const uint8_t *buf)
static int xscale_enable_single_step(struct target *target, uint32_t next_pc)
static int xscale_target_create(struct target *target)
static int xscale_virt2phys(struct target *target, target_addr_t virtual, target_addr_t *physical)
static int xscale_init_arch_info(struct target *target, struct xscale_common *xscale, struct jtag_tap *tap)
static int xscale_add_breakpoint(struct target *target, struct breakpoint *breakpoint)
static int xscale_assert_reset(struct target *target)
static int xscale_jtag_set_instr(struct jtag_tap *tap, uint32_t new_instr, enum tap_state end_state)
static int xscale_set_breakpoint(struct target *, struct breakpoint *)
static int xscale_enable_mmu_caches(struct target *target, int mmu, int d_u_cache, int i_cache)
static int xscale_load_ic(struct target *target, uint32_t va, uint32_t buffer[8])
static void xscale_display_instruction(struct target *target, uint32_t pc, struct arm_instruction *instruction, struct command_invocation *cmd)
static int xscale_write_dcsr(struct target *target, int hold_rst, int ext_dbg_brk)
static int xscale_full_context(struct target *target)
static void xscale_deinit_target(struct target *target)
static int xscale_analyze_trace(struct target *target, struct command_invocation *cmd)
static int xscale_set_watchpoint(struct target *, struct watchpoint *)
static int xscale_verify_pointer(struct command_invocation *cmd, struct xscale_common *xscale)
static int xscale_read_tx(struct target *target, int consume)
static int xscale_arch_state(struct target *target)
static int xscale_set_reg_u32(struct reg *reg, uint32_t value)
static int xscale_deassert_reset(struct target *target)
static int xscale_read_trace(struct target *)
COMMAND_HANDLER(xscale_handle_debug_handler_command)
static int xscale_mmu(struct target *target, bool *enabled)
static int xscale_remove_breakpoint(struct target *target, struct breakpoint *breakpoint)
static int xscale_read_dcsr(struct target *target)
static const uint8_t xscale_debug_handler[]
static int xscale_set_reg(struct reg *reg, uint8_t *buf)
static int xscale_get_ttb(struct target *target, uint32_t *result)
static int xscale_read_core_reg(struct target *target, struct reg *r, int num, enum arm_mode mode)
static int xscale_step(struct target *target, bool current, target_addr_t address, bool handle_breakpoints)
static unsigned int parity(unsigned int v)
static int xscale_write_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
static const struct @136 vec_ids[]
static const struct command_registration xscale_any_command_handlers[]
static int xscale_disable_mmu_caches(struct target *target, int mmu, int d_u_cache, int i_cache)
static int xscale_get_reg(struct reg *reg)
static const struct reg_arch_type xscale_reg_type
static const struct xscale_reg xscale_reg_arch_info[]
static void xscale_enable_breakpoints(struct target *target)
static const struct command_registration xscale_command_handlers[]
static int xscale_write_rx(struct target *target)
static void xscale_free_trace_data(struct xscale_common *xscale)
static int xscale_write_dcsr_sw(struct target *target, uint32_t value)
static void xscale_getbuf(jtag_callback_data_t arg)
static void xscale_free_reg_cache(struct target *target)
static int xscale_receive(struct target *target, uint32_t *buffer, int num_words)
static int xscale_unset_watchpoint(struct target *target, struct watchpoint *watchpoint)
static int xscale_poll(struct target *target)
static void xscale_enable_watchpoints(struct target *target)
static void xscale_build_reg_cache(struct target *target)
static int xscale_write_phys_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
static const char xscale_not[]
static int xscale_send_u32(struct target *target, uint32_t value)
static int xscale_restore_banked(struct target *)
static int xscale_init_target(struct command_context *cmd_ctx, struct target *target)
static const struct command_registration xscale_exec_command_handlers[]
static int xscale_resume(struct target *, bool current, target_addr_t address, bool handle_breakpoints, bool debug_execution)
static int xscale_disable_single_step(struct target *target)
static int xscale_invalidate_ic_line(struct target *target, uint32_t va)
static int xscale_read_instruction(struct target *target, uint32_t pc, struct arm_instruction *instruction)
static int xscale_update_vectors(struct target *target)
static int xscale_debug_entry(struct target *)
static int xscale_write_core_reg(struct target *target, struct reg *r, int num, enum arm_mode mode, uint8_t *value)
static int xscale_read_phys_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
static int xscale_add_watchpoint(struct target *target, struct watchpoint *watchpoint)
static int xscale_send(struct target *target, const uint8_t *buffer, int count, int size)
static int xscale_unset_breakpoint(struct target *, struct breakpoint *)
static int xscale_step_inner(struct target *target, bool current, uint32_t address, bool handle_breakpoints)
static void xscale_branch_address(struct xscale_trace_data *trace_data, int i, uint32_t *target)
static const char *const xscale_reg_list[]
static int xscale_read_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
static int xscale_remove_watchpoint(struct target *target, struct watchpoint *watchpoint)
static int xscale_halt(struct target *target)
struct target_type xscale_target
@ XSCALE_DBG_REASON_RESET
@ XSCALE_DBG_REASON_TB_FULL
@ XSCALE_DBG_REASON_GENERIC
#define XSCALE_IXP4XX_PXA2XX
#define ERROR_XSCALE_NO_TRACE_DATA
static struct xscale_common * target_to_xscale(struct target *target)
#define XSCALE_COMMON_MAGIC