diff options
author | Alan Hayward <alan.hayward@arm.com> | 2019-03-22 10:00:28 +0000 |
---|---|---|
committer | Alan Hayward <alan.hayward@arm.com> | 2019-03-22 10:10:22 +0000 |
commit | ee4fbcfa26eb4a2a3666f7c1cc31447c3cffa023 (patch) | |
tree | 16ce0420d78dc816de2e8c1017a6b16efa229846 /gdb/gdbserver | |
parent | 6dc0ebde59dfb73eae507ced718bafa54023bf33 (diff) | |
download | gdb-ee4fbcfa26eb4a2a3666f7c1cc31447c3cffa023.zip gdb-ee4fbcfa26eb4a2a3666f7c1cc31447c3cffa023.tar.gz gdb-ee4fbcfa26eb4a2a3666f7c1cc31447c3cffa023.tar.bz2 |
AArch64: Use HWCAP to detect pauth feature
Add aarch64_get_hwcap functions for reading the HWCAP.
From this extract the PACA value and use this to enable pauth.
gdb/ChangeLog:
* aarch64-linux-nat.c
(aarch64_linux_nat_target::read_description): Read PACA hwcap.
* aarch64-linux-tdep.c
(aarch64_linux_core_read_description): Likewise.
(aarch64_linux_get_hwcap): New function.
* aarch64-linux-tdep.h (AARCH64_HWCAP_PACA): New define.
(aarch64_linux_get_hwcap): New declaration.
gdb/gdbserver/ChangeLog:
* linux-aarch64-low.c (AARCH64_HWCAP_PACA): New define.
(aarch64_get_hwcap): New function.
(aarch64_arch_setup): Read APIA hwcap.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r-- | gdb/gdbserver/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/gdbserver/linux-aarch64-low.c | 33 |
2 files changed, 38 insertions, 2 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 9fdbe1d..3b585ca 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,6 +1,13 @@ 2019-03-22 Alan Hayward <alan.hayward@arm.com> Jiong Wang <jiong.wang@arm.com> + * linux-aarch64-low.c (AARCH64_HWCAP_PACA): New define. + (aarch64_get_hwcap): New function. + (aarch64_arch_setup): Read APIA hwcap. + +2019-03-22 Alan Hayward <alan.hayward@arm.com> + Jiong Wang <jiong.wang@arm.com> + * linux-aarch64-ipa.c (get_ipa_tdesc): Add pauth param. (initialize_low_tracepoint): Likewise. * linux-aarch64-low.c (aarch64_arch_setup): Likewise. diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c index db329da..e2e25f0 100644 --- a/gdb/gdbserver/linux-aarch64-low.c +++ b/gdb/gdbserver/linux-aarch64-low.c @@ -485,6 +485,33 @@ aarch64_linux_new_fork (struct process_info *parent, *child->priv->arch_private = *parent->priv->arch_private; } +/* Matches HWCAP_PACA in kernel header arch/arm64/include/uapi/asm/hwcap.h. */ +#define AARCH64_HWCAP_PACA (1 << 30) + +/* Fetch the AT_HWCAP entry from the auxv vector. */ + +static bool +aarch64_get_hwcap (unsigned long *valp) +{ + unsigned char *data = (unsigned char *) alloca (16); + int offset = 0; + + while ((*the_target->read_auxv) (offset, data, 16) == 16) + { + unsigned long *data_p = (unsigned long *)data; + if (data_p[0] == AT_HWCAP) + { + *valp = data_p[1]; + return true; + } + + offset += 16; + } + + *valp = 0; + return false; +} + /* Implementation of linux_target_ops method "arch_setup". */ static void @@ -501,8 +528,10 @@ aarch64_arch_setup (void) if (is_elf64) { uint64_t vq = aarch64_sve_get_vq (tid); - /* pauth not yet supported. */ - current_process ()->tdesc = aarch64_linux_read_description (vq, false); + unsigned long hwcap = 0; + bool pauth_p = aarch64_get_hwcap (&hwcap) && (hwcap & AARCH64_HWCAP_PACA); + + current_process ()->tdesc = aarch64_linux_read_description (vq, pauth_p); } else current_process ()->tdesc = tdesc_arm_with_neon; |