[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 35/43] target/m68k: Make semihosting system only
From: |
Richard Henderson |
Subject: |
[PATCH 35/43] target/m68k: Make semihosting system only |
Date: |
Sat, 30 Apr 2022 06:29:24 -0700 |
While we had a call to do_m68k_semihosting in linux-user, it
wasn't actually reachable. We don't include DISAS_INSN(halt)
as an instruction unless system mode.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
linux-user/m68k/cpu_loop.c | 5 -----
target/m68k/m68k-semi.c | 37 +------------------------------------
target/m68k/meson.build | 6 ++++--
3 files changed, 5 insertions(+), 43 deletions(-)
diff --git a/linux-user/m68k/cpu_loop.c b/linux-user/m68k/cpu_loop.c
index d1bf8548b7..fa6aa112cb 100644
--- a/linux-user/m68k/cpu_loop.c
+++ b/linux-user/m68k/cpu_loop.c
@@ -36,11 +36,6 @@ void cpu_loop(CPUM68KState *env)
process_queued_cpu_work(cs);
switch(trapnr) {
- case EXCP_HALT_INSN:
- /* Semihosing syscall. */
- env->pc += 4;
- do_m68k_semihosting(env, env->dregs[0]);
- break;
case EXCP_ILLEGAL:
case EXCP_LINEA:
case EXCP_LINEF:
diff --git a/target/m68k/m68k-semi.c b/target/m68k/m68k-semi.c
index 5b4c51957e..4b5621a101 100644
--- a/target/m68k/m68k-semi.c
+++ b/target/m68k/m68k-semi.c
@@ -21,13 +21,9 @@
#include "cpu.h"
#include "exec/gdbstub.h"
-#if defined(CONFIG_USER_ONLY)
-#include "qemu.h"
-#define SEMIHOSTING_HEAP_SIZE (128 * 1024 * 1024)
-#else
+#include "semihosting/guestfd.h"
#include "semihosting/softmmu-uaccess.h"
#include "hw/boards.h"
-#endif
#include "qemu/log.h"
#define HOSTED_EXIT 0
@@ -375,43 +371,12 @@ void do_m68k_semihosting(CPUM68KState *env, int nr)
}
break;
case HOSTED_INIT_SIM:
-#if defined(CONFIG_USER_ONLY)
- {
- CPUState *cs = env_cpu(env);
- TaskState *ts = cs->opaque;
- /* Allocate the heap using sbrk. */
- if (!ts->heap_limit) {
- abi_ulong ret;
- uint32_t size;
- uint32_t base;
-
- base = do_brk(0);
- size = SEMIHOSTING_HEAP_SIZE;
- /* Try a big heap, and reduce the size if that fails. */
- for (;;) {
- ret = do_brk(base + size);
- if (ret >= (base + size)) {
- break;
- }
- size >>= 1;
- }
- ts->heap_limit = base + size;
- }
- /*
- * This call may happen before we have writable memory, so return
- * values directly in registers.
- */
- env->dregs[1] = ts->heap_limit;
- env->aregs[7] = ts->stack_base;
- }
-#else
/*
* FIXME: This is wrong for boards where RAM does not start at
* address zero.
*/
env->dregs[1] = current_machine->ram_size;
env->aregs[7] = current_machine->ram_size;
-#endif
return;
default:
cpu_abort(env_cpu(env), "Unsupported semihosting syscall %d\n", nr);
diff --git a/target/m68k/meson.build b/target/m68k/meson.build
index 05cd9fbd1e..27d2d7ba87 100644
--- a/target/m68k/meson.build
+++ b/target/m68k/meson.build
@@ -4,14 +4,16 @@ m68k_ss.add(files(
'fpu_helper.c',
'gdbstub.c',
'helper.c',
- 'm68k-semi.c',
'op_helper.c',
'softfloat.c',
'translate.c',
))
m68k_softmmu_ss = ss.source_set()
-m68k_softmmu_ss.add(files('monitor.c'))
+m68k_softmmu_ss.add(files(
+ 'm68k-semi.c',
+ 'monitor.c'
+))
target_arch += {'m68k': m68k_ss}
target_softmmu_arch += {'m68k': m68k_softmmu_ss}
--
2.34.1
- [PATCH 11/43] semihosting: Move common-semi.h to include/semihosting/, (continued)
- [PATCH 11/43] semihosting: Move common-semi.h to include/semihosting/, Richard Henderson, 2022/04/30
- [PATCH 17/43] semihosting: Split out common_semi_has_synccache, Richard Henderson, 2022/04/30
- [PATCH 13/43] include/exec: Move gdb_stat and gdb_timeval to gdbstub.h, Richard Henderson, 2022/04/30
- [PATCH 25/43] semihosting: Split out semihost_sys_lseek, Richard Henderson, 2022/04/30
- [PATCH 12/43] include/exec: Move gdb open flags to gdbstub.h, Richard Henderson, 2022/04/30
- [PATCH 05/43] semihosting: Add target_strlen for softmmu-uaccess.h, Richard Henderson, 2022/04/30
- [PATCH 20/43] semihosting: Split out semihost_sys_open, Richard Henderson, 2022/04/30
- [PATCH 19/43] semihosting: Move GET_ARG/SET_ARG earlier in the file, Richard Henderson, 2022/04/30
- [PATCH 24/43] semihosting: Bound length for semihost_sys_{read, write}, Richard Henderson, 2022/04/30
- [PATCH 33/43] gdbstub: Widen gdb_syscall_complete_cb return value, Richard Henderson, 2022/04/30
- [PATCH 35/43] target/m68k: Make semihosting system only,
Richard Henderson <=
- [PATCH 39/43] target/m68k: Remove EXCP_HALT_INSN, Richard Henderson, 2022/04/30
- [PATCH 09/43] semihosting: Return void from do_common_semihosting, Richard Henderson, 2022/04/30
- [PATCH 15/43] semihosting: Split is_64bit_semihosting per target, Richard Henderson, 2022/04/30
- [PATCH 14/43] semihosting: Use struct gdb_stat in common_semi_flen_cb, Richard Henderson, 2022/04/30
- [PATCH 22/43] semihosting: Split out semihost_sys_read, Richard Henderson, 2022/04/30
- [PATCH 21/43] semihosting: Split out semihost_sys_close, Richard Henderson, 2022/04/30
- [PATCH 26/43] semihosting: Split out semihost_sys_isatty, Richard Henderson, 2022/04/30
- [PATCH 27/43] semihosting: Split out semihost_sys_flen, Richard Henderson, 2022/04/30
- [PATCH 30/43] semihosting: Split out semihost_sys_system, Richard Henderson, 2022/04/30
- [PATCH 31/43] semihosting: Create semihost_sys_{stat,fstat}, Richard Henderson, 2022/04/30