From 122394f1476b1c925a281b15399119500c8231c1 Mon Sep 17 00:00:00 2001 From: Alan Hayward Date: Thu, 31 May 2018 14:36:48 +0100 Subject: Function for reading the Aarch64 SVE vector length Returns 0 for systems without SVE support. Note the defines taken from Linux kernel headers in aarch64-sve-linux-ptrace.h. gdb/ * Makefile.in: Add new header. * gdb/arch/aarch64.h (sve_vg_from_vl): New macro. (sve_vl_from_vg): Likewise. (sve_vq_from_vl): Likewise. (sve_vl_from_vq): Likewise. (sve_vq_from_vg): Likewise. (sve_vg_from_vq): Likewise. * configure.nat: Add new c file. * nat/aarch64-sve-linux-ptrace.c: New file. * nat/aarch64-sve-linux-ptrace.h: New file. gdbserver/ * configure.srv: Add new c/h file. --- gdb/arch/aarch64.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'gdb/arch') diff --git a/gdb/arch/aarch64.h b/gdb/arch/aarch64.h index b291a09..2f80a29 100644 --- a/gdb/arch/aarch64.h +++ b/gdb/arch/aarch64.h @@ -52,6 +52,23 @@ enum aarch64_regnum #define AARCH64_V_REGS_NUM 32 #define AARCH64_NUM_REGS AARCH64_FPCR_REGNUM + 1 +/* There are a number of ways of expressing the current SVE vector size: + + VL : Vector Length. + The number of bytes in an SVE Z register. + VQ : Vector Quotient. + The number of 128bit chunks in an SVE Z register. + VG : Vector Gradient. + The number of 64bit chunks in an SVE Z register. */ + +#define sve_vg_from_vl(vl) ((vl) / 8) +#define sve_vl_from_vg(vg) ((vg) * 8) +#define sve_vq_from_vl(vl) ((vl) / 0x10) +#define sve_vl_from_vq(vq) ((vq) * 0x10) +#define sve_vq_from_vg(vg) (sve_vq_from_vl (sve_vl_from_vg (vg))) +#define sve_vg_from_vq(vq) (sve_vg_from_vl (sve_vl_from_vq (vq))) + + /* Maximum supported VQ value. Increase if required. */ #define AARCH64_MAX_SVE_VQ 16 -- cgit v1.1