From: Taylor R Campbell Date: Fri, 25 Jan 2019 04:31:15 +0000 (+0000) Subject: Fix comment about ADRP to reflect reality. X-Git-Tag: mit-scheme-pucked-10.1.20~11^2~66^2~17 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=8b2e18eb0902bbaa6397bdca6bc83ec794b5cd4f;p=mit-scheme.git Fix comment about ADRP to reflect reality. --- diff --git a/src/microcode/cmpintmd/aarch64.c b/src/microcode/cmpintmd/aarch64.c index 54aa33e5c..af2c6f3b5 100644 --- a/src/microcode/cmpintmd/aarch64.c +++ b/src/microcode/cmpintmd/aarch64.c @@ -270,9 +270,9 @@ write_uuo_insns (insn_t * target, insn_t * iaddr, int pcrel) } else { - /* ADRP takes 21-bit signed number of 4096-byte pages, and - adds that many 4096-byte pages to the PC. We then need to - add the offset within a page of the target. */ + /* ADRP computes PC - (PC mod 2^12) + 2^12*offset. We know + target - PC, and we want target. First we add the page + offset; then we add target's location in its page. */ uintptr_t from_pg = (((uintptr_t) from_pc) >> 12); uintptr_t to_pg = (((uintptr_t) to_pc) >> 12); ptrdiff_t pgoff = (((intptr_t) to_pg) - ((intptr_t) from_pg));