master: arm64, arch_do_displaced_inst: handle ldrsw (literal)

stassats via Sbcl-commits <[email protected]> Wed, 20 May 2026 23:14:25 +0000
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  b5895fddc932fb8814fd2ececc0d9b8d39c36afd (commit)
      from  8225c3f22bc7ea599a57235e92eb765e9eb8a68e (commit)

- Log -----------------------------------------------------------------
commit b5895fddc932fb8814fd2ececc0d9b8d39c36afd
Author: Stas Boukarev <[email protected]>
Date:   Thu May 21 02:08:40 2026 +0300

    arm64, arch_do_displaced_inst: handle ldrsw (literal)
---
 src/runtime/arm64-arch.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/runtime/arm64-arch.c b/src/runtime/arm64-arch.c
index f1eebad19..b9a966851 100644
--- a/src/runtime/arm64-arch.c
+++ b/src/runtime/arm64-arch.c
@@ -199,10 +199,14 @@ void arch_do_displaced_inst(os_context_t *context, unsigned int orig_inst)
         int opc = (orig_inst >> 30) & 0b11;
         int rt = orig_inst & 0b11111;
         int offset = sign_extend((orig_inst >> 5) & ~(1 << 19), 19);
+        unsigned int *new_pc = (pc + offset);
+
         if (opc == 0b01)
-            *os_context_register_addr(context, rt) = *((uint64_t *)(pc + offset));
+            *os_context_register_addr(context, rt) = *((uint64_t *)new_pc);
         else if (opc == 0b00)
-            *os_context_register_addr(context, rt) = *((uint32_t *)(pc + offset));
+            *os_context_register_addr(context, rt) = *((uint32_t *)new_pc);
+        else if (opc == 0b10)
+            *os_context_register_addr(context, rt) = *((int32_t *)new_pc);
         else
             lose("Unsupported LDR (literal) variant. %x", orig_inst);
         next_pc += 1;

-----------------------------------------------------------------------


hooks/post-receive
-- 
SBCL