Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Nick Clifton <nickc@redhat.com>
To: Jim Wilson <jim.wilson@linaro.org>, gdb-patches@sourceware.org
Subject: Re: [PATCH] aarch64 sim big-endian support
Date: Mon, 13 Jun 2016 12:38:00 -0000	[thread overview]
Message-ID: <a3725d02-298b-2323-4716-22eed88b8e0c@redhat.com> (raw)
In-Reply-To: <CABXYE2XbZ3ANw2BBf79Lvtn0=VbhKXQn7Gmn0RkwR6_89mFBcw@mail.gmail.com>

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

Hi Jim,

> ping

oops - sorry.

> for the attachment, see
> https://sourceware.org/ml/gdb-patches/2016-06/msg00046.html

Did you see Mike Frysinger's comment about not changing global
variables ?

I think that I agree with this comment, although I could not find
the raw opcode reading functions to which he was referring, (unless
he meant sim_core_read_buffer), so would you mind trying out this
variation of your patch to see if it works instead ?

Cheers
  Nick



[-- Attachment #2: aarch64-sim.patch --]
[-- Type: text/x-patch, Size: 1910 bytes --]

diff --git a/sim/aarch64/memory.c b/sim/aarch64/memory.c
index 50f4837..f7eea22 100644
--- a/sim/aarch64/memory.c
+++ b/sim/aarch64/memory.c
@@ -78,6 +78,20 @@ FETCH_FUNC32 (int32_t,   int16_t, s16, 2)
 FETCH_FUNC32 (uint32_t,  uint8_t, u8, 1)
 FETCH_FUNC32 (int32_t,    int8_t, s8, 1)
 
+/* Specialized version of aarch64_get_mem_u32 for fetching instructions
+   which are always held in little endian order even on big-endian
+   configured targets.  */
+
+uint32_t
+aarch64_get_instruction (sim_cpu *cpu, uint64_t address)
+{
+  uint32_t val = aarch64_get_mem_u32 (cpu, address);
+
+  if (CURRENT_TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+    val = _SWAP_4 (val);
+  return val;
+}
+
 void
 aarch64_get_mem_long_double (sim_cpu *cpu, uint64_t address, FRegister *a)
 {
diff --git a/sim/aarch64/memory.h b/sim/aarch64/memory.h
index 3f63973..3559245 100644
--- a/sim/aarch64/memory.h
+++ b/sim/aarch64/memory.h
@@ -37,6 +37,7 @@ extern uint32_t     aarch64_get_mem_u8  (sim_cpu *, uint64_t);
 extern int32_t      aarch64_get_mem_s8  (sim_cpu *, uint64_t);
 extern void         aarch64_get_mem_blk (sim_cpu *, uint64_t, char *, unsigned);
 extern const char * aarch64_get_mem_ptr (sim_cpu *, uint64_t);
+extern uint32_t     aarch64_get_instruction (sim_cpu *, uint64_t);
 
 extern void         aarch64_set_mem_long_double (sim_cpu *, uint64_t, FRegister);
 extern void         aarch64_set_mem_u64 (sim_cpu *, uint64_t, uint64_t);
diff --git a/sim/aarch64/simulator.c b/sim/aarch64/simulator.c
index 88cb03d..c70fd96 100644
--- a/sim/aarch64/simulator.c
+++ b/sim/aarch64/simulator.c
@@ -14083,7 +14083,7 @@ aarch64_step (sim_cpu *cpu)
     return FALSE;
 
   aarch64_set_next_PC (cpu, pc + 4);
-  aarch64_get_instr (cpu) = aarch64_get_mem_u32 (cpu, pc);
+  aarch64_get_instr (cpu) = aarch64_get_instruction (cpu, pc);
 
   TRACE_INSN (cpu, " pc = %" PRIx64 " instr = %08x", pc,
 	      aarch64_get_instr (cpu));

  reply	other threads:[~2016-06-13 12:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-03  2:36 Jim Wilson
2016-06-10 16:24 ` Jim Wilson
2016-06-13 12:38   ` Nick Clifton [this message]
2016-06-30  1:33     ` Jim Wilson
2016-06-30  8:13       ` Nick Clifton
2016-06-10 18:06 ` Mike Frysinger

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=a3725d02-298b-2323-4716-22eed88b8e0c@redhat.com \
    --to=nickc@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jim.wilson@linaro.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