X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fgdbserver%2Flinux-aarch64-low.c;h=ad0481714574cad49fadf6f30e49f419bd3c16c0;hb=f9d949fb7b85323e3f307884a4a3cef6ba52607b;hp=181e2666abc88d227b04e476cad51d4cbe449eda;hpb=5013824590f59374106007d4c9724d5767911d75;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c index 181e2666ab..ad04817145 100644 --- a/gdb/gdbserver/linux-aarch64-low.c +++ b/gdb/gdbserver/linux-aarch64-low.c @@ -1,7 +1,7 @@ /* GNU/Linux/AArch64 specific low level interface, for the remote server for GDB. - Copyright (C) 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2009-2019 Free Software Foundation, Inc. Contributed by ARM Ltd. This file is part of GDB. @@ -28,6 +28,7 @@ #include "elf/common.h" #include "ax.h" #include "tracepoint.h" +#include "debug.h" #include #include @@ -39,6 +40,7 @@ #include "gdb_proc_service.h" #include "arch/aarch64.h" +#include "linux-aarch32-tdesc.h" #include "linux-aarch64-tdesc.h" #include "nat/aarch64-sve-linux-ptrace.h" #include "tdesc.h" @@ -135,9 +137,22 @@ aarch64_store_fpregset (struct regcache *regcache, const void *buf) supply_register (regcache, AARCH64_FPCR_REGNUM, ®set->fpcr); } -/* Enable miscellaneous debugging output. The name is historical - it - was originally used to debug LinuxThreads support. */ -extern int debug_threads; +/* Store the pauth registers to regcache. */ + +static void +aarch64_store_pauthregset (struct regcache *regcache, const void *buf) +{ + uint64_t *pauth_regset = (uint64_t *) buf; + int pauth_base = find_regno (regcache->tdesc, "pauth_dmask"); + + if (pauth_base == 0) + return; + + supply_register (regcache, AARCH64_PAUTH_DMASK_REGNUM (pauth_base), + &pauth_regset[0]); + supply_register (regcache, AARCH64_PAUTH_CMASK_REGNUM (pauth_base), + &pauth_regset[1]); +} /* Implementation of linux_target_ops method "get_pc". */ @@ -485,6 +500,9 @@ 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) + /* Implementation of linux_target_ops method "arch_setup". */ static void @@ -501,10 +519,13 @@ aarch64_arch_setup (void) if (is_elf64) { uint64_t vq = aarch64_sve_get_vq (tid); - current_process ()->tdesc = aarch64_linux_read_description (vq); + unsigned long hwcap = linux_get_hwcap (8); + bool pauth_p = hwcap & AARCH64_HWCAP_PACA; + + current_process ()->tdesc = aarch64_linux_read_description (vq, pauth_p); } else - current_process ()->tdesc = tdesc_arm_with_neon; + current_process ()->tdesc = aarch32_linux_read_description (); aarch64_linux_get_debug_reg_capacity (lwpid_of (current_thread)); } @@ -534,6 +555,9 @@ static struct regset_info aarch64_regsets[] = sizeof (struct user_fpsimd_state), FP_REGS, aarch64_fill_fpregset, aarch64_store_fpregset }, + { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_PAC_MASK, + AARCH64_PAUTH_REGS_SIZE, OPTIONAL_REGS, + NULL, aarch64_store_pauthregset }, NULL_REGSET }; @@ -560,6 +584,9 @@ static struct regset_info aarch64_sve_regsets[] = SVE_PT_SIZE (AARCH64_MAX_SVE_VQ, SVE_PT_REGS_SVE), EXTENDED_REGS, aarch64_sve_regs_copy_from_regcache, aarch64_sve_regs_copy_to_regcache }, + { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_PAC_MASK, + AARCH64_PAUTH_REGS_SIZE, OPTIONAL_REGS, + NULL, aarch64_store_pauthregset }, NULL_REGSET }; @@ -1596,11 +1623,11 @@ append_insns (CORE_ADDR *to, size_t len, const uint32_t *buf) for (i = 0; i < len; i++) le_buf[i] = htole32 (buf[i]); - write_inferior_memory (*to, (const unsigned char *) le_buf, byte_len); + target_write_memory (*to, (const unsigned char *) le_buf, byte_len); xfree (le_buf); #else - write_inferior_memory (*to, (const unsigned char *) buf, byte_len); + target_write_memory (*to, (const unsigned char *) buf, byte_len); #endif *to += byte_len; @@ -3068,8 +3095,4 @@ initialize_low_arch (void) initialize_regsets_info (&aarch64_regsets_info); initialize_regsets_info (&aarch64_sve_regsets_info); - -#if GDB_SELF_TEST - initialize_low_tdesc (); -#endif }