From 3143b218946395834f0bfef741061ac6ef3f5b56 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Thu, 30 Mar 2017 11:17:15 +0200 Subject: ARM64: Add big-endian support. Contributed by Djordje Kovacevic and Stefan Pejic from RT-RK.com. Sponsored by Cisco Systems, Inc. --- src/host/buildvm_asm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/host') diff --git a/src/host/buildvm_asm.c b/src/host/buildvm_asm.c index addf281f..1a633602 100644 --- a/src/host/buildvm_asm.c +++ b/src/host/buildvm_asm.c @@ -93,10 +93,14 @@ static void emit_asm_words(BuildCtx *ctx, uint8_t *p, int n) { int i; for (i = 0; i < n; i += 4) { + uint32_t ins = *(uint32_t *)(p+i); +#if LJ_TARGET_ARM64 && LJ_BE + ins = lj_bswap(ins); /* ARM64 instructions are always little-endian. */ +#endif if ((i & 15) == 0) - fprintf(ctx->fp, "\t.long 0x%08x", *(uint32_t *)(p+i)); + fprintf(ctx->fp, "\t.long 0x%08x", ins); else - fprintf(ctx->fp, ",0x%08x", *(uint32_t *)(p+i)); + fprintf(ctx->fp, ",0x%08x", ins); if ((i & 15) == 12) putc('\n', ctx->fp); } if ((n & 15) != 0) putc('\n', ctx->fp); -- cgit v1.2.3-55-g6feb