aboutsummaryrefslogtreecommitdiff
path: root/gdb/arch
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/arch')
-rw-r--r--gdb/arch/riscv.c15
-rw-r--r--gdb/arch/riscv.h9
2 files changed, 20 insertions, 4 deletions
diff --git a/gdb/arch/riscv.c b/gdb/arch/riscv.c
index a6538de..64f3940 100644
--- a/gdb/arch/riscv.c
+++ b/gdb/arch/riscv.c
@@ -24,6 +24,7 @@
#include "../features/riscv/64bit-cpu.c"
#include "../features/riscv/32bit-fpu.c"
#include "../features/riscv/64bit-fpu.c"
+#include "../features/riscv/rv32e-xregs.c"
#ifndef GDBSERVER
#define STATIC_IN_GDB static
@@ -43,7 +44,12 @@ riscv_create_target_description (const struct riscv_gdbarch_features features)
std::string arch_name = "riscv";
if (features.xlen == 4)
- arch_name.append (":rv32i");
+ {
+ if (features.embedded)
+ arch_name.append (":rv32e");
+ else
+ arch_name.append (":rv32i");
+ }
else if (features.xlen == 8)
arch_name.append (":rv64i");
else if (features.xlen == 16)
@@ -63,7 +69,12 @@ riscv_create_target_description (const struct riscv_gdbarch_features features)
/* For now we only support creating 32-bit or 64-bit x-registers. */
if (features.xlen == 4)
- regnum = create_feature_riscv_32bit_cpu (tdesc.get (), regnum);
+ {
+ if (features.embedded)
+ regnum = create_feature_riscv_rv32e_xregs (tdesc.get (), regnum);
+ else
+ regnum = create_feature_riscv_32bit_cpu (tdesc.get (), regnum);
+ }
else if (features.xlen == 8)
regnum = create_feature_riscv_64bit_cpu (tdesc.get (), regnum);
diff --git a/gdb/arch/riscv.h b/gdb/arch/riscv.h
index 26db0da..f91c077 100644
--- a/gdb/arch/riscv.h
+++ b/gdb/arch/riscv.h
@@ -46,10 +46,13 @@ struct riscv_gdbarch_features
that there are no f-registers. No other value is valid. */
int flen = 0;
+ /* When true this target is RV32E. */
+ bool embedded = false;
+
/* Equality operator. */
bool operator== (const struct riscv_gdbarch_features &rhs) const
{
- return (xlen == rhs.xlen && flen == rhs.flen);
+ return (xlen == rhs.xlen && flen == rhs.flen && embedded == rhs.embedded);
}
/* Inequality operator. */
@@ -61,7 +64,9 @@ struct riscv_gdbarch_features
/* Used by std::unordered_map to hash feature sets. */
std::size_t hash () const noexcept
{
- std::size_t val = ((xlen & 0x1f) << 5 | (flen & 0x1f) << 0);
+ std::size_t val = ((embedded ? 1 : 0) << 10
+ | (xlen & 0x1f) << 5
+ | (flen & 0x1f) << 0);
return val;
}
};