OpenOCD
armv4_5.c File Reference
Include dependency graph for armv4_5.c:

Go to the source code of this file.

Enumerations

enum  {
  ARMV4_5_SPSR_FIQ = 32 , ARMV4_5_SPSR_IRQ = 33 , ARMV4_5_SPSR_SVC = 34 , ARMV4_5_SPSR_ABT = 35 ,
  ARMV4_5_SPSR_UND = 36 , ARM_SPSR_MON = 41 , ARM_SPSR_HYP = 43
}
 

Functions

int arm_arch_state (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. More...
 
struct reg_cachearm_build_reg_cache (struct target *target, struct arm *arm)
 
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. More...
 
static int arm_default_mcr (struct target *target, int cpnum, uint32_t op1, uint32_t op2, uint32_t crn, uint32_t crm, uint32_t value)
 
static int arm_default_mrc (struct target *target, int cpnum, uint32_t op1, uint32_t op2, uint32_t crn, uint32_t crm, uint32_t *value)
 
void arm_free_reg_cache (struct arm *arm)
 
static int arm_full_context (struct target *target)
 
static void arm_gdb_dummy_init (void)
 
const char * arm_get_gdb_arch (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)
 
int arm_init_arch_info (struct target *target, struct arm *arm)
 
const char * arm_mode_name (unsigned psr_mode)
 Map PSR mode bits to the name of an ARM processor operating mode. More...
 
int arm_mode_to_number (enum arm_mode mode)
 Map PSR mode bits to linear number indexing armv4_5_core_reg_map. More...
 
struct regarm_reg_current (struct arm *arm, unsigned regnum)
 Returns handle to the register currently mapped to a given number. More...
 
void arm_set_cpsr (struct arm *arm, uint32_t cpsr)
 Configures host-side ARM records to reflect the specified CPSR. More...
 
static int armv4_5_get_core_reg (struct reg *reg)
 
enum arm_mode armv4_5_number_to_mode (int number)
 Map linear number indexing armv4_5_core_reg_map to PSR mode bits. More...
 
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, int timeout_ms, void *arch_info)
 
static int armv4_5_run_algorithm_completion (struct target *target, uint32_t exit_point, int timeout_ms, void *arch_info)
 
int armv4_5_run_algorithm_inner (struct target *target, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_params, uint32_t entry_point, uint32_t exit_point, int timeout_ms, void *arch_info, int(*run_it)(struct target *target, uint32_t exit_point, int timeout_ms, void *arch_info))
 
static int armv4_5_set_core_reg (struct reg *reg, uint8_t *buf)
 
 COMMAND_HANDLER (handle_arm_core_state_command)
 
 COMMAND_HANDLER (handle_arm_disassemble_command)
 
 COMMAND_HANDLER (handle_armv4_5_reg_command)
 
bool is_arm_mode (unsigned psr_mode)
 Return true iff the parameter denotes a valid ARM processor mode. More...
 
