aboutsummaryrefslogtreecommitdiff
path: root/tcg
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2023-04-18 18:34:31 +0200
committerRichard Henderson <richard.henderson@linaro.org>2023-05-16 15:21:39 -0700
commit81f004b22354857a9cad9619a466a9d7eaffa975 (patch)
treeb7406917ab84d292a65a9a7f08eeff52535a7891 /tcg
parenta0d99b3f47a4fa0ccd07a9a8280b272167d18c15 (diff)
downloadqemu-81f004b22354857a9cad9619a466a9d7eaffa975.zip
qemu-81f004b22354857a9cad9619a466a9d7eaffa975.tar.gz
qemu-81f004b22354857a9cad9619a466a9d7eaffa975.tar.bz2
tcg/loongarch64: Check the host supports unaligned accesses
This should be true of all loongarch64 running Linux. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tcg')
-rw-r--r--tcg/loongarch64/tcg-target.c.inc9
1 files changed, 9 insertions, 0 deletions
diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc
index e651ec5..33d8e67 100644
--- a/tcg/loongarch64/tcg-target.c.inc
+++ b/tcg/loongarch64/tcg-target.c.inc
@@ -30,6 +30,7 @@
*/
#include "../tcg-ldst.c.inc"
+#include <asm/hwcap.h>
#ifdef CONFIG_DEBUG_TCG
static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = {
@@ -1674,6 +1675,14 @@ static void tcg_target_qemu_prologue(TCGContext *s)
static void tcg_target_init(TCGContext *s)
{
+ unsigned long hwcap = qemu_getauxval(AT_HWCAP);
+
+ /* Server and desktop class cpus have UAL; embedded cpus do not. */
+ if (!(hwcap & HWCAP_LOONGARCH_UAL)) {
+ error_report("TCG: unaligned access support required; exiting");
+ exit(EXIT_FAILURE);
+ }
+
tcg_target_available_regs[TCG_TYPE_I32] = ALL_GENERAL_REGS;
tcg_target_available_regs[TCG_TYPE_I64] = ALL_GENERAL_REGS;