aboutsummaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2024-01-11 00:44:27 -0500
committerMike Frysinger <vapier@gentoo.org>2024-01-18 01:49:56 -0500
commit48157d30b6c7ba955c5bc83b82f645531905285a (patch)
treeb567e740e97b2bb7e26ed7578aa163058b2f0233 /sim
parentdcc6c863ed4e0198f9df590ea86554f550c42237 (diff)
downloadgdb-48157d30b6c7ba955c5bc83b82f645531905285a.zip
gdb-48157d30b6c7ba955c5bc83b82f645531905285a.tar.gz
gdb-48157d30b6c7ba955c5bc83b82f645531905285a.tar.bz2
sim: ppc: implement 128-bit register read/writes with sim-endian APIs
We have APIs in sim-endian for working with 128-bit values like this code is already doing for 8/16/32/64-bit values. Switch over to that to make it a bit simpler, and drop the WITH_ALTIVEC check. The code probably is only used when altivec is enabled, but it doesn't add much to always compile it in, and avoids #ifdef rot by not actually compiling it.
Diffstat (limited to 'sim')
-rw-r--r--sim/ppc/psim.c34
1 files changed, 8 insertions, 26 deletions
diff --git a/sim/ppc/psim.c b/sim/ppc/psim.c
index 88047af..3b86b86 100644
--- a/sim/ppc/psim.c
+++ b/sim/ppc/psim.c
@@ -796,6 +796,7 @@ psim_read_register(psim *system,
unsigned_2 unsigned_2;
unsigned_4 unsigned_4;
unsigned_8 unsigned_8;
+ unsigned_16 unsigned_16;
creg creg;
fpreg fpreg;
fpscreg fpscreg;
@@ -922,21 +923,12 @@ psim_read_register(psim *system,
case 8:
*(unsigned_8*)buf = H2T_8(cooked_buf.unsigned_8);
break;
-#ifdef WITH_ALTIVEC
case 16:
- if (HOST_BYTE_ORDER != CURRENT_TARGET_BYTE_ORDER)
- {
- union { vreg v; unsigned_8 d[2]; } h, t;
- memcpy(&h.v/*dest*/, cooked_buf.bytes/*src*/, description.size);
- { _SWAP_8(t.d[0] =, h.d[1]); }
- { _SWAP_8(t.d[1] =, h.d[0]); }
- memcpy(buf/*dest*/, &t/*src*/, description.size);
- break;
- }
- else
- memcpy(buf/*dest*/, cooked_buf.bytes/*src*/, description.size);
+ {
+ unsigned_16 v = H2T_16(cooked_buf.unsigned_16);
+ memcpy(buf/*dest*/, &v, description.size);
+ }
break;
-#endif
}
}
else {
@@ -965,6 +957,7 @@ psim_write_register(psim *system,
unsigned_2 unsigned_2;
unsigned_4 unsigned_4;
unsigned_8 unsigned_8;
+ unsigned_16 unsigned_16;
creg creg;
fpreg fpreg;
fpscreg fpscreg;
@@ -1014,20 +1007,9 @@ psim_write_register(psim *system,
case 8:
cooked_buf.unsigned_8 = T2H_8(*(unsigned_8*)buf);
break;
-#ifdef WITH_ALTIVEC
case 16:
- if (HOST_BYTE_ORDER != CURRENT_TARGET_BYTE_ORDER)
- {
- union { vreg v; unsigned_8 d[2]; } h, t;
- memcpy(&t.v/*dest*/, buf/*src*/, description.size);
- { _SWAP_8(h.d[0] =, t.d[1]); }
- { _SWAP_8(h.d[1] =, t.d[0]); }
- memcpy(cooked_buf.bytes/*dest*/, &h/*src*/, description.size);
- break;
- }
- else
- memcpy(cooked_buf.bytes/*dest*/, buf/*src*/, description.size);
-#endif
+ cooked_buf.unsigned_16 = T2H_16(*(unsigned_16*)buf);
+ break;
}
}
else {