/* 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.
return regcache->tdesc->reg_defs.size () == AARCH64_SVE_NUM_REGS;
}
-/* Implementation of linux_target_ops method "cannot_store_register". */
-
-static int
-aarch64_cannot_store_register (int regno)
-{
- return regno >= AARCH64_NUM_REGS;
-}
-
-/* Implementation of linux_target_ops method "cannot_fetch_register". */
-
-static int
-aarch64_cannot_fetch_register (int regno)
-{
- return regno >= AARCH64_NUM_REGS;
-}
-
static void
aarch64_fill_gregset (struct regcache *regcache, void *buf)
{
supply_register (regcache, AARCH64_FPCR_REGNUM, ®set->fpcr);
}
+/* 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]);
+}
+
/* Enable miscellaneous debugging output. The name is historical - it
was originally used to debug LinuxThreads support. */
extern int debug_threads;
*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
if (is_elf64)
{
uint64_t vq = aarch64_sve_get_vq (tid);
- current_process ()->tdesc = aarch64_linux_read_description (vq);
+ 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;
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
};
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
};
{
aarch64_arch_setup,
aarch64_regs_info,
- aarch64_cannot_fetch_register,
- aarch64_cannot_store_register,
+ NULL, /* cannot_fetch_register */
+ NULL, /* cannot_store_register */
NULL, /* fetch_register */
aarch64_get_pc,
aarch64_set_pc,