43 assert(sequence_found);
48 const uint32_t magic[] = {
60 for (
int i = 0; i < 3; i++) {
68 *sequence_found =
false;
78 if (value != magic[i]) {
80 *sequence_found =
false;
87 *sequence_found =
true;
120 bool sequence_found =
false;
128 if (sequence_found) {
131 "but semihosting is disabled!");
134 "by command 'arm semihosting enable'.");
144 if (!sequence_found) {
uint32_t address
Starting address. Sector aligned.
#define LOG_TARGET_WARNING(target, fmt_str,...)
#define LOG_TARGET_ERROR(target, fmt_str,...)
#define LOG_TARGET_DEBUG(target, fmt_str,...)
unsigned int riscv_xlen(const struct target *target)
int riscv_read_by_any_size(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
Read one memory item using any memory access size that will work.
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.
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.
static int riscv_semihosting_post_result(struct target *target)
void riscv_semihosting_init(struct target *target)
Initialize RISC-V semihosting.
enum semihosting_result riscv_semihosting(struct target *target, int *retval)
Check for and process a semihosting request using the ARM protocol).
static int riscv_semihosting_setup(struct target *target, int enable)
Called via semihosting->setup() later, after the target is known, usually on the first semihosting co...
static int riscv_semihosting_detect_magic_sequence(struct target *target, const target_addr_t pc, bool *sequence_found)
int semihosting_common_init(struct target *target, void *setup, void *post_result)
Initialize common semihosting support.
int semihosting_common(struct target *target)
Portable implementation of ARM semihosting calls.
bool is_resumable
Most are resumable, except the two exit calls.
bool hit_fileio
A flag reporting whether semihosting fileio operation is active.
size_t word_size_bytes
The Target (hart) word size; 8 for 64-bits targets.
int64_t result
The current semihosting result to be returned to the application.
bool is_active
A flag reporting whether semihosting is active.
int op
The current semihosting operation (R0 on ARM).
uint64_t param
The current semihosting parameter (R1 or ARM).
clock_t setup_time
The current time when 'execution starts'.
struct semihosting * semihosting
static uint32_t le_to_h_u32(const uint8_t *buf)