target/arm: Restrict semi-hosting to TCG

Semihosting hooks either SVC or HLT instructions, and inside KVM
both of those go to EL1, ie to the guest, and can't be trapped to
KVM.

Let check_for_semihosting() return False when not running on TCG.

backports commit 91f78c58da9ba78c8ed00f5d822b701765be8499 from qemu
This commit is contained in:
Philippe Mathieu-Daudé 2019-08-08 17:48:29 -04:00 committed by Lioncash
parent 6295fd7156
commit 199e2f8a7d
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
2 changed files with 14 additions and 1 deletions

View file

@ -910,7 +910,14 @@ static inline void aarch64_sve_change_el(CPUARMState *env, int o,
{ }
#endif
#if !defined(CONFIG_TCG)
static inline target_ulong do_arm_semihosting(CPUARMState *env)
{
g_assert_not_reached();
}
#else
target_ulong do_arm_semihosting(CPUARMState *env);
#endif
void aarch64_sync_32_to_64(CPUARMState *env);
void aarch64_sync_64_to_32(CPUARMState *env);

View file

@ -18,8 +18,10 @@
#include "qemu/crc32c.h"
#include "exec/exec-all.h"
#include "exec/cpu_ldst.h"
#include "arm_ldst.h"
#include "qemu/range.h"
#ifdef CONFIG_TCG
#include "arm_ldst.h"
#endif
#define ARM_CPU_FREQ 1000000000 /* FIXME: 1 GHz, should be configurable */
@ -10214,6 +10216,7 @@ static inline bool check_for_semihosting(CPUState *cs)
// Unicorn: ifdefd out
#if 0
#ifdef CONFIG_TCG
/*
* Check whether this exception is a semihosting call; if so
* then handle it and return true; otherwise return false.
@ -10293,6 +10296,9 @@ static inline bool check_for_semihosting(CPUState *cs)
env->regs[0] = do_arm_semihosting(env);
return true;
}
#else
return false;
#endif
#endif
}