#include "qemu/osdep.h"
#include "qemu/timer.h"
#include "exec/gdbstub.h"
+#include "gdbstub/syscalls.h"
#include "semihosting/semihost.h"
#include "semihosting/console.h"
#include "semihosting/common-semi.h"
* The semihosting API has no concept of its errno being thread-safe,
* as the API design predates SMP CPUs and was intended as a simple
* real-hardware set of debug functionality. For QEMU, we make the
- * errno be per-thread in linux-user mode; in softmmu it is a simple
+ * errno be per-thread in linux-user mode; in system-mode it is a simple
* global, and we assume that the guest takes care of avoiding any races.
*/
#ifndef CONFIG_USER_ONLY
static target_ulong syscall_err;
-#include "semihosting/softmmu-uaccess.h"
+#include "semihosting/uaccess.h"
#endif
static inline uint32_t get_swi_errno(CPUState *cs)
static void common_semi_rw_cb(CPUState *cs, uint64_t ret, int err)
{
/* Recover the original length from the third argument. */
- CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
+ CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
target_ulong args = common_semi_arg(cs, 1);
target_ulong arg2;
GET_ARG(2);
common_semi_readc_cb(CPUState *cs, uint64_t ret, int err)
{
if (!err) {
- CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
+ CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
uint8_t ch;
if (get_user_u8(ch, common_semi_stack_bottom(cs) - 1)) {
*/
void do_common_semihosting(CPUState *cs)
{
- CPUArchState *env = cs->env_ptr;
+ CPUArchState *env = cpu_env(cs);
target_ulong args;
target_ulong arg0, arg1, arg2, arg3;
target_ulong ul_ret;
char * s;
int nr;
- uint32_t ret;
int64_t elapsed;
nr = common_semi_arg(cs, 0) & 0xffffffffU;
GET_ARG(0);
GET_ARG(1);
GET_ARG(2);
- len = asprintf(&s, "/tmp/qemu-%x%02x", getpid(), (int)arg1 & 0xff);
+ len = asprintf(&s, "%s/qemu-%x%02x", g_get_tmp_dir(),
+ getpid(), (int)arg1 & 0xff);
if (len < 0) {
common_semi_set_ret(cs, -1);
break;
case TARGET_SYS_EXIT:
case TARGET_SYS_EXIT_EXTENDED:
+ {
+ uint32_t ret;
+
if (common_semi_sys_exit_extended(cs, nr)) {
/*
* The A64 version of SYS_EXIT takes a parameter block,
}
gdb_exit(ret);
exit(ret);
+ }
case TARGET_SYS_ELAPSED:
elapsed = get_clock() - clock_start;