[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 54/66] Hexagon HVX support in gdbstub
From: |
Taylor Simpson |
Subject: |
[RFC PATCH 54/66] Hexagon HVX support in gdbstub |
Date: |
Mon, 10 Feb 2020 18:40:32 -0600 |
Signed-off-by: Taylor Simpson <address@hidden>
---
target/hexagon/gdbstub.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)
diff --git a/target/hexagon/gdbstub.c b/target/hexagon/gdbstub.c
index f07cb9a..e97b0af 100644
--- a/target/hexagon/gdbstub.c
+++ b/target/hexagon/gdbstub.c
@@ -21,6 +21,28 @@
#include "cpu.h"
#include "internal.h"
+static int gdb_get_vreg(CPUHexagonState *env, uint8_t *mem_buf, int n)
+{
+ int total = 0;
+ int i;
+ for (i = 0; i < MAX_VEC_SIZE_BYTES / 4; i++) {
+ total += gdb_get_regl(mem_buf, env->VRegs[n].uw[i]);
+ mem_buf += 4;
+ }
+ return total;
+}
+
+static int gdb_get_qreg(CPUHexagonState *env, uint8_t *mem_buf, int n)
+{
+ int total = 0;
+ int i;
+ for (i = 0; i < MAX_VEC_SIZE_BYTES / 4 / 8; i++) {
+ total += gdb_get_regl(mem_buf, env->QRegs[n].uw[i]);
+ mem_buf += 4;
+ }
+ return total;
+}
+
int hexagon_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
{
HexagonCPU *cpu = HEXAGON_CPU(cs);
@@ -29,11 +51,41 @@ int hexagon_gdb_read_register(CPUState *cs, uint8_t
*mem_buf, int n)
if (n < TOTAL_PER_THREAD_REGS) {
return gdb_get_regl(mem_buf, env->gpr[n]);
}
+ n -= TOTAL_PER_THREAD_REGS;
+
+ if (n < NUM_VREGS) {
+ return gdb_get_vreg(env, mem_buf, n);
+ }
+ n -= NUM_VREGS;
+
+ if (n < NUM_QREGS) {
+ return gdb_get_qreg(env, mem_buf, n);
+ }
g_assert_not_reached();
return 0;
}
+static int gdb_put_vreg(CPUHexagonState *env, uint8_t *mem_buf, int n)
+{
+ int i;
+ for (i = 0; i < MAX_VEC_SIZE_BYTES / 4; i++) {
+ env->VRegs[n].uw[i] = ldtul_p(mem_buf);
+ mem_buf += 4;
+ }
+ return MAX_VEC_SIZE_BYTES;
+}
+
+static int gdb_put_qreg(CPUHexagonState *env, uint8_t *mem_buf, int n)
+{
+ int i;
+ for (i = 0; i < MAX_VEC_SIZE_BYTES / 4 / 8; i++) {
+ env->QRegs[n].uw[i] = ldtul_p(mem_buf);
+ mem_buf += 4;
+ }
+ return MAX_VEC_SIZE_BYTES / 8;
+}
+
int hexagon_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
{
HexagonCPU *cpu = HEXAGON_CPU(cs);
@@ -43,6 +95,16 @@ int hexagon_gdb_write_register(CPUState *cs, uint8_t
*mem_buf, int n)
env->gpr[n] = ldtul_p(mem_buf);
return sizeof(target_ulong);
}
+ n -= TOTAL_PER_THREAD_REGS;
+
+ if (n < NUM_VREGS) {
+ return gdb_put_vreg(env, mem_buf, n);
+ }
+ n -= NUM_VREGS;
+
+ if (n < NUM_QREGS) {
+ return gdb_put_qreg(env, mem_buf, n);
+ }
g_assert_not_reached();
return 0;
--
2.7.4
- [RFC PATCH 46/66] Hexagon TCG generation - step 09, (continued)
- [RFC PATCH 46/66] Hexagon TCG generation - step 09, Taylor Simpson, 2020/02/10
- [RFC PATCH 43/66] Hexagon TCG generation - step 06, Taylor Simpson, 2020/02/10
- [RFC PATCH 15/66] Hexagon arch import - instruction semantics definitions, Taylor Simpson, 2020/02/10
- [RFC PATCH 42/66] Hexagon TCG generation - step 05, Taylor Simpson, 2020/02/10
- [RFC PATCH 47/66] Hexagon TCG generation - step 10, Taylor Simpson, 2020/02/10
- [RFC PATCH 44/66] Hexagon TCG generation - step 07, Taylor Simpson, 2020/02/10
- [RFC PATCH 45/66] Hexagon TCG generation - step 08, Taylor Simpson, 2020/02/10
- [RFC PATCH 49/66] Hexagon TCG generation - step 12, Taylor Simpson, 2020/02/10
- [RFC PATCH 53/66] Hexagon - Add Hexagon Vector eXtensions (HVX) to core definition, Taylor Simpson, 2020/02/10
- [RFC PATCH 48/66] Hexagon TCG generation - step 11, Taylor Simpson, 2020/02/10
- [RFC PATCH 54/66] Hexagon HVX support in gdbstub,
Taylor Simpson <=
- [RFC PATCH 66/66] Hexagon HVX build infrastructure, Taylor Simpson, 2020/02/10
- [RFC PATCH 50/66] Hexagon translation, Taylor Simpson, 2020/02/10
- [RFC PATCH 64/66] Hexagon HVX TCG generation, Taylor Simpson, 2020/02/10
- [RFC PATCH 51/66] Hexagon Linux user emulation, Taylor Simpson, 2020/02/10
- [RFC PATCH 55/66] Hexagon HVX import instruction encodings, Taylor Simpson, 2020/02/10
[RFC PATCH 65/66] Hexagon HVX translation, Taylor Simpson, 2020/02/10