From: Taylor R Campbell Date: Sun, 20 Jan 2019 00:19:13 +0000 (+0000) Subject: Fix PC-relative calculations to work entirely in newspace. X-Git-Tag: mit-scheme-pucked-10.1.20~11^2~66^2~52 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=3cfe907181bb616b8baeda273a5b2ea59fc8a390;p=mit-scheme.git Fix PC-relative calculations to work entirely in newspace. --- diff --git a/src/microcode/cmpintmd/aarch64.c b/src/microcode/cmpintmd/aarch64.c index 4ec526ede..01b7889cc 100644 --- a/src/microcode/cmpintmd/aarch64.c +++ b/src/microcode/cmpintmd/aarch64.c @@ -241,7 +241,9 @@ write_uuo_insns (insn_t * target, insn_t * iaddr, int pcrel) we don't know where the PC will be in the newspace. */ if ((((const int64_t *) (newspace_to_tospace (target)))[-1]) == 0) { - ptrdiff_t offset = (((uintptr_t) target) - ((uintptr_t) (&iaddr[1]))); + char * from_pc = (tospace_to_newspace ((char *) (&iaddr[1]))); + char * to_pc = ((char *) target); + ptrdiff_t offset = (to_pc - from_pc); assert ((offset & 3) == 0); if ((-0x10000000 <= offset) && (offset <= 0xfffffff)) {