diff options
author | Michael Sturm <michael.sturm@intel.com> | 2017-02-01 12:22:27 +0100 |
---|---|---|
committer | Michael Sturm <michael.sturm@intel.com> | 2017-02-17 11:44:48 +0100 |
commit | 51547df62c155231530ca502c485659f3d2b66cb (patch) | |
tree | 89af03b73ff56682de8136ae1f338711920d4cb3 /gdb/regformats | |
parent | a1fa17ee1556b0175afb081a7b8a13710246307a (diff) | |
download | binutils-51547df62c155231530ca502c485659f3d2b66cb.zip binutils-51547df62c155231530ca502c485659f3d2b66cb.tar.gz binutils-51547df62c155231530ca502c485659f3d2b66cb.tar.bz2 |
Add support for Intel PKRU register to GDB and GDBserver.
This patch adds support for the registers added by the
Memory Protection Keys for Userspace (PKU aka PKEYs) feature.
Native and remote debugging are covered by this patch.
The XSAVE area is extended with a new state containing
the 32-bit wide PKRU register. The new register is added to
amd64-avx-mpx_avx512-* tdesc, thus it is renamed accordingly. Also,
respective xstate mask X86_XSTATE_AVX_MPX_AVX512_MASK is renamed to
X86_XSTATE_AVX_MPX_AVX512_PKU_MASK to reflect the new feature set
it supports.
For more information, please refer to the
Intel(R) 64 and IA-32 Architectures Software Developer's
Manual - Septemper 2015
http://www.intel.com/content/dam/www/public/us/en/documents/
manuals/64-ia-32-architectures-software-developer-manual-325462.pdf
gdb/Changelog:
2015-12-08 Michael Sturm <michael.sturm@intel.com>
* NEWS: Mention addition of PKU feature.
* amd64-linux-nat.c (amd64_linux_gregset32_reg_offset): Add PKRU register.
* amd64-linux-tdep.c (features/i386/amd64-avx-mpx-avx512-linux.c): Rename
to...
(features/i386/amd64-avx-mpx-avx512-pku-linux.c): ...this.
(amd64_linux_gregset_reg_offset): Add PKRU register.
(amd64_linux_core_read_description): Rename
X86_XSTATE_AVX_MPX_AVX512_MASK,
rename tdesc_amd64_avx_mpx_avx512_pku_linux.
(_initialize_amd64_linux_tdep): Rename
initialize_tdesc_amd64_avx_mpx_avx512_linux.
* amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Adjust regnum
calculation.
(tdesc_amd64_avx_mpx_avx512_linux): Rename to...
(tdesc_amd64_avx_mpx_avx512_pku_linux): ...this.
* amd64-tdep.c (features/i386/amd64-avx-mpx-avx512-pku.c): Rename to...
(features/i386/amd64-avx-mpx-avx512-pku.c): ...this.
(amd64_pkeys_names): New register name for raw register PKRU.
(amd64_init_abi): Add code to initialize PKRU tdep variables if feature
is present.
(amd64_target_description): Rename X86_XSTATE_AVX_MPX_AVX512_MASK,
rename tdesc_amd64_avx_mpx_avx512.
(_initialize_amd64_tdep): Rename initialize_tdesc_amd64_avx_mpx_avx512.
* amd64-tdep.h (enum amd64_regnum): Add PKRU register.
(AMD64_NUM_REGS): Adjust regnum calculation.
* i386-linux.nat.c (GETXSTATEREGS_SUPPLIES): Extend range of
registers supplied via XSTATE by PKRU register.
* common/x86-xstate.h (X86_XSTATE_PKRU): New macro.
(X86_XSTATE_AVX_MPX_AVX512_MASK): Add PKRU and renamed mask.
(X86_XSTATE_ALL_MASK): Rename X86_XSTATE_AVX_MPX_AVX512_MASK.
(X86_XSTATE_PKRU_SIZE): New macro.
(X86_XSTATE_MAX_SIZE): Adjust size.
(HAS_PKRU(XCR0)): New macro.
(X86_XSTATE_SIZE): Add checkfor PKRU.
* features/Makefile (WHICH): Rename i386/i386-avx-mpx-avx512,
i386/i386-avx-mpx-avx512-linux, i386/amd64-avx-mpx-avx512,
i386/amd64-avx-mpx-avx512-linux.
(i386/i386-avx-mpx-avx512-expedite): Rename expedite.
(i386/i386-avx-mpx-avx512-linux-expedite): Likewise.
(i386/amd64-avx-mpx-avx512-expedite): Likewise.
(i386/amd64-avx-mpx-avx512-linux-expedite): Likewise.
(XMLTOC): Rename i386/amd64-avx-mpx-avx512-linux.xml,
i386/amd64-avx-mpx-avx512.xml, i386/i386-avx-mpx-avx512-linux.xml,
i386/i386-avx-mpx-avx512.xml.
((outdir)/i386/i386-avx-mpx-avx512.dat): Rename rule, add
i386/32bit-pkeys.xml.
((outdir)/i386/i386-avx-mpx-avx512-pku-linux.dat): Likewise.
((outdir)/i386/amd64-avx-mpx-avx512.dat): Rename rule, add
i386/64bit-pkeys.xml.
((outdir)/i386/amd64-avx-mpx-avx512-linux.dat): Likewise.
* features/i386/32bit-pkeys.xml: New file.
* features/i386/64bit-pkeys.xml: Likewise.
* features/i386/amd64-avx-mpx-avx512-linux-pku.c: Regenerate from
renamed XML file.
* features/i386/amd64-avx-mpx-avx512-linux.xml: Rename to
amd64-avx-mpx-avx512-pku-linux.xml, add 64bit-pkeys.xml
* features/i386/amd64-avx-mpx-avx512.c: Regenerate from
renamed XML file.
* features/i386/amd64-avx-mpx-avx512.xml: Rename to
amd64-avx-mpx-avx512-pku.xml, add 64bit-pkeys.xml.
* features/i386/i386-avx-mpx-avx512-linux.c: Regenerate from
renamed XML file.
* features/i386/i386-avx-mpx-avx512-linux.xml: Rename to
i386-avx-mpx-avx512-pku-linux.xml, add 32bit-pkeys.xml.
* features/i386/i386-avx-mpx-avx512.c: Regenerate from
renamed XML file.
* features/i386/i386-avx-mpx-avx512.xml: Rename to
i386-avx-mpx-avx512-pku.xml, add 32bit-pkeys.xml.
* i386-linux-nat.c (GETXSTATEREGS_SUPPLIES): Change to use
I386_PKEYS_NUM_REGS.
* i386-linux-tdep.c (features/i386/i386-avx-mpx-avx512-linux.c): Rename
include.
(i386_linux_gregset_reg_offset): Add PKRU register.
(i386_linux_core_read_description): Rename xstate mask and returned
tdesc for X86_XSTATE_AVX_MPX_AVX512_PKU_MASK.
(_initialize_i386_linux_tdep): Rename
initialize_tdesc_i386_avx_mpx_avx512_linux.
* i386-linux-tdep.h (I386_LINUX_ORIG_EAX_REGNUM): Adjuste regnum
calculation.
(tdesc_i386_avx_mpx_avx512_linux): Rename prototype.
(/* Format of XSAVE...): Add pkru register.
* i386-tdep.c (i386-avx-mpx-avx512.c): Rename include.
(i386_pkeys_names): New register name for raw register PKRU.
(i386_pkru_regnum_p): Add function to look up register number of
PKRU raw register.
(i386_register_reggroup_p): Add code to exclude PKRU from general
register group.
(i386_validate_tdesc_p): Add code to handle PKRU feature, add PKRU
registers if feature is present in xcr0.
(i386_gdbarch_init): Adjust number of registers in architecture. Add code
to initialize PKRU feature variables in tdep structure.
(i386_target_description): Rename xstate mask and returned
tdesc for X86_XSTATE_AVX_MPX_AVX512_PKU_MASK.
(_initialize_i386_tdep): Rename initialize_tdesc_i386_avx_mpx_avx512.
* i386-tdep.h (struct gdbarch_tdep): Add feature variables to tdep
structure.
(enum i386_regnum): Add PKRU register.
(I386_PKEYS_NUM_REGS): New define for number of registers in PKRU feature.
(i386_pkru_regnum_p): New prototype.
* i387-tdep.c (xsave_pkeys_offset): New table for PKRU offsets in
XSAVE buffer.
(XSAVE_PKEYS_ADDR): New macro.
(i387_supply_xsave): Add code to handle PKRU register.
(i387_collect_xsave): Likewise.
* i387-tdep.h (I387_NUM_PKEYS_REGS): New define for number of registers
in PKRU feature.
(I387_PKRU_REGNUM): New macro.
(I387_PKEYSEND_REGNUM): Likewise.
* regformats/i386/amd64_avx_mpx_avx512_pku_linux.dat: Regenerate from
renamed XML file.
* regformats/i386/amd64_avx_mpx_avx512_pku.dat: Likewise.
* regformats/i386/i386/amd64-avx-mpx-avx512-pku.dat: Likewise.
* regformats/i386/i386_avx_mpx_avx512_pku_linux.dat: Likewise.
testsuite/Changelog:
2016-04-18 Michael Sturm <michael.sturm@intel.com>
* gdb.arch/i386-pkru.c: New file.
* gdb.arch/i386-pkru.exp: Likewise.
gdbserver/Changelog:
2016-04-18 Michael Sturm <michael.sturm@intel.com>
* Makefile.in (clean): Rename i386-avx-mpx-avx512.c,
i386-avx-mpx-avx512-linux.c, amd64-avx-mpx-avx512.c,
amd64-avx-mpx-avx512-linux.c.
(i386-avx-mpx-avx512-linux-ipa.o:): Rename rule and source file.
(amd64-avx-mpx-avx512-linux-ipa.o:): Likewise.
(i386-avx-mpx-avx512.c :): Rename rule, source files and dat files.
(i386-avx-mpx-avx512-linux.c :): Likewise.
(amd64-avx-mpx-avx512.c :): Likewise.
(amd64-avx-mpx-avx512-linux.c :): Likewise.
* configure.srv (srv_i386_regobj): Rename i386-avx-mpx-avx512.o.
(srv_i386_linux_regobj): Rename i386-avx-mpx-avx512-linux.o.
(srv_amd64_regobj): Rename amd64-avx-mpx-avx512.o.
(srv_amd64_linux_regobj): Rename amd64-avx-mpx-avx512-linux.o.
(ipa_i386_linux_regobj): Rename i386-avx-mpx-avx512-linux-ipa.o.
(ipa_amd64_linux_regobj): Rename amd64-avx-mpx-avx512-pku-linux-ipa.o.
(srv_i386_32bit_xmlfiles): Add 32bit-pkeys.xml.
(srv_i386_64bit_xmlfiles): Add 64bit-pkeys.xml.
(srv_i386_xmlfiles): Rename i386/i386-avx-mpx-avx512.xml.
(srv_amd64_xmlfiles): Rename i386/amd64-avx-mpx-avx512.xml.
(srv_i386_linux_xmlfiles): Rename i386/i386-avx-mpx-avx512-linux.xml.
(srv_amd64_linux_xmlfiles): Rename di386/amd64-avx-mpx-avx512-linux.xml.
* i387-fp.c (num_pkeys_registers): New variable.
(struct i387_xsave): Add space for pkru values.
(i387_cache_to_fsave): Add code to handle PKRU register.
(i387_xsave_to_cache): Likewise.
* linux-amd64-ipa.c (get_ipa_tdesc): Rename
tdesc_amd64_avx_mpx_avx512_linux.
(initialize_low_tracepoint): Rename
init_registers_amd64_avx_mpx_avx512_linux.
* linux-i386-ipa.c (get_ipa_desc): Rename
tdesc_i386_avx_mpx_avx512_linux.
(initialize_low_tracepoint): Rename
init_registers_i386_avx_mpx_avx512_linux.
* linux-x86-low.c (x86_64_regmap[]): Add PKRU register.
(x86_linux_read_description): Rename X86_XSTATE_AVX_MPX_AVX512_MASK,
rename tdesc_amd64_avx_mpx_avx512_linux, rename
tdesc_i386_avx_mpx_avx512_linux.
(x86_get_ipa_tdesc_idx): Rename tdesc_amd64_avx_mpx_avx512_linux,
rename tdesc_i386_avx_mpx_avx512_linux.
(initialize_low_arch): Rename init_registers_amd64_avx_mpx_avx512_linux,
rename init_registers_i386_avx_mpx_avx512_linux.
* linux-x86-tdesc.h (init_registers_amd64_avx_mpx_avx512_linux): Renamed
prototype.
(tdesc_amd64_avx_mpx_avx512_linux): Likewise.
(init_registers_i386_avx_mpx_avx512_linux): Likewise.
(tdesc_i386_avx_mpx_avx512_linux): Likewise.
doc/Changelog:
2016-04-18 Michael Sturm <michael.sturm@intel.com>
* gdb.texinfo (i386 Features): Add description of PKRU register.
Change-Id: If75ce5aba7dfd33fdbe3d8b47f04ef3f550c52be
Signed-off-by: Michael Sturm <michael.sturm@intel.com>
Diffstat (limited to 'gdb/regformats')
-rw-r--r-- | gdb/regformats/i386/amd64-avx-mpx-avx512-pku-linux.dat (renamed from gdb/regformats/i386/amd64-avx-mpx-avx512.dat) | 6 | ||||
-rw-r--r-- | gdb/regformats/i386/amd64-avx-mpx-avx512-pku.dat (renamed from gdb/regformats/i386/amd64-avx-mpx-avx512-linux.dat) | 7 | ||||
-rw-r--r-- | gdb/regformats/i386/i386-avx-mpx-avx512-pku-linux.dat (renamed from gdb/regformats/i386/i386-avx-mpx-avx512-linux.dat) | 7 | ||||
-rw-r--r-- | gdb/regformats/i386/i386-avx-mpx-avx512-pku.dat (renamed from gdb/regformats/i386/i386-avx-mpx-avx512.dat) | 7 |
4 files changed, 15 insertions, 12 deletions
diff --git a/gdb/regformats/i386/amd64-avx-mpx-avx512.dat b/gdb/regformats/i386/amd64-avx-mpx-avx512-pku-linux.dat index fc4bd2d..3ae6b0e 100644 --- a/gdb/regformats/i386/amd64-avx-mpx-avx512.dat +++ b/gdb/regformats/i386/amd64-avx-mpx-avx512-pku-linux.dat @@ -1,7 +1,7 @@ # THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi :set ro: -# Generated from: i386/amd64-avx-mpx-avx512.xml -name:amd64_avx_mpx_avx512 -xmltarget:amd64-avx-mpx-avx512.xml +# Generated from: i386/amd64-avx-mpx-avx512-pku-linux.xml +name:amd64_avx_mpx_avx512_pku_linux +xmltarget:amd64-avx-mpx-avx512-pku-linux.xml expedite:rbp,rsp,rip 64:rax 64:rbx diff --git a/gdb/regformats/i386/amd64-avx-mpx-avx512-linux.dat b/gdb/regformats/i386/amd64-avx-mpx-avx512-pku.dat index 526bca4..88185fd 100644 --- a/gdb/regformats/i386/amd64-avx-mpx-avx512-linux.dat +++ b/gdb/regformats/i386/amd64-avx-mpx-avx512-pku.dat @@ -1,7 +1,7 @@ # THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi :set ro: -# Generated from: i386/amd64-avx-mpx-avx512-linux.xml -name:amd64_avx_mpx_avx512_linux -xmltarget:amd64-avx-mpx-avx512-linux.xml +# Generated from: i386/amd64-avx-mpx-avx512-pku.xml +name:amd64_avx_mpx_avx512_pku +xmltarget:amd64-avx-mpx-avx512-pku.xml expedite:rbp,rsp,rip 64:rax 64:rbx @@ -157,3 +157,4 @@ expedite:rbp,rsp,rip 256:zmm29h 256:zmm30h 256:zmm31h +32:pkru diff --git a/gdb/regformats/i386/i386-avx-mpx-avx512-linux.dat b/gdb/regformats/i386/i386-avx-mpx-avx512-pku-linux.dat index 2afffa3..515ee10 100644 --- a/gdb/regformats/i386/i386-avx-mpx-avx512-linux.dat +++ b/gdb/regformats/i386/i386-avx-mpx-avx512-pku-linux.dat @@ -1,7 +1,7 @@ # THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi :set ro: -# Generated from: i386/i386-avx-mpx-avx512-linux.xml -name:i386_avx_mpx_avx512_linux -xmltarget:i386-avx-mpx-avx512-linux.xml +# Generated from: i386/i386-avx-mpx-avx512-pku-linux.xml +name:i386_avx_mpx_avx512_pku_linux +xmltarget:i386-avx-mpx-avx512-pku-linux.xml expedite:ebp,esp,eip 32:eax 32:ecx @@ -75,3 +75,4 @@ expedite:ebp,esp,eip 256:zmm5h 256:zmm6h 256:zmm7h +32:pkru diff --git a/gdb/regformats/i386/i386-avx-mpx-avx512.dat b/gdb/regformats/i386/i386-avx-mpx-avx512-pku.dat index a3c520c..17094b4 100644 --- a/gdb/regformats/i386/i386-avx-mpx-avx512.dat +++ b/gdb/regformats/i386/i386-avx-mpx-avx512-pku.dat @@ -1,7 +1,7 @@ # THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi :set ro: -# Generated from: i386/i386-avx-mpx-avx512.xml -name:i386_avx_mpx_avx512 -xmltarget:i386-avx-mpx-avx512.xml +# Generated from: i386/i386-avx-mpx-avx512-pku.xml +name:i386_avx_mpx_avx512_pku +xmltarget:i386-avx-mpx-avx512-pku.xml expedite:ebp,esp,eip 32:eax 32:ecx @@ -74,3 +74,4 @@ expedite:ebp,esp,eip 256:zmm5h 256:zmm6h 256:zmm7h +32:pkru |