summaryrefslogtreecommitdiff
path: root/sparc.c
diff options
context:
space:
mode:
authorJiri Gaisler <jiri@gaisler.se>2020-02-29 11:07:13 +0100
committerJiri Gaisler <jiri@gaisler.se>2020-02-29 14:28:48 +0100
commit09ba9099c1562c4af1e2f624b9aa2692e563118b (patch)
tree2ae06e83b4f993e2e2e9a01f6b1bf9c982d55fa2 /sparc.c
parentacd17e755506d316e073175c3993954cb7d51f3e (diff)
Fix incorrect operation on big-endian hosts
Diffstat (limited to 'sparc.c')
-rw-r--r--sparc.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sparc.c b/sparc.c
index fc899d9..03a78d8 100644
--- a/sparc.c
+++ b/sparc.c
@@ -2286,7 +2286,11 @@ gdb_sp_read (uint32 mem, char *buf, int length)
&sregs[cpu].r[((i + 1) * 16 +
((mem - sregs->sp[i]) >> 2)) % (NWIN * 16)];
for (j = 0; j < length; j++)
- buf[j] = data[j ^ arch->endian];
+#ifdef HOST_LITTLE_ENDIAN
+ buf[j] = data[j ^ 3];
+#else
+ buf[j] = data[j];
+#endif
if (sis_verbose)
printf ("gdb_sp_read: 0x%08x\n", mem);
return length;
@@ -3470,7 +3474,11 @@ sparc_print_insn (uint32 addr)
}
const struct cpu_arch sparc32 = {
+#ifdef HOST_LITTLE_ENDIAN
3,
+#else
+ 0,
+#endif
sparc_dispatch_instruction,
sparc_execute_trap,
sparc_check_interrupts,