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

Go to the source code of this file.

Macros

#define ARMV8_NUM_REGS   ARRAY_SIZE(armv8_regs)
 
#define ARMV8_NUM_REGS32   ARRAY_SIZE(armv8_regs32)
 

Functions

static __attribute__ ((unused))
 
static int armv8_aarch64_state (struct target *target)
 
int armv8_arch_state (struct target *target)
 
struct reg_cachearmv8_build_reg_cache (struct target *target)
 Builds cache of architecturally defined registers. More...
 
static void armv8_free_cache (struct reg_cache *cache, bool regs32)
 
void armv8_free_reg_cache (struct target *target)
 
static int armv8_get_core_reg (struct reg *reg)
 
static int armv8_get_core_reg32 (struct reg *reg)
 
const char * armv8_get_gdb_arch (struct target *target)
 
int armv8_get_gdb_reg_list (struct target *target, struct reg **reg_list[], int *reg_list_size, enum target_register_class reg_class)
 
int armv8_handle_cache_info_command (struct command_invocation *cmd, struct armv8_cache_common *armv8_cache)
 
int armv8_init_arch_info (struct target *target, struct armv8_common *armv8)
 
int armv8_mmu_translate_va (struct target *target, target_addr_t va, target_addr_t *val)
 
int armv8_mmu_translate_va_pa (struct target *target, target_addr_t va, target_addr_t *val, int meminfo)
 
const char * armv8_mode_name (unsigned psr_mode)
 Map PSR mode bits to the name of an ARM processor operating mode. More...
 
static uint8_t armv8_pa_size (uint32_t ps)
 
int armv8_read_mpidr (struct armv8_common *armv8)
 
static int armv8_read_reg (struct armv8_common *armv8, int regnum, uint64_t *regval)
 
static int armv8_read_reg32 (struct armv8_common *armv8, int regnum, uint64_t *regval)
 
static int armv8_read_reg_simdfp_aarch32 (struct armv8_common *armv8, int regnum, uint64_t *lvalue, uint64_t *hvalue)
 
static int armv8_read_reg_simdfp_aarch64 (struct armv8_common *armv8, int regnum, uint64_t *lvalue, uint64_t *hvalue)
 
struct regarmv8_reg_current (struct arm *arm, unsigned regnum)
 
void armv8_select_reg_access (struct armv8_common *armv8, bool is_aarch64)
 
static int armv8_set_core_reg (struct reg *reg, uint8_t *buf)
 
static int armv8_set_core_reg32 (struct reg *reg, uint8_t *buf)
 
void armv8_set_cpsr (struct arm *arm, uint32_t cpsr)
 Configures host-side ARM records to reflect the specified CPSR. More...
 
int armv8_set_dbgreg_bits (struct armv8_common *armv8, unsigned int reg, unsigned long mask, unsigned long value)
 
static int armv8_setup_semihosting (struct target *target, int enable)
 
static void armv8_show_fault_registers32 (struct armv8_common *armv8)
 
static int armv8_write_reg (struct armv8_common *armv8, int regnum, uint64_t value_64)
 
static int armv8_write_reg32 (struct armv8_common *armv8, int regnum, uint64_t value)
 
static int armv8_write_reg_simdfp_aarch32 (struct armv8_common *armv8, int regnum, uint64_t lvalue, uint64_t hvalue)
 
static int armv8_write_reg_simdfp_aarch64 (struct armv8_common *armv8, int regnum, uint64_t lvalue, uint64_t hvalue)
 
 COMMAND_HANDLER (armv8_handle_exception_catch_command)
 

Variables

static struct reg_data_type_bitfield aarch64_cpsr_bits []
 
static struct reg_data_type_flags_field aarch64_cpsr_fields []
 
static struct reg_data_type_flags aarch64_cpsr_flags []
 
static struct reg_data_type aarch64_flags_cpsr []
 
static struct reg_data_type aarch64_fpu_union []
 
static struct reg_data_type aarch64_fpu_vector []
 
static struct reg_data_type_union_field aarch64_union_fields_vnb []
 
static struct reg_data_type_union_field aarch64_union_fields_vnd []
 
static struct reg_data_type_union_field aarch64_union_fields_vnh []
 
static struct reg_data_type_union_field aarch64_union_fields_vnq []
 
static struct reg_data_type_union_field aarch64_union_fields_vns []
 
