16 va_start(args, format);
18 length = vsprintf(buf + curr, format, args);
23 return (
unsigned int)
length;
28 const char *
const format = value > 9 ?
"0x%" PRIx64 :
"%" PRIx64;
34 const char *
const *field_value_names, uint64_t
field_value)
36 const char *
const field_value_name = field_value_names ?
40 if (!field_value_name)
57 assert(field.
msb < 64);
58 assert(field.
msb >= field.
lsb);
59 const uint64_t trailing_ones_mask = (uint64_t)(-1) >> (63 - field.
msb);
60 return (value & trailing_ones_mask) >> field.
lsb;
68 unsigned int curr =
offset;
72 list = get_next(context);
79 (list.field.values && list.field.values[0]))) ||
102 if (
reg.get_fields_head)
104 reg.get_fields_head, context, value, show);
struct riscv_debug_reg_info get_riscv_debug_reg_info(enum riscv_debug_reg_ordinal reg_ordinal)
static unsigned int riscv_debug_reg_field_to_s(char *buf, unsigned int offset, struct riscv_debug_reg_field_info field, struct riscv_debug_reg_ctx context, uint64_t field_value)
static unsigned int riscv_debug_reg_field_value_to_s(char *buf, unsigned int offset, const char *const *field_value_names, uint64_t field_value)
static unsigned int riscv_debug_reg_fields_to_s(char *buf, unsigned int offset, struct riscv_debug_reg_field_list(*get_next)(struct riscv_debug_reg_ctx contex), struct riscv_debug_reg_ctx context, uint64_t value, enum riscv_debug_reg_show show)
unsigned int riscv_debug_reg_to_s(char *buf, enum riscv_debug_reg_ordinal reg_ordinal, struct riscv_debug_reg_ctx context, uint64_t value, enum riscv_debug_reg_show show)
This function is used to fill a buffer with a decoded string representation of register's value.
static unsigned int print_number(char *buf, unsigned int offset, uint64_t value)
static uint64_t riscv_debug_reg_field_value(struct riscv_debug_reg_field_info field, uint64_t value)
static unsigned int get_len_or_sprintf(char *buf, unsigned int curr, const char *format,...)
@ RISCV_DEBUG_REG_HIDE_ALL_0
@ RISCV_DEBUG_REG_SHOW_ALL
@ RISCV_DEBUG_REG_HIDE_UNNAMED_0
static uint64_t field_value(uint64_t mask, uint64_t val)
struct riscv_debug_reg_field_list(* get_next)(struct riscv_debug_reg_ctx context)