Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Carlo Bramini <carlo.bramix@libero.it>
To: gdb-patches@sourceware.org
Subject: [PATCH] Aarch64-SIM: BLR opcode does not support XLR register properly.
Date: Wed, 05 Feb 2020 11:21:00 -0000	[thread overview]
Message-ID: <2054623523.792939.1580901671145@mail1.libero.it> (raw)

[-- 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.  */

             reply	other threads:[~2020-02-05 11:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-05 11:21 Carlo Bramini [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2054623523.792939.1580901671145@mail1.libero.it \
    --to=carlo.bramix@libero.it \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox