25 #define _DEBUG_INSTRUCTION_EXECUTION_
28 #define NB_CACHE_WAYS 4
31 #define CP15_CTL_DCACHE (1<<2)
32 #define CP15_CTL_ICACHE (1<<12)
133 uint8_t reg_addr_buf = reg_addr & 0x3f;
134 uint8_t nr_w_buf = 0;
160 fields[0].
in_value = (uint8_t *)value;
165 #ifdef _DEBUG_INSTRUCTION_EXECUTION_
166 LOG_DEBUG(
"addr: 0x%x value: %8.8x", reg_addr, *value);
182 uint8_t reg_addr_buf = reg_addr & 0x3f;
183 uint8_t nr_w_buf = 1;
184 uint8_t value_buf[4];
209 #ifdef _DEBUG_INSTRUCTION_EXECUTION_
210 LOG_DEBUG(
"addr: 0x%x value: %8.8x", reg_addr, value);
220 #define GET_ICACHE_SIZE 6
221 #define GET_DCACHE_SIZE 18
236 if (csize & (1<<(idsel-4)))
238 csize = (csize >> idsel) & 0x0F;
239 return csize ? 1 << (12 + (csize-3)) : 0;
258 for (idx = 0; idx < nb_idx; idx++) {
260 uint32_t cp15_idx = seg << 30 | idx << 5;
276 if (!(dtag >> 4 & 0x1))
321 uint32_t ctr_reg = 0x0;
362 uint32_t ctr_reg = 0x0;
388 uint32_t cur_addr = 0x0;
389 uint32_t cp15_idx, set, way, dtag;
394 cur_addr = address + i;
397 set = (cur_addr >> 5) & 0xff;
408 cp15_idx = way << 30 | set << 5;
423 if (!(dtag >> 4 & 0x1))
427 if (dtag >> 5 == cur_addr >> 5) {
453 uint32_t cur_addr = 0x0;
454 uint32_t cp15_idx, set, way, itag;
459 cur_addr = address + i;
461 set = (cur_addr >> 5) & 0xff;
465 cp15_idx = way << 30 | set << 5;
480 if (!(itag >> 4 & 0x1))
484 if (itag >> 5 == cur_addr >> 5) {
566 if (CMD_ARGC < 1 || CMD_ARGC > 2)
631 bool icache = (strcmp(
CMD_NAME,
"icache") == 0);
640 icache ?
"I" :
"D", csize, bena ?
"enabled" :
"disabled");
648 if (strcmp(
CMD_ARGV[0],
"flush") == 0) {
678 uint32_t vnew = value;
681 if ((value & 0x1) == 0)
682 LOG_WARNING(
"arm946e: MPU must be enabled for cache to operate");
701 .handler = arm946e_handle_cp15,
703 .usage =
"regnum [value]",
704 .help =
"read/modify cp15 register",
708 .handler = arm946e_handle_idcache,
710 .usage =
"['enable'|'disable'|'flush']",
711 .help =
"I-cache info and operations",
715 .handler = arm946e_handle_idcache,
717 .usage =
"['enable'|'disable'|'flush']",
718 .help =
"D-cache info and operations",
730 .help =
"arm946e command group",
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_deinit(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.
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_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_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 arm946e_update_cp15_caches(struct target *target, uint32_t value)
static int arm946e_read_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
static const struct command_registration arm946e_exec_command_handlers[]
static int arm946e_target_create(struct target *target, Jim_Interp *interp)
static uint32_t arm946e_invalidate_whole_icache(struct target *target)
static int arm946e_init_arch_info(struct target *target, struct arm946e_common *arm946e, struct jtag_tap *tap)
static void arm946e_deinit_target(struct target *target)
static int arm946e_post_debug_entry(struct target *target)
static uint8_t arm946e_preserve_cache
flag to give info about cache manipulation during debug : "0" - cache lines are invalidated "on the f...
static const struct command_registration arm946e_command_handlers[]
COMMAND_HANDLER(arm946e_handle_cp15)
static int arm946e_write_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
Writes a buffer, in the specified word size, with current MMU settings.
static int arm946e_write_cp15(struct target *target, int reg_addr, uint32_t value)
static int arm946e_verify_pointer(struct command_invocation *cmd, struct arm946e_common *arm946e)
struct target_type arm946e_target
Holds methods for ARM946 targets.
static uint32_t arm946e_invalidate_icache(struct target *target, uint32_t address, uint32_t size, uint32_t count)
static uint32_t arm946e_invalidate_dcache(struct target *target, uint32_t address, uint32_t size, uint32_t count)
static int arm946e_read_cp15(struct target *target, int reg_addr, uint32_t *value)
static uint32_t arm946e_invalidate_whole_dcache(struct target *target)
static void arm946e_pre_restore_context(struct target *target)
static uint32_t arm946e_cp15_get_csize(struct target *target, int idsel)
#define ARM946E_COMMON_MAGIC
static struct arm946e_common * target_to_arm946(struct target *target)
int arm9tdmi_init_arch_info(struct target *target, struct arm7_9_common *arm7_9, struct jtag_tap *tap)
int arm9tdmi_init_target(struct command_context *cmd_ctx, struct target *target)
const struct command_registration arm9tdmi_command_handlers[]
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.
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 arm_le_to_h_u32(jtag_callback_data_t arg)
Macros used to generate various ARM or Thumb opcodes.
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 command_parse_bool_arg(const char *in, bool *out)
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_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.
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_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_WARNING(expr ...)
#define LOG_DEBUG(expr ...)
size_t size
Size of the control block search area.
Structure for items that are common between both ARM7 and ARM9 targets.
uint32_t arm_bkpt
ARM breakpoint instruction.
struct arm_jtag jtag_info
JTAG information for target.
int(* post_debug_entry)(struct target *target)
Callback function called after entering debug mode.
uint16_t thumb_bkpt
Thumb breakpoint instruction.
void(* pre_restore_context)(struct target *target)
Callback function called before restoring the processor context.
struct arm7_9_common arm7_9_common
uint32_t cp15_control_reg
unsigned int common_magic
Represents a generic ARM core, with standard application registers.
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...
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.
struct target * get_current_target(struct command_context *cmd_ctx)
#define ERROR_TARGET_NOT_HALTED
#define ERROR_TARGET_INVALID
static const char * target_name(const struct target *target)
Returns the instance-specific name of the specified target.
#define ERROR_TARGET_RESOURCE_NOT_AVAILABLE