From: Jim Wilson <jim.wilson@linaro.org>
To: gdb-patches@sourceware.org
Subject: [PATCH] aarch64 sim big-endian support
Date: Fri, 03 Jun 2016 02:36:00 -0000 [thread overview]
Message-ID: <CABXYE2UfwrSxRADdgFRuBJzTM-1_DPaP5LJSULSQ-808X8dccQ@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 714 bytes --]
On aarch64, code is always little-endian, even when compiling
big-endian, so we need to force little-endian when reading
instructions.
Running the gcc C language testsuite, I get for an aarch64-elf target
# of expected passes 35433
# of unexpected failures 254
# of unsupported tests 131
and for an aarch64_be-elf target with the attached patch I get
# of expected passes 35200
# of unexpected failures 487
# of unsupported tests 131
so this simple patch gets us most of the way there. I haven't tried
looking at the other problems yet.
I also have a dejagnu patch I wrote to make this work, which I will be
submitting to the dejagnu team shortly.
Jim
[-- Attachment #2: gdb-sim-aarch64.patch --]
[-- Type: text/x-patch, Size: 977 bytes --]
2016-06-02 Jim Wilson <jim.wilson@linaro.org>
sim/aarch64/
* simulator.c (aarch64_step): New var saved_target_byte_order. Force
byte order to BFD_ENDIAN_LITTLE before pc read, then restore saved
value.
diff --git a/sim/aarch64/simulator.c b/sim/aarch64/simulator.c
index 88cb03d..5a1814c 100644
--- a/sim/aarch64/simulator.c
+++ b/sim/aarch64/simulator.c
@@ -14078,12 +14078,18 @@ static bfd_boolean
aarch64_step (sim_cpu *cpu)
{
uint64_t pc = aarch64_get_PC (cpu);
+ enum bfd_endian saved_target_byte_order;
if (pc == TOP_LEVEL_RETURN_PC)
return FALSE;
aarch64_set_next_PC (cpu, pc + 4);
+
+ /* Code is always little-endian. */
+ saved_target_byte_order = current_target_byte_order;
+ current_target_byte_order = BFD_ENDIAN_LITTLE;
aarch64_get_instr (cpu) = aarch64_get_mem_u32 (cpu, pc);
+ current_target_byte_order = saved_target_byte_order;
TRACE_INSN (cpu, " pc = %" PRIx64 " instr = %08x", pc,
aarch64_get_instr (cpu));
next reply other threads:[~2016-06-03 2:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-03 2:36 Jim Wilson [this message]
2016-06-10 16:24 ` Jim Wilson
2016-06-13 12:38 ` Nick Clifton
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=CABXYE2UfwrSxRADdgFRuBJzTM-1_DPaP5LJSULSQ-808X8dccQ@mail.gmail.com \
--to=jim.wilson@linaro.org \
--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