19 memset(p, 0,
sizeof(*p));
51 LOG_DEBUG(
"Saving register %d as used by program", (
int)i);
61 LOG_ERROR(
"ram[%02x]: DASM(0x%08" PRIx32
") [0x%08" PRIx32
"]",
70 LOG_DEBUG(
"Unable to execute program %p", p);
178 LOG_ERROR(
"Unable to insert instruction:");
#define LOG_ERROR(expr ...)
#define LOG_DEBUG(expr ...)
static uint32_t csrrw(unsigned int rd, unsigned int rs, unsigned int csr) __attribute__((unused))
static uint32_t lb(unsigned int rd, unsigned int base, uint16_t offset) __attribute__((unused))
static uint32_t csrrs(unsigned int rd, unsigned int rs, unsigned int csr) __attribute__((unused))
static uint32_t fence(void) __attribute__((unused))
static uint32_t fence_i(void) __attribute__((unused))
static uint32_t lh(unsigned int rd, unsigned int base, uint16_t offset) __attribute__((unused))
static uint32_t csrrci(unsigned int rd, unsigned int zimm, unsigned int csr) __attribute__((unused))
static uint32_t sh(unsigned int src, unsigned int base, uint16_t offset) __attribute__((unused))
static uint32_t sw(unsigned int src, unsigned int base, uint16_t offset) __attribute__((unused))
static uint32_t ebreak(void) __attribute__((unused))
static uint32_t csrrsi(unsigned int rd, unsigned int zimm, unsigned int csr) __attribute__((unused))
static uint32_t ld(unsigned int rd, unsigned int base, uint16_t offset) __attribute__((unused))
static uint32_t sd(unsigned int src, unsigned int base, uint16_t offset) __attribute__((unused))
static uint32_t sb(unsigned int src, unsigned int base, uint16_t offset) __attribute__((unused))
static uint32_t lw(unsigned int rd, unsigned int base, uint16_t offset) __attribute__((unused))
static uint32_t addi(unsigned int dest, unsigned int src, uint16_t imm) __attribute__((unused))
int riscv_program_fence_i(struct riscv_program *p)
int riscv_program_lbr(struct riscv_program *p, enum gdb_regno d, enum gdb_regno b, int offset)
int riscv_program_write(struct riscv_program *program)
int riscv_program_fence(struct riscv_program *p)
int riscv_program_csrrsi(struct riscv_program *p, enum gdb_regno d, unsigned int z, enum gdb_regno csr)
int riscv_program_addi(struct riscv_program *p, enum gdb_regno d, enum gdb_regno s, int16_t u)
int riscv_program_ldr(struct riscv_program *p, enum gdb_regno d, enum gdb_regno b, int offset)
int riscv_program_insert(struct riscv_program *p, riscv_insn_t i)
int riscv_program_csrr(struct riscv_program *p, enum gdb_regno d, enum gdb_regno csr)
int riscv_program_init(struct riscv_program *p, struct target *target)
int riscv_program_csrw(struct riscv_program *p, enum gdb_regno s, enum gdb_regno csr)
int riscv_program_lhr(struct riscv_program *p, enum gdb_regno d, enum gdb_regno b, int offset)
int riscv_program_ebreak(struct riscv_program *p)
int riscv_program_swr(struct riscv_program *p, enum gdb_regno d, enum gdb_regno b, int offset)
int riscv_program_lwr(struct riscv_program *p, enum gdb_regno d, enum gdb_regno b, int offset)
int riscv_program_sdr(struct riscv_program *p, enum gdb_regno d, enum gdb_regno b, int offset)
int riscv_program_shr(struct riscv_program *p, enum gdb_regno d, enum gdb_regno b, int offset)
int riscv_program_exec(struct riscv_program *p, struct target *t)
Add ebreak and execute the program.
int riscv_program_csrrci(struct riscv_program *p, enum gdb_regno d, unsigned int z, enum gdb_regno csr)
int riscv_program_sbr(struct riscv_program *p, enum gdb_regno d, enum gdb_regno b, int offset)
#define RISCV_MAX_DEBUG_BUFFER_SIZE
#define RISCV_REGISTER_COUNT
int riscv_set_register(struct target *target, enum gdb_regno regid, riscv_reg_t value)
This function is called when the debug user wants to change the value of a register.
int riscv_write_debug_buffer(struct target *target, int index, riscv_insn_t insn)
unsigned riscv_xlen(const struct target *target)
int riscv_execute_debug_buffer(struct target *target)
size_t riscv_debug_buffer_size(struct target *target)
int riscv_get_register(struct target *target, riscv_reg_t *value, enum gdb_regno regid)
Get register, from the cache if it's in there.
riscv_insn_t riscv_read_debug_buffer(struct target *target, int index)
uint32_t debug_buffer[RISCV_MAX_DEBUG_BUFFER_SIZE]
bool writes_xreg[RISCV_REGISTER_COUNT]