aboutsummaryrefslogtreecommitdiff
path: root/gdbserver
diff options
context:
space:
mode:
authorLuis Machado <luis.machado@arm.com>2020-03-26 11:58:01 -0300
committerLuis Machado <luis.machado@linaro.org>2020-10-20 15:05:18 -0300
commit1bdd3dce2f7323570616499e72b386a3f00d8d51 (patch)
tree76f419940af5e378649d40206a2516901911107f /gdbserver
parent5ea4625bb20fd40eb3c0990c60b95819fd21f25c (diff)
downloadgdb-1bdd3dce2f7323570616499e72b386a3f00d8d51.zip
gdb-1bdd3dce2f7323570616499e72b386a3f00d8d51.tar.gz
gdb-1bdd3dce2f7323570616499e72b386a3f00d8d51.tar.bz2
[Morello] Generate target descriptions based on runtime capability feature checks
This patch adds code to do runtime checks for Morello, so GDB can pick the correct target description and register set. gdb/ChangeLog: 2020-10-20 Luis Machado <luis.machado@arm.com> * aarch64-linux-nat.c (aarch64_linux_nat_target::read_description): Check for HWCAP2_MORELLO. * aarch64-linux-tdep.c (aarch64_linux_core_read_description): Likewise. * aarch64-tdep.c (tdesc_aarch64_list): Add one more dimension. (aarch64_read_description): New parameter capability_p, use it to generate the proper target description. (aarch64_gdbarch_init): Update invocation of aarch64_read_description. * aarch64-tdep.h (aarch64_read_description): New parameter capability_p. * arch/aarch64.c (aarch64_create_target_description): New parameter capability_p. Use it. * arch/aarch64.h (aarch64_create_target_description): New parameter capability_p. gdbserver/ChangeLog: 2020-10-20 Luis Machado <luis.machado@arm.com> * linux-aarch64-ipa.cc (get_ipa_tdesc): Update. * linux-aarch64-low.cc (aarch64_target::low_arch_setup): Check for HWCAP2_MORELLO and use it. * linux-aarch64-tdesc.cc (tdesc_aarch64_list): Add one more dimension. (aarch64_linux_read_description): New parameter capability_p. Use it. * linux-aarch64-tdesc.h (aarch64_linux_read_description): New parameter capability_p.
Diffstat (limited to 'gdbserver')
-rw-r--r--gdbserver/ChangeLog10
-rw-r--r--gdbserver/linux-aarch64-ipa.cc4
-rw-r--r--gdbserver/linux-aarch64-low.cc5
-rw-r--r--gdbserver/linux-aarch64-tdesc.cc11
-rw-r--r--gdbserver/linux-aarch64-tdesc.h3
5 files changed, 24 insertions, 9 deletions
diff --git a/gdbserver/ChangeLog b/gdbserver/ChangeLog
index e93e4ea..d4f6c68 100644
--- a/gdbserver/ChangeLog
+++ b/gdbserver/ChangeLog
@@ -1,3 +1,13 @@
+2020-10-20 Luis Machado <luis.machado@arm.com>
+
+ * linux-aarch64-ipa.cc (get_ipa_tdesc): Update.
+ * linux-aarch64-low.cc (aarch64_target::low_arch_setup): Check for
+ HWCAP2_MORELLO and use it.
+ * linux-aarch64-tdesc.cc (tdesc_aarch64_list): Add one more dimension.
+ (aarch64_linux_read_description): New parameter capability_p. Use it.
+ * linux-aarch64-tdesc.h (aarch64_linux_read_description): New parameter
+ capability_p.
+
2020-10-13 Kamil Rytarowski <n54@gmx.com>x
* netbsd-low.cc (netbsd_tdesc): Remove.
diff --git a/gdbserver/linux-aarch64-ipa.cc b/gdbserver/linux-aarch64-ipa.cc
index 694dfd7..73404a0 100644
--- a/gdbserver/linux-aarch64-ipa.cc
+++ b/gdbserver/linux-aarch64-ipa.cc
@@ -152,7 +152,7 @@ get_raw_reg (const unsigned char *raw_regs, int regnum)
const struct target_desc *
get_ipa_tdesc (int idx)
{
- return aarch64_linux_read_description (0, false);
+ return aarch64_linux_read_description (0, false, false);
}
/* Allocate buffer for the jump pads. The branch instruction has a reach
@@ -205,5 +205,5 @@ void
initialize_low_tracepoint (void)
{
/* SVE and pauth not yet supported. */
- aarch64_linux_read_description (0, false);
+ aarch64_linux_read_description (0, false, false);
}
diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc
index 08208ae..d9fa43a 100644
--- a/gdbserver/linux-aarch64-low.cc
+++ b/gdbserver/linux-aarch64-low.cc
@@ -641,9 +641,12 @@ aarch64_target::low_arch_setup ()
{
uint64_t vq = aarch64_sve_get_vq (tid);
unsigned long hwcap = linux_get_hwcap (8);
+ unsigned long hwcap2 = linux_get_hwcap2 (8);
bool pauth_p = hwcap & AARCH64_HWCAP_PACA;
+ bool capability_p = hwcap2 & HWCAP2_MORELLO;
- current_process ()->tdesc = aarch64_linux_read_description (vq, pauth_p);
+ current_process ()->tdesc = aarch64_linux_read_description (vq, pauth_p,
+ capability_p);
}
else
current_process ()->tdesc = aarch32_linux_read_description ();
diff --git a/gdbserver/linux-aarch64-tdesc.cc b/gdbserver/linux-aarch64-tdesc.cc
index 897fbb4..5f4cf71 100644
--- a/gdbserver/linux-aarch64-tdesc.cc
+++ b/gdbserver/linux-aarch64-tdesc.cc
@@ -27,22 +27,23 @@
#include <inttypes.h>
/* All possible aarch64 target descriptors. */
-struct target_desc *tdesc_aarch64_list[AARCH64_MAX_SVE_VQ + 1][2/*pauth*/];
+struct target_desc *tdesc_aarch64_list[AARCH64_MAX_SVE_VQ + 1][2/*pauth*/][2 /* capability */];
/* Create the aarch64 target description. */
const target_desc *
-aarch64_linux_read_description (uint64_t vq, bool pauth_p)
+aarch64_linux_read_description (uint64_t vq, bool pauth_p,
+ bool capability_p)
{
if (vq > AARCH64_MAX_SVE_VQ)
error (_("VQ is %" PRIu64 ", maximum supported value is %d"), vq,
AARCH64_MAX_SVE_VQ);
- struct target_desc *tdesc = tdesc_aarch64_list[vq][pauth_p];
+ struct target_desc *tdesc = tdesc_aarch64_list[vq][pauth_p][capability_p];
if (tdesc == NULL)
{
- tdesc = aarch64_create_target_description (vq, pauth_p);
+ tdesc = aarch64_create_target_description (vq, pauth_p, capability_p);
static const char *expedite_regs_aarch64[] = { "x29", "sp", "pc", NULL };
static const char *expedite_regs_aarch64_sve[] = { "x29", "sp", "pc",
@@ -53,7 +54,7 @@ aarch64_linux_read_description (uint64_t vq, bool pauth_p)
else
init_target_desc (tdesc, expedite_regs_aarch64_sve);
- tdesc_aarch64_list[vq][pauth_p] = tdesc;
+ tdesc_aarch64_list[vq][pauth_p][capability_p] = tdesc;
}
return tdesc;
diff --git a/gdbserver/linux-aarch64-tdesc.h b/gdbserver/linux-aarch64-tdesc.h
index 0165e63..c398921 100644
--- a/gdbserver/linux-aarch64-tdesc.h
+++ b/gdbserver/linux-aarch64-tdesc.h
@@ -20,6 +20,7 @@
#ifndef GDBSERVER_LINUX_AARCH64_TDESC_H
#define GDBSERVER_LINUX_AARCH64_TDESC_H
-const target_desc * aarch64_linux_read_description (uint64_t vq, bool pauth_p);
+const target_desc * aarch64_linux_read_description (uint64_t vq, bool pauth_p,
+ bool capability_p);
#endif /* GDBSERVER_LINUX_AARCH64_TDESC_H */