From 8b2e18eb0902bbaa6397bdca6bc83ec794b5cd4f Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Fri, 25 Jan 2019 04:31:15 +0000 Subject: [PATCH] Fix comment about ADRP to reflect reality. --- src/microcode/cmpintmd/aarch64.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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)); -- 2.25.1