aboutsummaryrefslogtreecommitdiff
path: root/semihosting
diff options
context:
space:
mode:
Diffstat (limited to 'semihosting')
-rw-r--r--semihosting/Kconfig1
-rw-r--r--semihosting/arm-compat-semi.c1
-rw-r--r--semihosting/console.c3
-rw-r--r--semihosting/meson.build12
-rw-r--r--semihosting/stubs-all.c6
-rw-r--r--semihosting/stubs-system.c6
-rw-r--r--semihosting/syscalls.c2
-rw-r--r--semihosting/uaccess.c5
-rw-r--r--semihosting/user.c21
9 files changed, 45 insertions, 12 deletions
diff --git a/semihosting/Kconfig b/semihosting/Kconfig
index eaf3a20..fbe6ac8 100644
--- a/semihosting/Kconfig
+++ b/semihosting/Kconfig
@@ -1,6 +1,7 @@
config SEMIHOSTING
bool
+ depends on TCG
config ARM_COMPATIBLE_SEMIHOSTING
bool
diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c
index d78c642..86e5260 100644
--- a/semihosting/arm-compat-semi.c
+++ b/semihosting/arm-compat-semi.c
@@ -166,6 +166,7 @@ static LayoutInfo common_semi_find_bases(CPUState *cs)
#endif
+#include "cpu.h"
#include "common-semi-target.h"
/*
diff --git a/semihosting/console.c b/semihosting/console.c
index 60102bb..c3683a1 100644
--- a/semihosting/console.c
+++ b/semihosting/console.c
@@ -18,14 +18,15 @@
#include "qemu/osdep.h"
#include "semihosting/semihost.h"
#include "semihosting/console.h"
+#include "exec/cpu-common.h"
#include "exec/gdbstub.h"
-#include "exec/exec-all.h"
#include "qemu/log.h"
#include "chardev/char.h"
#include "chardev/char-fe.h"
#include "qemu/main-loop.h"
#include "qapi/error.h"
#include "qemu/fifo8.h"
+#include "hw/core/cpu.h"
/* Access to this structure is protected by the BQL */
typedef struct SemihostingConsole {
diff --git a/semihosting/meson.build b/semihosting/meson.build
index 34933e5..f3d38dd 100644
--- a/semihosting/meson.build
+++ b/semihosting/meson.build
@@ -4,13 +4,17 @@ specific_ss.add(when: 'CONFIG_SEMIHOSTING', if_true: files(
))
specific_ss.add(when: ['CONFIG_SEMIHOSTING', 'CONFIG_SYSTEM_ONLY'], if_true: files(
- 'config.c',
- 'console.c',
'uaccess.c',
))
-common_ss.add(when: ['CONFIG_SEMIHOSTING', 'CONFIG_SYSTEM_ONLY'], if_false: files('stubs-all.c'))
-system_ss.add(when: ['CONFIG_SEMIHOSTING'], if_false: files('stubs-system.c'))
+common_ss.add(when: 'CONFIG_SEMIHOSTING', if_false: files('stubs-all.c'))
+user_ss.add(when: 'CONFIG_SEMIHOSTING', if_true: files('user.c'))
+system_ss.add(when: 'CONFIG_SEMIHOSTING', if_true: files(
+ 'config.c',
+ 'console.c',
+), if_false: files(
+ 'stubs-system.c',
+))
specific_ss.add(when: ['CONFIG_ARM_COMPATIBLE_SEMIHOSTING'],
if_true: files('arm-compat-semi.c'))
diff --git a/semihosting/stubs-all.c b/semihosting/stubs-all.c
index a2a1fc9..c001c84 100644
--- a/semihosting/stubs-all.c
+++ b/semihosting/stubs-all.c
@@ -11,6 +11,12 @@
#include "qemu/osdep.h"
#include "semihosting/semihost.h"
+/* Queries to config status default to off */
+bool semihosting_enabled(bool is_user)
+{
+ return false;
+}
+
SemihostingTarget semihosting_get_target(void)
{
return SEMIHOSTING_TARGET_AUTO;
diff --git a/semihosting/stubs-system.c b/semihosting/stubs-system.c
index f26cbb7..989789f 100644
--- a/semihosting/stubs-system.c
+++ b/semihosting/stubs-system.c
@@ -22,12 +22,6 @@ QemuOptsList qemu_semihosting_config_opts = {
},
};
-/* Queries to config status default to off */
-bool semihosting_enabled(bool is_user)
-{
- return false;
-}
-
/*
* All the rest are empty subs. We could g_assert_not_reached() but
* that adds extra weight to the final binary. Waste not want not.
diff --git a/semihosting/syscalls.c b/semihosting/syscalls.c
index c40348f..f6451d9 100644
--- a/semihosting/syscalls.c
+++ b/semihosting/syscalls.c
@@ -7,6 +7,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "cpu.h"
#include "gdbstub/syscalls.h"
#include "semihosting/guestfd.h"
@@ -287,6 +288,7 @@ static void host_open(CPUState *cs, gdb_syscall_complete_cb complete,
ret = open(p, host_flags, mode);
if (ret < 0) {
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: failed to open %s\n", __func__, p);
complete(cs, -1, errno);
} else {
int guestfd = alloc_guestfd();
diff --git a/semihosting/uaccess.c b/semihosting/uaccess.c
index dc587d7..4554844 100644
--- a/semihosting/uaccess.c
+++ b/semihosting/uaccess.c
@@ -8,7 +8,10 @@
*/
#include "qemu/osdep.h"
-#include "exec/exec-all.h"
+#include "accel/tcg/cpu-mmu-index.h"
+#include "accel/tcg/probe.h"
+#include "exec/target_page.h"
+#include "exec/tlb-flags.h"
#include "semihosting/uaccess.h"
void *uaccess_lock_user(CPUArchState *env, target_ulong addr,
diff --git a/semihosting/user.c b/semihosting/user.c
new file mode 100644
index 0000000..98c144c
--- /dev/null
+++ b/semihosting/user.c
@@ -0,0 +1,21 @@
+/*
+ * Semihosting for user emulation
+ *
+ * Copyright (c) 2019 Linaro Ltd
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "semihosting/semihost.h"
+
+bool semihosting_enabled(bool is_user)
+{
+ assert(is_user);
+ return true;
+}
+
+SemihostingTarget semihosting_get_target(void)
+{
+ return SEMIHOSTING_TARGET_AUTO;
+}