17 #define ESP_XTENSA_SYSCALL 0x41E0
18 #define ESP_XTENSA_SYSCALL_SZ 3
20 #define XTENSA_SYSCALL_OP_REG XT_REG_IDX_A2
21 #define XTENSA_SYSCALL_RETVAL_REG XT_REG_IDX_A2
22 #define XTENSA_SYSCALL_ERRNO_REG XT_REG_IDX_A3
58 uint8_t brk_insn_buf[
sizeof(uint32_t)] = { 0 };
66 uint32_t syscall_ins =
buf_get_u32(brk_insn_buf, 0, 32);
static uint32_t buf_get_u32(const uint8_t *_buffer, unsigned first, unsigned num)
Retrieves num bits from _buffer, starting at the first bit, returning the bits in a 32-bit word.
int esp_semihosting_common(struct target *target)
static struct esp_xtensa_common * target_to_esp_xtensa(struct target *target)
int esp_xtensa_semihosting_init(struct target *target)
static int xtensa_semihosting_init(struct target *target)
#define ESP_XTENSA_SYSCALL_SZ
#define XTENSA_SYSCALL_RETVAL_REG
int esp_xtensa_semihosting(struct target *target, int *retval)
Checks and processes an ESP Xtensa semihosting request.
#define ESP_XTENSA_SYSCALL
static int esp_xtensa_semihosting_post_result(struct target *target)
#define XTENSA_SYSCALL_ERRNO_REG
static int esp_xtensa_semihosting_setup(struct target *target, int enable)
#define LOG_TARGET_ERROR(target, fmt_str,...)
#define LOG_TARGET_DEBUG(target, fmt_str,...)
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.
struct esp_semihost_ops * ops
int(* prepare)(struct target *target)
Callback called before handling semihost call.
struct esp_semihost_data semihost
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.
int(* user_command_extension)(struct target *target)
Target's extension of semihosting user commands.
int64_t result
The current semihosting result to be returned to the application.
char * basedir
Base directory for semihosting I/O operations.
int op
The current semihosting operation (R0 on ARM).
int sys_errno
The value to be returned by semihosting SYS_ERRNO request.
uint64_t param
The current semihosting parameter (R1 or ARM).
struct semihosting * semihosting
int target_read_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
Read count items of size bytes from the memory of target at the address given.
void xtensa_reg_set(struct target *target, enum xtensa_reg_id reg_id, xtensa_reg_val_t value)
xtensa_reg_val_t xtensa_reg_get(struct target *target, enum xtensa_reg_id reg_id)
Holds the interface to Xtensa cores.
uint32_t xtensa_reg_val_t