Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Aarch64-SIM: BLR opcode does not support XLR register properly.
@ 2020-02-05 11:21 Carlo Bramini
  2020-02-05 11:39 ` Luis Machado
  0 siblings, 1 reply; 5+ messages in thread
From: Carlo Bramini @ 2020-02-05 11:21 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 230 bytes --]

After a suggestion received at your bugzilla, I'm posting here a patch. Detailed explanation can be found here:

https://sourceware.org/bugzilla/show_bug.cgi?id=25318

Thank you very much for your time and your support.
Sincerely.

[-- Attachment #2: sim_aarch64.patch --]
[-- Type: application/octet-stream, Size: 1337 bytes --]

diff --git a/sim/aarch64/simulator.c b/sim/aarch64/simulator.c
index 60972976fc..0b8dd8a146 100644
--- a/sim/aarch64/simulator.c
+++ b/sim/aarch64/simulator.c
@@ -1174,7 +1174,7 @@ ldrsw_abs (sim_cpu *cpu, uint32_t offset)
   val = aarch64_get_mem_s32 (cpu, aarch64_get_reg_u64 (cpu, rn, SP_OK)
 			     + SCALE (offset, 32));
   /* The target register may not be SP but the source may be.  */
-  return aarch64_set_reg_s64 (cpu, rt, NO_SP, val);
+  aarch64_set_reg_s64 (cpu, rt, NO_SP, val);
 }
 
 /* 64 bit load sign-extended 32 bit unscaled signed 9 bit
@@ -13437,13 +13437,13 @@ br (sim_cpu *cpu)
 static void
 blr (sim_cpu *cpu)
 {
-  unsigned rn = INSTR (9, 5);
+  uint64_t target = aarch64_get_reg_u64 (cpu, INSTR (9, 5), NO_SP);
 
   TRACE_DECODE (cpu, "emulated at line %d", __LINE__);
   /* The pseudo code in the spec says we update LR before fetching.
      the value from the rn.  */
   aarch64_save_LR (cpu);
-  aarch64_set_next_PC (cpu, aarch64_get_reg_u64 (cpu, rn, NO_SP));
+  aarch64_set_next_PC (cpu, target);
 
   if (TRACE_BRANCH_P (cpu))
     {
@@ -14222,7 +14222,8 @@ dexBr (sim_cpu *cpu)
   switch (group2)
     {
     case BR_IMM_000:
-      return dexBranchImmediate (cpu);
+      dexBranchImmediate (cpu);
+      return;
 
     case BR_IMMCMP_001:
       /* Compare has bit 25 clear while test has it set.  */

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-02-06 22:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-05 11:21 [PATCH] Aarch64-SIM: BLR opcode does not support XLR register properly Carlo Bramini
2020-02-05 11:39 ` Luis Machado
2020-02-05 17:14   ` Carlo Bramini
2020-02-05 17:25     ` Carlo Bramini
2020-02-06 22:59       ` Andrew Burgess

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox