Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
rth7680 committed May 16, 2023
1 parent 474f48f commit fba265f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tcg/loongarch64/tcg-target.c.inc
Expand Up @@ -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] = {
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit fba265f

Please sign in to comment.