From e5dea048c1cd9fb8cd85175074388da3430b09f3 Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Sat, 5 May 2018 10:03:26 +0200 Subject: [PATCH] emit_ARM64Instr: fix assertion failures associated with chaining patching (ARM64in_XDirect). n-i-bz. This has happened because (I think!) this has never before been tested with guest code addresses >= 2^48. This in turn means that this is the first time that p = imm64_to_ireg(p, /*x*/9, i->ARM64in.XDirect.dstGA); has been called upon to emit a constant which is non-zero in all four 16-bit chunks, so it generates 4 instructions rather than (at most, in all previous runs) 3, and so the "how many insns at max" assertions failed. This commit fixes the assertions. --- VEX/priv/host_arm64_defs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VEX/priv/host_arm64_defs.c b/VEX/priv/host_arm64_defs.c index 4d088c77b4..a1328ff8fe 100644 --- a/VEX/priv/host_arm64_defs.c +++ b/VEX/priv/host_arm64_defs.c @@ -3572,7 +3572,7 @@ Int emit_ARM64Instr ( /*MB_MOD*/Bool* is_profInc, /* Fix up the conditional jump, if there was one. */ if (i->ARM64in.XDirect.cond != ARM64cc_AL) { Int delta = (UChar*)p - (UChar*)ptmp; /* must be signed */ - vassert(delta > 0 && delta < 40); + vassert(delta > 0 && delta <= 40); vassert((delta & 3) == 0); UInt notCond = 1 ^ (UInt)i->ARM64in.XDirect.cond; vassert(notCond <= 13); /* Neither AL nor NV */ @@ -5481,7 +5481,7 @@ Int emit_ARM64Instr ( /*MB_MOD*/Bool* is_profInc, /*NOTREACHED*/ done: - vassert(((UChar*)p) - &buf[0] <= 36); + vassert(((UChar*)p) - &buf[0] <= 40); return ((UChar*)p) - &buf[0]; } -- 2.47.2