static int jim_mcrmrc (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 

Variables

static const uint8_t arm_abt_indices [3]
 
const struct command_registration arm_all_profiles_command_handlers []
 
const struct command_registration arm_command_handlers []
 
struct {
   unsigned   cookie
 
   unsigned   gdb_index
 
   enum arm_mode   mode
 
   const char *   name
 
arm_core_regs []
 
static const struct command_registration arm_exec_command_handlers []
 
static const uint8_t arm_fiq_indices [8]
 
static struct reg_feature arm_gdb_dummy_fp_features
 
static struct reg arm_gdb_dummy_fp_reg
 Dummy FPA registers are required to support GDB on ARM. More...
 
static const uint8_t arm_gdb_dummy_fp_value [12]
 
static struct reg arm_gdb_dummy_fps_reg
 Dummy FPA status registers are required to support GDB on ARM. More...
 
static const uint8_t arm_gdb_dummy_fps_value [4]
 
static const uint8_t arm_hyp_indices [2]
 
static const uint8_t arm_irq_indices [3]
 
struct {
   const uint8_t *   indices
 
   unsigned short   n_indices
 
   const char *   name
 
   unsigned short   psr
 
arm_mode_data []
 
static const uint8_t arm_mon_indices [3]
 
static const struct reg_arch_type arm_reg_type
 
static const char * arm_state_strings []
 
static const uint8_t arm_svc_indices [3]
 
static const uint8_t arm_und_indices [3]
 
static const uint8_t arm_usr_indices [17]
 
struct {
   uint32_t   bits
 
   const char *   feature
 
   const char *   group
 
   unsigned int   id
 
   enum arm_mode   mode
 
   const char *   name
 
   enum reg_type   type
 
arm_vfp_v3_regs []
 
const int armv4_5_core_reg_map [9][17]
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
ARMV4_5_SPSR_FIQ 
ARMV4_5_SPSR_IRQ 
ARMV4_5_SPSR_SVC 
ARMV4_5_SPSR_ABT 
ARMV4_5_SPSR_UND 
ARM_SPSR_MON 
ARM_SPSR_HYP 

Definition at line 32 of file armv4_5.c.

Function Documentation

◆ arm_arch_state()

◆ arm_blank_check_memory()

int arm_blank_check_memory ( struct target target,
struct target_memory_check_block blocks,
int  num_blocks,
uint8_t  erased_value 
)

◆ arm_build_reg_cache()

◆ arm_checksum_memory()

◆ arm_default_mcr()

static int arm_default_mcr ( struct target target,
int  cpnum,
uint32_t  op1,
uint32_t  op2,
uint32_t  crn,
uint32_t  crm,
uint32_t  value 
)
static

Definition at line 1696 of file armv4_5.c.

References ERROR_FAIL, LOG_ERROR, and target_type_name().

Referenced by arm_init_arch_info().

◆ arm_default_mrc()

static int arm_default_mrc ( struct target target,
int  cpnum,
uint32_t  op1,
uint32_t  op2,
uint32_t  crn,
uint32_t  crm,
uint32_t *  value 
)
static

Definition at line 1687 of file armv4_5.c.

References ERROR_FAIL, LOG_ERROR, and target_type_name().

Referenced by arm_init_arch_info().

◆ arm_free_reg_cache()

◆ arm_full_context()

static int arm_full_context ( struct target target)
static

◆ arm_gdb_dummy_init()

static void arm_gdb_dummy_init ( void  )
static

Definition at line 566 of file armv4_5.c.

◆ arm_get_gdb_arch()

const char* arm_get_gdb_arch ( struct target target)

Definition at line 1189 of file armv4_5.c.

◆ arm_get_gdb_reg_list()

◆ arm_init_arch_info()

◆ arm_mode_name()

const char* arm_mode_name ( unsigned  psr_mode)

Map PSR mode bits to the name of an ARM processor operating mode.

Definition at line 171 of file armv4_5.c.

References arm_mode_data, ARRAY_SIZE, LOG_ERROR, and psr.

Referenced by adapter_debug_entry(), arm7_9_debug_entry(), arm7_9_restore_context(), arm_arch_state(), arm_set_cpsr(), armv7m_arch_state(), cortex_m_debug_entry(), and xscale_debug_entry().

◆ arm_mode_to_number()

int arm_mode_to_number ( enum arm_mode  mode)

Map PSR mode bits to linear number indexing armv4_5_core_reg_map.

Definition at line 192 of file armv4_5.c.

References ARM_MODE_1176_MON, ARM_MODE_ABT, ARM_MODE_ANY, ARM_MODE_FIQ, ARM_MODE_HYP, ARM_MODE_IRQ, ARM_MODE_MON, ARM_MODE_SVC, ARM_MODE_SYS, ARM_MODE_UND, ARM_MODE_USR, LOG_ERROR, and mode.

Referenced by arm_set_cpsr().

◆ arm_reg_current()

struct reg* arm_reg_current ( struct arm arm,
unsigned  regnum 
)

Returns handle to the register currently mapped to a given number.

Someone must have called arm_set_cpsr() before.

Parameters
armThis core's state and registers are used.
regnumFrom 0..15 corresponding to R0..R14 and PC. Note that R0..R7 don't require mapping; you may access those as the first eight entries in the register cache. Likewise R15 (PC) doesn't need mapping; you may also access it directly. However, R8..R14, and SPSR (arm->spsr) must be mapped. CPSR (arm->cpsr) is also not mapped.

Definition at line 502 of file armv4_5.c.

References arm::core_cache, LOG_ERROR, arm::map, NULL, and reg_cache::reg_list.

Referenced by arm7_9_debug_entry(), arm7_9_read_memory(), arm7_9_soft_reset_halt(), arm7_9_write_memory(), arm_dpm_read_current_registers(), arm_get_gdb_reg_list(), arm_semihosting(), COMMAND_HANDLER(), cortex_a_read_cpu_memory(), cortex_a_read_cpu_memory_slow(), cortex_a_write_cpu_memory(), cortex_a_write_cpu_memory_slow(), post_result(), and xscale_debug_entry().

◆ arm_set_cpsr()

◆ armv4_5_get_core_reg()

static int armv4_5_get_core_reg ( struct reg reg)
static

◆ armv4_5_number_to_mode()

enum arm_mode armv4_5_number_to_mode ( int  number)

Map linear number indexing armv4_5_core_reg_map to PSR mode bits.

Definition at line 192 of file armv4_5.c.

Referenced by arm7_9_full_context(), arm7_9_restore_context(), xscale_full_context(), and xscale_restore_banked().

◆ armv4_5_run_algorithm()

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,
int  timeout_ms,
void *  arch_info 
)

◆ armv4_5_run_algorithm_completion()

static int armv4_5_run_algorithm_completion ( struct target target,
uint32_t  exit_point,
int  timeout_ms,
void *  arch_info 
)
static

◆ armv4_5_run_algorithm_inner()

◆ armv4_5_set_core_reg()

static int armv4_5_set_core_reg ( struct reg reg,
uint8_t *  buf 
)
static

Definition at line 595 of file armv4_5.c.

Referenced by armv4_5_run_algorithm_inner().

◆ COMMAND_HANDLER() [1/3]

◆ COMMAND_HANDLER() [2/3]

◆ COMMAND_HANDLER() [3/3]

◆ is_arm_mode()

◆ jim_mcrmrc()

static int jim_mcrmrc ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)
static

Definition at line 992 of file armv4_5.c.

Variable Documentation

◆ arm_abt_indices

const uint8_t arm_abt_indices[3]
static
Initial value:
= {
}
@ ARMV4_5_SPSR_ABT
Definition: armv4_5.c:37

Definition at line 59 of file armv4_5.c.

◆ arm_all_profiles_command_handlers

const struct command_registration arm_all_profiles_command_handlers[]
Initial value:
= {
{
.name = "core_state",
.handler = handle_arm_core_state_command,
.mode = COMMAND_EXEC,
.usage = "['arm'|'thumb']",
.help = "display/change ARM core state",
},
{
.name = "disassemble",
.handler = handle_arm_disassemble_command,
.mode = COMMAND_EXEC,
.usage = "address [count ['thumb']]",
.help = "disassemble instructions",
},
{
},
}
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
Definition: command.h:247
@ COMMAND_EXEC
Definition: command.h:40
const struct command_registration semihosting_common_handlers[]

Definition at line 992 of file armv4_5.c.

◆ arm_command_handlers

const struct command_registration arm_command_handlers[]
Initial value:
= {
{
.name = "arm",
.mode = COMMAND_ANY,
.help = "ARM command group",
.usage = "",
},
}
static const struct command_registration arm_exec_command_handlers[]
Definition: armv4_5.c:1120
@ COMMAND_ANY
Definition: command.h:42

Definition at line 992 of file armv4_5.c.

◆ 

const { ... } arm_core_regs[]

◆ arm_exec_command_handlers

const struct command_registration arm_exec_command_handlers[]
static
Initial value:
= {
{
.name = "reg",
.handler = handle_armv4_5_reg_command,
.mode = COMMAND_EXEC,
.help = "display ARM core registers",
.usage = "",
},
{
.name = "mcr",
.mode = COMMAND_EXEC,
.jim_handler = &jim_mcrmrc,
.help = "write coprocessor register",
.usage = "cpnum op1 CRn CRm op2 value",
},
{
.name = "mrc",
.mode = COMMAND_EXEC,
.jim_handler = &jim_mcrmrc,
.help = "read coprocessor register",
.usage = "cpnum op1 CRn CRm op2",
},
{
},
}
const struct command_registration arm_all_profiles_command_handlers[]
Definition: armv4_5.c:1148
static int jim_mcrmrc(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
Definition: armv4_5.c:992

Definition at line 992 of file armv4_5.c.

◆ arm_fiq_indices

const uint8_t arm_fiq_indices[8]
static
Initial value:
= {
16, 17, 18, 19, 20, 21, 22, ARMV4_5_SPSR_FIQ,
}
@ ARMV4_5_SPSR_FIQ
Definition: armv4_5.c:34

Definition at line 47 of file armv4_5.c.

◆ arm_gdb_dummy_fp_features

struct reg_feature arm_gdb_dummy_fp_features
static
Initial value:
= {
.name = "net.sourceforge.openocd.fake_fpa"
}

Definition at line 526 of file armv4_5.c.

◆ arm_gdb_dummy_fp_reg

struct reg arm_gdb_dummy_fp_reg
static
Initial value:
= {
.name = "GDB dummy FPA register",
.value = (uint8_t *) arm_gdb_dummy_fp_value,
.valid = true,
.size = 96,
.exist = false,
.number = 16,
.group = "fake_fpa",
}
static const uint8_t arm_gdb_dummy_fp_value[12]
Definition: armv4_5.c:526
const char * group
Definition: armv4_5.c:362
static struct reg_feature arm_gdb_dummy_fp_features
Definition: armv4_5.c:528
const char * feature
Definition: armv4_5.c:363
enum esirisc_reg_num number
Definition: esirisc.c:87
size_t size
Size of the control block search area.
Definition: rtt/rtt.c:30

Dummy FPA registers are required to support GDB on ARM.

Register packets require eight obsolete FPA register values. Modern ARM cores use Vector Floating Point (VFP), if they have any floating point support. VFP is not FPA-compatible.

Definition at line 526 of file armv4_5.c.

Referenced by arm_get_gdb_reg_list().

◆ arm_gdb_dummy_fp_value

const uint8_t arm_gdb_dummy_fp_value[12]
static

Definition at line 526 of file armv4_5.c.

◆ arm_gdb_dummy_fps_reg

struct reg arm_gdb_dummy_fps_reg
static
Initial value:
= {
.name = "GDB dummy FPA status register",
.value = (uint8_t *) arm_gdb_dummy_fps_value,
.valid = true,
.size = 32,
.exist = false,
.number = 24,
.group = "fake_fpa",
}
static const uint8_t arm_gdb_dummy_fps_value[4]
Definition: armv4_5.c:549

Dummy FPA status registers are required to support GDB on ARM.

Register packets require an obsolete FPA status register.

Definition at line 549 of file armv4_5.c.

Referenced by arm_get_gdb_reg_list().

◆ arm_gdb_dummy_fps_value

const uint8_t arm_gdb_dummy_fps_value[4]
static

Definition at line 549 of file armv4_5.c.

◆ arm_hyp_indices

const uint8_t arm_hyp_indices[2]
static
Initial value:
= {
}
@ ARM_SPSR_HYP
Definition: armv4_5.c:40

Definition at line 71 of file armv4_5.c.

◆ arm_irq_indices

const uint8_t arm_irq_indices[3]
static
Initial value:
= {
}
@ ARMV4_5_SPSR_IRQ
Definition: armv4_5.c:35

Definition at line 51 of file armv4_5.c.

◆ 

const { ... } arm_mode_data[]

◆ arm_mon_indices

const uint8_t arm_mon_indices[3]
static
Initial value:
= {
39, 40, ARM_SPSR_MON,
}
@ ARM_SPSR_MON
Definition: armv4_5.c:39

Definition at line 67 of file armv4_5.c.

◆ arm_reg_type

const struct reg_arch_type arm_reg_type
static
Initial value:
= {
}
static int armv4_5_set_core_reg(struct reg *reg, uint8_t *buf)
Definition: armv4_5.c:595
static int armv4_5_get_core_reg(struct reg *reg)
Definition: armv4_5.c:574

Definition at line 595 of file armv4_5.c.

Referenced by arm_build_reg_cache().

◆ arm_state_strings

const char* arm_state_strings[]
static
Initial value:
= {
"ARM", "Thumb", "Jazelle", "ThumbEE",
}

Definition at line 250 of file armv4_5.c.

Referenced by arm_arch_state(), arm_set_cpsr(), and COMMAND_HANDLER().

◆ arm_svc_indices

const uint8_t arm_svc_indices[3]
static
Initial value:
= {
}
@ ARMV4_5_SPSR_SVC
Definition: armv4_5.c:36

Definition at line 55 of file armv4_5.c.

◆ arm_und_indices

const uint8_t arm_und_indices[3]
static
Initial value:
= {
}
@ ARMV4_5_SPSR_UND
Definition: armv4_5.c:38

Definition at line 63 of file armv4_5.c.

◆ arm_usr_indices

const uint8_t arm_usr_indices[17]
static
Initial value:
= {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ARMV4_5_CPSR,
}
@ ARMV4_5_CPSR
Definition: armv4_5.h:36

Definition at line 43 of file armv4_5.c.

◆ 

const { ... } arm_vfp_v3_regs[]

Referenced by arm_build_reg_cache().

◆ armv4_5_core_reg_map

const int armv4_5_core_reg_map[9][17]
Initial value:
= {
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 31
},
{
0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 15, 32
},
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 23, 24, 15, 33
},
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 25, 26, 15, 34
},
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 27, 28, 15, 35
},
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 29, 30, 15, 36
},
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 31
},
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 39, 40, 15, 41,
},
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 42, 14, 15, 43,
}
}

