34 return addr | (ULLONG_MAX << 32);
64 LOG_DEBUG(
"entered debug state at PC 0x%" PRIx64
", target->state: %s",
130 LOG_WARNING(
"target was in unknown state when halt was requested");
134 LOG_ERROR(
"can't request a halt while in reset if nSRST pulls nTRST");
238 int retval, bp_num = 0;
240 while (cl[bp_num].
used && (bp_num < mips64->num_inst_bpoints))
244 LOG_DEBUG(
"ERROR Can not find free FP Comparator(bpid: %" PRIu32
")",
246 LOG_WARNING(
"ERROR Can not find free FP Comparator");
299 LOG_ERROR(
"Unable to set 32bit breakpoint at address %16" PRIx64,
311 uint32_t isa_req = bp->
length & 1;
330 LOG_ERROR(
"Unable to set 16bit breakpoint at address %16" PRIx64,
366 LOG_ERROR(
"can't unset breakpoint. Some thing wrong happened");
400 int retval, wp_num = 0;
415 while (cl[wp_num].
used && (wp_num < mips64->num_data_bpoints))
419 LOG_ERROR(
"ERROR Can not find free comparator");
424 LOG_ERROR(
"Only watchpoints of length 4 are supported");
429 LOG_ERROR(
"Watchpoints address should be word aligned");
444 LOG_ERROR(
"BUG: watchpoint->rw neither read, write nor access");
453 if (wp_value & 0x80000000)
454 wp_value |= ULLONG_MAX << 32;
507 LOG_DEBUG(
"Invalid FP Comparator number in breakpoint (bpid: %" PRIu32
")",
513 comparator_list[bp_num].
used =
false;
514 comparator_list[bp_num].
bp_value = 0;
586 LOG_ERROR(
"can't unset breakpoint. Some thing wrong happened");
596 uint64_t address,
int handle_breakpoints,
613 if (!debug_execution) {
639 if (handle_breakpoints) {
645 LOG_DEBUG(
"unset breakpoint at 0x%16.16" PRIx64
"",
678 if (!debug_execution) {
685 LOG_DEBUG(
"target resumed at 0x%" PRIx64
"", resume_pc);
693 LOG_DEBUG(
"target debug resumed at 0x%" PRIx64
"", resume_pc);
700 uint64_t
address,
int handle_breakpoints)
725 if (handle_breakpoints) {
789 LOG_INFO(
"no hardware breakpoint available");
834 LOG_DEBUG(
"Invalid FP Comparator number in watchpoint");
837 comparator_list[wp_num].
used =
false;
838 comparator_list[wp_num].
bp_value = 0;
851 LOG_INFO(
"no hardware watchpoints available");
901 if (((
size == 8) && (address & 0x7)) || ((
size == 4) && (address & 0x3))
902 || ((
size == 2) && (address & 0x1)))
914 LOG_DEBUG(
"address: 0x%16.16" PRIx64
", size: 0x%8.8" PRIx32
", count: 0x%8.8" PRIx32
"",
920 LOG_ERROR(
"mips64_pracc_read_mem filed");
977 if (address <= fast_data_area->
address + fast_data_area->
size &&
982 LOG_ERROR(
"Change work-area-phys or load_image address!");
990 t = calloc(
count,
sizeof(uint64_t));
1029 if (((
size == 8) && (address & 0x7)) || ((
size == 4) && (address & 0x3))
1030 || ((
size == 2) && (address & 0x1)))
1048 LOG_ERROR(
"unable to allocate t for write buffer");
1069 LOG_DEBUG(
"address: 0x%16.16" PRIx64
", size: 0x%8.8" PRIx32
", count: 0x%8.8" PRIx32
"",
1090 mips_mips64 = calloc(1,
sizeof(*mips_mips64));
1092 LOG_ERROR(
"unable to allocate mips_mips64");
1118 uint32_t
size, uint32_t *checksum)
1142 .
name =
"mips64mode32",
1144 .help =
"Enable/disable 32 bit mode",
1146 .handler = handle_mips64mode32
1152 .
name =
"mips_mips64",
1157 .target_request_data =
NULL,
1172 .blank_check_memory =
NULL,
static void buf_set_u64(uint8_t *_buffer, unsigned first, unsigned num, uint64_t value)
Sets num bits in _buffer, starting at the first bit, using the bits in value.
static uint64_t buf_get_u64(const uint8_t *_buffer, unsigned first, unsigned num)
Retrieves num bits from _buffer, starting at the first bit, returning the bits in a 64-bit word.
struct breakpoint * breakpoint_find(struct target *target, target_addr_t address)
static void watchpoint_set(struct watchpoint *watchpoint, unsigned int 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_ARGV
Use this macro to access the arguments for the command being handled, rather than accessing the varia...
#define CMD_ARGC
Use this macro to access the number of arguments for the command being handled, rather than accessing...
#define COMMAND_PARSE_BOOL(in, out, on, off)
Parse the string as a binary parameter, storing the boolean value in out.
#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
void jtag_add_reset(int req_tlr_or_trst, int req_srst)
A reset of the TAP state machine can be requested.
static enum reset_types jtag_reset_config
void jtag_add_sleep(uint32_t us)
enum reset_types jtag_get_reset_config(void)
#define LOG_WARNING(expr ...)
#define LOG_ERROR(expr ...)
#define LOG_INFO(expr ...)
#define LOG_DEBUG(expr ...)
#define MIPS16_SDBBP(isa)
int mips64_invalidate_core_regs(struct target *target)
int mips64_init_arch_info(struct target *target, struct mips64_common *mips64, struct jtag_tap *tap)
int mips64_restore_context(struct target *target)
int mips64_examine(struct target *target)
int mips64_enable_interrupts(struct target *target, bool enable)
int mips64_arch_state(struct target *target)
int mips64_configure_break_unit(struct target *target)
int mips64_build_reg_cache(struct target *target)
int mips64_save_context(struct target *target)
int mips64_get_gdb_reg_list(struct target *target, struct reg **reg_list[], int *reg_list_size, enum target_register_class reg_class)
int mips64_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, int timeout_ms, void *arch_info)
#define MIPS64_SDBBP_SIZE
#define MIPS64_COMMON_MAGIC
#define MIPS16_SDBBP_SIZE
int mips64_pracc_write_mem(struct mips_ejtag *ejtag_info, uint64_t addr, unsigned size, unsigned count, void *buf)
int mips64_pracc_fastdata_xfer(struct mips_ejtag *ejtag_info, struct working_area *source, bool write_t, uint64_t addr, unsigned count, uint64_t *buf)
int mips64_pracc_read_mem(struct mips_ejtag *ejtag_info, uint64_t addr, unsigned size, unsigned count, void *buf)
#define MIPS64_FASTDATA_HANDLER_SIZE
void mips_ejtag_set_instr(struct mips_ejtag *ejtag_info, uint32_t new_instr)
int mips_ejtag_drscan_32(struct mips_ejtag *ejtag_info, uint32_t *data)
int mips64_ejtag_config_step(struct mips_ejtag *ejtag_info, bool enable_step)
int mips_ejtag_enter_debug(struct mips_ejtag *ejtag_info)
int mips64_ejtag_exit_debug(struct mips_ejtag *ejtag_info)
int mips_ejtag_init(struct mips_ejtag *ejtag_info)
#define EJTAG_INST_CONTROL
#define EJTAG_INST_NORMALBOOT
#define EJTAG_DBCN_BLM_SHIFT
#define EJTAG_INST_EJTAGBOOT
static int mips_mips64_remove_breakpoint(struct target *target, struct breakpoint *bp)
static int mips_mips64_unset_sdbbp(struct target *target, struct breakpoint *bp)
static int mips_mips64_add_watchpoint(struct target *target, struct watchpoint *watchpoint)
static int mips_mips64_write_memory(struct target *target, uint64_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
static const struct command_registration mips64_commands_handlers[]
static int mips_mips64_poll(struct target *target)
static int mips_mips64_remove_watchpoint(struct target *target, struct watchpoint *watchpoint)
static int mips_mips64_assert_reset(struct target *target)
COMMAND_HANDLER(handle_mips64mode32)
static int mips_mips64_set_sdbbp(struct target *target, struct breakpoint *bp)
struct target_type mips_mips64_target
static int mips_mips64_add_breakpoint(struct target *target, struct breakpoint *bp)
static int mips_mips64_bulk_write_memory(struct target *target, target_addr_t address, uint32_t count, const uint8_t *buffer)
static int mips_mips64_unset_hwbp(struct target *target, struct breakpoint *bp)
static int mips_mips64_deassert_reset(struct target *target)
static int mips_mips64_resume(struct target *target, int current, uint64_t address, int handle_breakpoints, int debug_execution)
static int mips_mips64_halt(struct target *target)
static int mips_mips64_debug_entry(struct target *target)
static int mips_mips64_unset_watchpoint(struct target *target, struct watchpoint *watchpoint)
static uint64_t mips64_extend_sign(uint64_t addr)
static int mips_mips64_read_memory(struct target *target, uint64_t address, uint32_t size, uint32_t count, uint8_t *buffer)
static int mips_mips64_target_create(struct target *target, Jim_Interp *interp)
static int mips_mips64_set_breakpoint(struct target *target, struct breakpoint *bp)
static int mips_mips64_single_step_core(struct target *target)
static int mips_mips64_step(struct target *target, int current, uint64_t address, int handle_breakpoints)
static int mips_mips64_checksum_memory(struct target *target, uint64_t address, uint32_t size, uint32_t *checksum)
static int mips_mips64_set_watchpoint(struct target *target, struct watchpoint *watchpoint)
static int mips_mips64_unset_breakpoint(struct target *target, struct breakpoint *breakpoint)
static int mips_mips64_examine(struct target *target)
static int mips_mips64_init_target(struct command_context *cmd_ctx, struct target *target)
static int mips_mips64_examine_debug_reason(struct target *target)
static int mips_mips64_enable_watchpoints(struct target *target)
static int mips_mips16_unset_sdbbp(struct target *target, struct breakpoint *bp)
static int mips_mips64_set_hwbp(struct target *target, struct breakpoint *bp)
static int mips_mips16_set_sdbbp(struct target *target, struct breakpoint *bp)
static int mips_mips64_enable_breakpoints(struct target *target)
size_t size
Size of the control block search area.
enum breakpoint_type type
struct working_area * fast_data_area
struct mips64_comparator * data_break_list
int num_inst_bpoints_avail
struct mips64_comparator * inst_break_list
struct reg_cache * core_cache
struct mips_ejtag ejtag_info
int num_data_bpoints_avail
struct mips64_common mips64_common
unsigned int common_magic
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
struct breakpoint * breakpoints
struct watchpoint * watchpoints
void target_buffer_get_u16_array(struct target *target, const uint8_t *buffer, uint32_t count, uint16_t *dstbuf)
int target_call_event_callbacks(struct target *target, enum target_event event)
void target_free_all_working_areas(struct target *target)
const char * target_state_name(struct target *t)
Return the name of this targets current state.
int target_halt(struct target *target)
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_u64(struct target *target, target_addr_t address, uint64_t value)
int target_alloc_working_area(struct target *target, uint32_t size, struct working_area **area)
int target_write_u32(struct target *target, target_addr_t address, uint32_t value)
int target_read_u16(struct target *target, target_addr_t address, uint16_t *value)
void target_buffer_set_u64_array(struct target *target, uint8_t *buffer, uint32_t count, const uint64_t *srcbuf)
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.
void target_buffer_get_u64_array(struct target *target, const uint8_t *buffer, uint32_t count, uint64_t *dstbuf)
void target_buffer_set_u16_array(struct target *target, uint8_t *buffer, uint32_t count, const uint16_t *srcbuf)
void target_buffer_get_u32_array(struct target *target, const uint8_t *buffer, uint32_t count, uint32_t *dstbuf)
struct target * get_current_target(struct command_context *cmd_ctx)
void target_buffer_set_u32_array(struct target *target, uint8_t *buffer, uint32_t count, const uint32_t *srcbuf)
uint32_t target_buffer_get_u32(struct target *target, const uint8_t *buffer)
#define ERROR_TARGET_NOT_HALTED
#define ERROR_TARGET_UNALIGNED_ACCESS
@ TARGET_EVENT_DEBUG_RESUMED
@ TARGET_EVENT_DEBUG_HALTED
#define ERROR_TARGET_RESOURCE_NOT_AVAILABLE
#define ERROR_TARGET_FAILURE