static struct reg_data_type_union aarch64_union_types []
 
static struct reg_data_type aarch64_vector_base_types []
 
static struct reg_data_type_vector aarch64_vector_types []
 
static struct reg_data_type aarch64v []
 
static struct reg_data_type_union aarch64v_union []
 
static struct reg_data_type_union_field aarch64v_union_fields []
 
const struct command_registration armv8_command_handlers []
 
struct {
   const char *   name
 
   unsigned   psr
 
armv8_mode_data []
 
static const struct reg_arch_type armv8_reg32_type
 
static const struct reg_arch_type armv8_reg_type
 
struct {
   unsigned   bits
 
   struct reg_data_type *   data_type
 
   const char *   feature
 
   const char *   group
 
   unsigned   id
 
   enum arm_mode   mode
 
   const char *   name
 
   enum reg_type   type
 
armv8_regs []
 
struct {
   unsigned   bits
 
   const char *   feature
 
   const char *   group
 
   unsigned   id
 
   unsigned   mapping
 
   enum arm_mode   mode
 
   const char *   name
 
   enum reg_type   type
 
armv8_regs32 []
 
static const char *const armv8_state_strings []
 

Macro Definition Documentation

◆ ARMV8_NUM_REGS

#define ARMV8_NUM_REGS   ARRAY_SIZE(armv8_regs)

Definition at line 1488 of file armv8.c.

◆ ARMV8_NUM_REGS32

#define ARMV8_NUM_REGS32   ARRAY_SIZE(armv8_regs32)

Definition at line 1489 of file armv8.c.

Function Documentation

◆ __attribute__()

static __attribute__ ( (unused)  )
static

◆ armv8_aarch64_state()

◆ armv8_arch_state()

int armv8_arch_state ( struct target target)

Definition at line 1144 of file armv8.c.

◆ armv8_build_reg_cache()

◆ armv8_free_cache()

static void armv8_free_cache ( struct reg_cache cache,
bool  regs32 
)
static

◆ armv8_free_reg_cache()

void armv8_free_reg_cache ( struct target target)

Definition at line 1726 of file armv8.c.

Referenced by aarch64_deinit_target().

◆ armv8_get_core_reg()

static int armv8_get_core_reg ( struct reg reg)
static

◆ armv8_get_core_reg32()

◆ armv8_get_gdb_arch()

const char* armv8_get_gdb_arch ( struct target target)

Definition at line 1751 of file armv8.c.

References ARM_STATE_AARCH64, arm::core_state, and target_to_arm().

◆ armv8_get_gdb_reg_list()

int armv8_get_gdb_reg_list ( struct target target,
struct reg **  reg_list[],
int *  reg_list_size,
enum target_register_class  reg_class 
)

◆ armv8_handle_cache_info_command()

int armv8_handle_cache_info_command ( struct command_invocation cmd,
struct armv8_cache_common armv8_cache 
)

◆ armv8_init_arch_info()

◆ armv8_mmu_translate_va()

int armv8_mmu_translate_va ( struct target target,
target_addr_t  va,
target_addr_t val 
)

Definition at line 922 of file armv8.c.

References ERROR_OK.

◆ armv8_mmu_translate_va_pa()

◆ armv8_mode_name()

const char* armv8_mode_name ( unsigned  psr_mode)

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

Definition at line 107 of file armv8.c.

References armv8_mode_data, ARRAY_SIZE, LOG_ERROR, and psr.

Referenced by aarch64_post_debug_entry(), aarch64_restore_system_control_reg(), armv8_aarch64_state(), and armv8_set_cpsr().

◆ armv8_pa_size()

static uint8_t armv8_pa_size ( uint32_t  ps)
static

Definition at line 775 of file armv8.c.

References LOG_INFO.

◆ armv8_read_mpidr()

◆ armv8_read_reg()

◆ armv8_read_reg32()

◆ armv8_read_reg_simdfp_aarch32()

static int armv8_read_reg_simdfp_aarch32 ( struct armv8_common armv8,
int  regnum,
uint64_t *  lvalue,
uint64_t *  hvalue 
)
static

◆ armv8_read_reg_simdfp_aarch64()

static int armv8_read_reg_simdfp_aarch64 ( struct armv8_common armv8,
int  regnum,
uint64_t *  lvalue,
uint64_t *  hvalue 
)
static

◆ armv8_reg_current()

◆ armv8_select_reg_access()

◆ armv8_set_core_reg()

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

Definition at line 1503 of file armv8.c.

◆ armv8_set_core_reg32()

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

Definition at line 1564 of file armv8.c.

◆ armv8_set_cpsr()

void armv8_set_cpsr ( struct arm arm,
uint32_t  cpsr 
)

Configures host-side ARM records to reflect the specified CPSR.

Later, code can use arm_reg_current() to map register numbers according to how they are exposed by this mode.

Definition at line 675 of file armv8.c.

References ARM_STATE_AARCH64, ARM_STATE_ARM, ARM_STATE_JAZELLE, ARM_STATE_THUMB, ARM_STATE_THUMB_EE, armv8_mode_name(), armv8_state_strings, buf_set_u32(), arm::core_mode, arm::core_state, arm::cpsr, reg::dirty, LOG_DEBUG, LOG_ERROR, LOG_WARNING, mode, state, reg::valid, and reg::value.

Referenced by armv8_dpm_read_current_registers().

◆ armv8_set_dbgreg_bits()

int armv8_set_dbgreg_bits ( struct armv8_common armv8,
unsigned int  reg,
unsigned long  mask,
unsigned long  value 
)

◆ armv8_setup_semihosting()

static int armv8_setup_semihosting ( struct target target,
int  enable 
)
static

Definition at line 1099 of file armv8.c.

References ERROR_OK.

Referenced by armv8_init_arch_info().

◆ armv8_show_fault_registers32()

static void armv8_show_fault_registers32 ( struct armv8_common armv8)
static

◆ armv8_write_reg()

◆ armv8_write_reg32()

◆ armv8_write_reg_simdfp_aarch32()

static int armv8_write_reg_simdfp_aarch32 ( struct armv8_common armv8,
int  regnum,
uint64_t  lvalue,
uint64_t  hvalue 
)
static

◆ armv8_write_reg_simdfp_aarch64()

static int armv8_write_reg_simdfp_aarch64 ( struct armv8_common armv8,
int  regnum,
uint64_t  lvalue,
uint64_t  hvalue 
)
static

◆ COMMAND_HANDLER()

Variable Documentation

◆ aarch64_cpsr_bits

struct reg_data_type_bitfield aarch64_cpsr_bits[]
static
Initial value:
= {
{ 0, 0, REG_TYPE_UINT8 },
{ 2, 3, REG_TYPE_UINT8 },
{ 4, 4, REG_TYPE_UINT8 },
{ 6, 6, REG_TYPE_BOOL },
{ 7, 7, REG_TYPE_BOOL },
{ 8, 8, REG_TYPE_BOOL },
{ 9, 9, REG_TYPE_BOOL },
{ 20, 20, REG_TYPE_BOOL },
{ 21, 21, REG_TYPE_BOOL },
{ 28, 28, REG_TYPE_BOOL },
{ 29, 29, REG_TYPE_BOOL },
{ 30, 30, REG_TYPE_BOOL },
{ 31, 31, REG_TYPE_BOOL },
}
@ REG_TYPE_BOOL
Definition: register.h:20
@ REG_TYPE_UINT8
Definition: register.h:28

Definition at line 1144 of file armv8.c.

◆ aarch64_cpsr_fields

struct reg_data_type_flags_field aarch64_cpsr_fields[]
static
Initial value:
= {
{ "N", aarch64_cpsr_bits + 12, NULL }
}
static struct reg_data_type_flags_field aarch64_cpsr_fields[]
Definition: armv8.c:1298
static struct reg_data_type_bitfield aarch64_cpsr_bits[]
Definition: armv8.c:1282
#define NULL
Definition: usb.h:16

Definition at line 1144 of file armv8.c.

◆ aarch64_cpsr_flags

struct reg_data_type_flags aarch64_cpsr_flags[]
static
Initial value:
= {
}

Definition at line 1144 of file armv8.c.

◆ aarch64_flags_cpsr

struct reg_data_type aarch64_flags_cpsr[]
static
Initial value:
= {
{.reg_type_flags = aarch64_cpsr_flags} },
}
static struct reg_data_type_flags aarch64_cpsr_flags[]
Definition: armv8.c:1314
@ REG_TYPE_ARCH_DEFINED
Definition: register.h:38
@ REG_TYPE_CLASS_FLAGS
Definition: register.h:96

Definition at line 1144 of file armv8.c.

◆ aarch64_fpu_union

struct reg_data_type aarch64_fpu_union[]
static
Initial value:
= {
{REG_TYPE_ARCH_DEFINED, "vnd", REG_TYPE_CLASS_UNION, {.reg_type_union = aarch64_union_types + 0} },
{REG_TYPE_ARCH_DEFINED, "vns", REG_TYPE_CLASS_UNION, {.reg_type_union = aarch64_union_types + 1} },
{REG_TYPE_ARCH_DEFINED, "vnh", REG_TYPE_CLASS_UNION, {.reg_type_union = aarch64_union_types + 2} },
{REG_TYPE_ARCH_DEFINED, "vnb", REG_TYPE_CLASS_UNION, {.reg_type_union = aarch64_union_types + 3} },
{REG_TYPE_ARCH_DEFINED, "vnq", REG_TYPE_CLASS_UNION, {.reg_type_union = aarch64_union_types + 4} },
}
static struct reg_data_type_union aarch64_union_types[]
Definition: armv8.c:1249
@ REG_TYPE_CLASS_UNION
Definition: register.h:94

Definition at line 1144 of file armv8.c.

◆ aarch64_fpu_vector

◆ aarch64_union_fields_vnb

struct reg_data_type_union_field aarch64_union_fields_vnb[]
static
Initial value:
= {
{"s", aarch64_fpu_vector + 9, NULL},
}
static struct reg_data_type_union_field aarch64_union_fields_vnb[]
Definition: armv8.c:1239
static struct reg_data_type aarch64_fpu_vector[]
Definition: armv8.c:1207

Definition at line 1144 of file armv8.c.

◆ aarch64_union_fields_vnd

struct reg_data_type_union_field aarch64_union_fields_vnd[]
static
Initial value:
= {
{"s", aarch64_fpu_vector + 2, NULL},
}
static struct reg_data_type_union_field aarch64_union_fields_vnd[]
Definition: armv8.c:1222

Definition at line 1144 of file armv8.c.

◆ aarch64_union_fields_vnh

struct reg_data_type_union_field aarch64_union_fields_vnh[]
static
Initial value:
= {
{"s", aarch64_fpu_vector + 7, NULL},
}
static struct reg_data_type_union_field aarch64_union_fields_vnh[]
Definition: armv8.c:1234

Definition at line 1144 of file armv8.c.

◆ aarch64_union_fields_vnq

struct reg_data_type_union_field aarch64_union_fields_vnq[]
static
Initial value:
= {
{"s", aarch64_fpu_vector + 11, NULL},
}
static struct reg_data_type_union_field aarch64_union_fields_vnq[]
Definition: armv8.c:1244

Definition at line 1144 of file armv8.c.

◆ aarch64_union_fields_vns

struct reg_data_type_union_field aarch64_union_fields_vns[]
static
Initial value:
= {
{"s", aarch64_fpu_vector + 5, NULL},
}
static struct reg_data_type_union_field aarch64_union_fields_vns[]
Definition: armv8.c:1228

Definition at line 1144 of file armv8.c.

◆ aarch64_union_types

struct reg_data_type_union aarch64_union_types[]
static

◆ aarch64_vector_base_types

struct reg_data_type aarch64_vector_base_types[]
static
Initial value:
= {
{REG_TYPE_IEEE_DOUBLE, "ieee_double", 0, {NULL} },
{REG_TYPE_UINT64, "uint64", 0, {NULL} },
{REG_TYPE_INT64, "int64", 0, {NULL} },
{REG_TYPE_IEEE_SINGLE, "ieee_single", 0, {NULL} },
{REG_TYPE_UINT32, "uint32", 0, {NULL} },
{REG_TYPE_INT32, "int32", 0, {NULL} },
{REG_TYPE_UINT16, "uint16", 0, {NULL} },
{REG_TYPE_INT16, "int16", 0, {NULL} },
{REG_TYPE_UINT8, "uint8", 0, {NULL} },
{REG_TYPE_INT8, "int8", 0, {NULL} },
{REG_TYPE_UINT128, "uint128", 0, {NULL} },
{REG_TYPE_INT128, "int128", 0, {NULL} }
}
@ REG_TYPE_UINT16
Definition: register.h:29
@ REG_TYPE_IEEE_DOUBLE
Definition: register.h:37
@ REG_TYPE_INT64
Definition: register.h:25
@ REG_TYPE_INT16
Definition: register.h:23
@ REG_TYPE_UINT32
Definition: register.h:30
@ REG_TYPE_INT32
Definition: register.h:24
@ REG_TYPE_INT128
Definition: register.h:26
@ REG_TYPE_UINT128
Definition: register.h:32
@ REG_TYPE_UINT64
Definition: register.h:31
@ REG_TYPE_INT8
Definition: register.h:22
@ REG_TYPE_IEEE_SINGLE
Definition: register.h:36

Definition at line 1144 of file armv8.c.

◆ aarch64_vector_types

struct reg_data_type_vector aarch64_vector_types[]
static
Initial value:

Definition at line 1144 of file armv8.c.

◆ aarch64v

struct reg_data_type aarch64v[]
static
Initial value:
= {
{.reg_type_union = aarch64v_union} },
}
static struct reg_data_type_union aarch64v_union[]
Definition: armv8.c:1273

Definition at line 1144 of file armv8.c.

◆ aarch64v_union

struct reg_data_type_union aarch64v_union[]
static
Initial value:
= {
}
static struct reg_data_type_union_field aarch64v_union_fields[]
Definition: armv8.c:1265

Definition at line 1144 of file armv8.c.

◆ aarch64v_union_fields

struct reg_data_type_union_field aarch64v_union_fields[]
static
Initial value:
= {
{"q", aarch64_fpu_union + 4, NULL},
}
static struct reg_data_type aarch64_fpu_union[]
Definition: armv8.c:1257

Definition at line 1144 of file armv8.c.

◆ armv8_command_handlers

const struct command_registration armv8_command_handlers[]
Initial value:
= {
{
.name = "catch_exc",
.handler = armv8_handle_exception_catch_command,
.mode = COMMAND_EXEC,
.help = "configure exception catch",
.usage = "[(nsec_el1,nsec_el2,sec_el1,sec_el3)+,off]",
},
}
#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

Definition at line 1726 of file armv8.c.

◆ 

const { ... } armv8_mode_data[]

Referenced by armv8_mode_name().

◆ armv8_reg32_type

const struct reg_arch_type armv8_reg32_type
static
Initial value:
= {
}
static int armv8_get_core_reg32(struct reg *reg)
Definition: armv8.c:1538
static int armv8_set_core_reg32(struct reg *reg, uint8_t *buf)
Definition: armv8.c:1564

Definition at line 1564 of file armv8.c.

Referenced by armv8_build_reg_cache().

◆ armv8_reg_type

const struct reg_arch_type armv8_reg_type
static
Initial value:
= {
}
static int armv8_get_core_reg(struct reg *reg)
Definition: armv8.c:1491
static int armv8_set_core_reg(struct reg *reg, uint8_t *buf)
Definition: armv8.c:1503

Definition at line 1503 of file armv8.c.

Referenced by armv8_build_reg_cache().

◆ 

const { ... } armv8_regs[]

Referenced by armv8_build_reg_cache().

◆ 

const { ... } armv8_regs32[]

Referenced by armv8_build_reg_cache().

◆ armv8_state_strings

const char* const armv8_state_strings[]
static
Initial value:
= {
"AArch32", "Thumb", "Jazelle", "ThumbEE", "AArch64",
}

Definition at line 32 of file armv8.c.

Referenced by armv8_aarch64_state(), and armv8_set_cpsr().

◆ bits

unsigned bits

Definition at line 1326 of file armv8.c.

◆ data_type

struct reg_data_type* data_type

◆ feature

const char* feature

Definition at line 1330 of file armv8.c.

Referenced by armv8_build_reg_cache().

◆ group

const char* group

Definition at line 1329 of file armv8.c.

◆ id

unsigned id

Definition at line 1324 of file armv8.c.

◆ mapping

unsigned mapping

Definition at line 1428 of file armv8.c.

◆ mode

enum arm_mode mode

Definition at line 1326 of file armv8.c.

Referenced by armv8_set_cpsr().

◆ name

const char* name

Definition at line 37 of file armv8.c.

◆ psr

unsigned psr

Definition at line 38 of file armv8.c.

Referenced by armv8_mode_name().

◆ type

enum reg_type type

Definition at line 1326 of file armv8.c.