82 return &riscv013_reg_type;
149 const unsigned int vlen_max = 65536;
150 const unsigned int vlenb_max = vlen_max / 8;
151 if (vlenb_val > vlenb_max) {
153 "' is greater than maximum allowed by specification (%u); vector register access won't work.",
154 vlenb_val, vlenb_max);
158 assert(vlenb_max <= UINT_MAX);
159 r->vlenb = (
unsigned int)vlenb_val;
193 "OpenOCD will not be able to determine some hart's capabilities.");
200 const unsigned int mxl =
get_field(r->misa, misa_mxl_mask);
225 "MXLEN: misa.mxl == 0, misa == 0x%" PRIx64
".",
232 "MXLEN (%u) reported in misa.mxl field exceeds "
233 "the detected DXLEN (%u)",
360 "Only cacheable registers can be saved.");
380 "The register is cacheable, so the cache entry must be valid now.");
char * buf_to_hex_str(const void *_buf, unsigned int buf_len)
static uint64_t buf_get_u64(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 64-bit word.
static void buf_set_u64(uint8_t *_buffer, unsigned int first, unsigned int num, uint64_t value)
Sets num bits in _buffer, starting at the first bit, using the bits in value.
#define AC_ACCESS_REGISTER_TRANSFER
static uint64_t get_field(uint64_t reg, uint64_t mask)
#define LOG_TARGET_INFO(target, fmt_str,...)
#define LOG_TARGET_WARNING(target, fmt_str,...)
#define LOG_TARGET_ERROR(target, fmt_str,...)
#define LOG_TARGET_DEBUG(target, fmt_str,...)
#define ERROR_TIMEOUT_REACHED
int riscv013_set_register_buf(struct target *target, enum gdb_regno regno, const uint8_t *value)
uint32_t riscv013_access_register_command(struct target *target, uint32_t number, unsigned int size, uint32_t flags)
int riscv013_get_register_buf(struct target *target, uint8_t *value, enum gdb_regno regno)
int riscv013_execute_abstract_command(struct target *target, uint32_t command, uint32_t *cmderr)
static int assume_reg_exist(struct target *target, uint32_t regno)
Some registers are optional (e.g.
static int check_misa_mxl(const struct target *target)
unsigned int mxl_to_xlen(enum misa_mxl mxl)
int riscv013_reg_examine_all(struct target *target)
This function assumes target's DM to be initialized (target is able to access DMs registers,...
static int examine_xlen(struct target *target)
static int riscv013_reg_get(struct reg *reg)
int riscv013_reg_save(struct target *target, enum gdb_regno regid)
This function is used to save the value of a register in cache.
static int examine_vlenb(struct target *target)
static int examine_mtopi(struct target *target)
static int examine_misa(struct target *target)
static int init_cache_entry(struct target *target, uint32_t regno)
static int riscv013_reg_set(struct reg *reg, uint8_t *buf)
static const struct reg_arch_type * riscv013_gdb_regno_reg_type(uint32_t regno)
unsigned int riscv_xlen(const struct target *target)
bool riscv_supports_extension(const struct target *target, char letter)
int riscv_reg_impl_set_exist(const struct target *target, uint32_t regno, bool exist)
Mark register as existing or not.
void riscv_reg_impl_hide_csrs(const struct target *target)
Hide additional CSRs, as specified by riscv_info_t::hide_csr list.
bool riscv_reg_impl_gdb_regno_exist(const struct target *target, uint32_t regno)
For most registers, returns whether they exist or not.
struct target * riscv_reg_impl_get_target(const struct reg *reg)
Return the target that owns the cache entry.
int riscv_reg_set(struct target *target, enum gdb_regno regid, riscv_reg_t value)
This function is used to change the value of a register.
const char * riscv_reg_gdb_regno_name(const struct target *target, enum gdb_regno regno)
This file describes the register cache interface available to the RISC-V target.
int riscv_reg_impl_expose_csrs(const struct target *target)
Expose additional CSRs, as specified by riscv_info_t::expose_csr list.
int riscv_reg_impl_init_cache_entry(struct target *target, uint32_t regno, bool exist, const struct reg_arch_type *reg_type)
Initialize register.
int riscv_reg_impl_init_cache(struct target *target)
Initialize register cache.
int riscv_reg_get(struct target *target, riscv_reg_t *value, enum gdb_regno regid)
This function is used to get the value of a register.
struct reg * riscv_reg_impl_cache_entry(const struct target *target, uint32_t number)
Return the entry in the register cache of the target.
static bool riscv_reg_impl_is_initialized(const struct reg *reg)
This file describes the helpers to use during register cache initialization of a RISC-V target.
static void init_shared_reg_info(struct target *target)
static void riscv_reg_impl_init_vector_reg_type(const struct target *target)
TODO: vector register type description can be moved into riscv013_info_t, since 0....
static bool riscv_reg_impl_gdb_regno_cacheable(enum gdb_regno regno, bool is_write)
If write is true: return true iff we are guaranteed that the register will contain exactly the value ...
int(* get)(struct reg *reg)
struct reg_cache * reg_cache
static bool target_was_examined(const struct target *target)
#define DIV_ROUND_UP(m, n)
Rounds m up to the nearest multiple of n using division.