Definition at line 403 of file armv4_5.c.

Referenced by arm_set_cpsr().

◆ bits

◆ cookie

unsigned cookie

Definition at line 275 of file armv4_5.c.

Referenced by arm_build_reg_cache().

◆ feature

◆ gdb_index

unsigned gdb_index

Definition at line 276 of file armv4_5.c.

◆ group

const char* group

◆ id

unsigned int id

Definition at line 357 of file armv4_5.c.

◆ indices

const uint8_t* indices

Definition at line 82 of file armv4_5.c.

◆ mode

◆ n_indices

unsigned short n_indices

Definition at line 81 of file armv4_5.c.

Referenced by COMMAND_HANDLER().

◆ name

const char* name

Definition at line 76 of file armv4_5.c.

Referenced by __attribute__(), __register_commands(), adapter_assert_reset(), adapter_deassert_reset(), adapter_resets(), arc_build_bcr_reg_cache(), arc_build_reg_cache(), arc_reg_get_by_name(), arm_tpiu_swo_handle_event(), command_find_from_name(), COMMAND_HANDLER(), COMMAND_HELPER(), create_default_signal(), create_signal(), cti_find_reg_offset(), cti_instance_by_jim_obj(), dap_instance_by_jim_obj(), decode_dmi(), find_signal_by_name(), find_target(), flash_driver_find_by_name(), flash_driver_name_matches(), fm4_get_info_command(), ft232r_bit_name_to_number(), gdb_generate_target_description(), gdb_get_register_packet(), gdb_get_registers_packet(), gdb_set_register_packet(), gdb_set_registers_packet(), get_flash_bank_by_name(), get_flash_bank_by_name_noprobe(), get_flash_name_index(), get_gpio_index(), get_nand_device_by_name(), hwthread_get_thread_reg_list(), jim_adapter_name(), jim_arc_add_reg_type_flags(), jim_arc_add_reg_type_struct(), jim_arc_read_reg_name_field(), jim_nvp_name2value(), jim_nvp_name2value_nocase(), jim_nvp_name2value_nocase_simple(), jim_nvp_name2value_simple(), jim_set_result_nvp_unknown(), jim_target_types(), jtag_examine_chain_display(), kinetis_create_missing_banks(), kinetis_probe_chip(), linux_thread_extra_info(), msp432_probe(), nand_driver_find_by_name(), open_write_close(), or1k_create_reg_list(), parse_ranges(), pic32mx_info(), pic32mx_probe(), rcmd_offset(), read_channel_name(), register_get_by_name(), remove_service(), riot_get_thread_reg_list(), riot_update_threads(), rtos_create(), tap_state_by_name(), target_call_reset_callbacks(), target_create(), target_wait_state(), telnet_auto_complete(), transport_select(), ublast_init(), unregister_command(), xtensa_build_reg_cache(), xtensa_fetch_all_regs(), xtensa_write_dirty_registers(), and zephyr_create().

◆ psr

unsigned short psr

Definition at line 77 of file armv4_5.c.

Referenced by arm_mode_name(), COMMAND_HANDLER(), and is_arm_mode().

◆ type

enum reg_type type

Definition at line 359 of file armv4_5.c.