mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-21 04:42:53 +08:00
51547df62c
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>
160 lines
1.6 KiB
Plaintext
160 lines
1.6 KiB
Plaintext
# THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi :set ro:
|
|
# 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
|
|
64:rcx
|
|
64:rdx
|
|
64:rsi
|
|
64:rdi
|
|
64:rbp
|
|
64:rsp
|
|
64:r8
|
|
64:r9
|
|
64:r10
|
|
64:r11
|
|
64:r12
|
|
64:r13
|
|
64:r14
|
|
64:r15
|
|
64:rip
|
|
32:eflags
|
|
32:cs
|
|
32:ss
|
|
32:ds
|
|
32:es
|
|
32:fs
|
|
32:gs
|
|
80:st0
|
|
80:st1
|
|
80:st2
|
|
80:st3
|
|
80:st4
|
|
80:st5
|
|
80:st6
|
|
80:st7
|
|
32:fctrl
|
|
32:fstat
|
|
32:ftag
|
|
32:fiseg
|
|
32:fioff
|
|
32:foseg
|
|
32:fooff
|
|
32:fop
|
|
128:xmm0
|
|
128:xmm1
|
|
128:xmm2
|
|
128:xmm3
|
|
128:xmm4
|
|
128:xmm5
|
|
128:xmm6
|
|
128:xmm7
|
|
128:xmm8
|
|
128:xmm9
|
|
128:xmm10
|
|
128:xmm11
|
|
128:xmm12
|
|
128:xmm13
|
|
128:xmm14
|
|
128:xmm15
|
|
32:mxcsr
|
|
64:orig_rax
|
|
64:fs_base
|
|
64:gs_base
|
|
128:ymm0h
|
|
128:ymm1h
|
|
128:ymm2h
|
|
128:ymm3h
|
|
128:ymm4h
|
|
128:ymm5h
|
|
128:ymm6h
|
|
128:ymm7h
|
|
128:ymm8h
|
|
128:ymm9h
|
|
128:ymm10h
|
|
128:ymm11h
|
|
128:ymm12h
|
|
128:ymm13h
|
|
128:ymm14h
|
|
128:ymm15h
|
|
128:bnd0raw
|
|
128:bnd1raw
|
|
128:bnd2raw
|
|
128:bnd3raw
|
|
64:bndcfgu
|
|
64:bndstatus
|
|
128:xmm16
|
|
128:xmm17
|
|
128:xmm18
|
|
128:xmm19
|
|
128:xmm20
|
|
128:xmm21
|
|
128:xmm22
|
|
128:xmm23
|
|
128:xmm24
|
|
128:xmm25
|
|
128:xmm26
|
|
128:xmm27
|
|
128:xmm28
|
|
128:xmm29
|
|
128:xmm30
|
|
128:xmm31
|
|
128:ymm16h
|
|
128:ymm17h
|
|
128:ymm18h
|
|
128:ymm19h
|
|
128:ymm20h
|
|
128:ymm21h
|
|
128:ymm22h
|
|
128:ymm23h
|
|
128:ymm24h
|
|
128:ymm25h
|
|
128:ymm26h
|
|
128:ymm27h
|
|
128:ymm28h
|
|
128:ymm29h
|
|
128:ymm30h
|
|
128:ymm31h
|
|
64:k0
|
|
64:k1
|
|
64:k2
|
|
64:k3
|
|
64:k4
|
|
64:k5
|
|
64:k6
|
|
64:k7
|
|
256:zmm0h
|
|
256:zmm1h
|
|
256:zmm2h
|
|
256:zmm3h
|
|
256:zmm4h
|
|
256:zmm5h
|
|
256:zmm6h
|
|
256:zmm7h
|
|
256:zmm8h
|
|
256:zmm9h
|
|
256:zmm10h
|
|
256:zmm11h
|
|
256:zmm12h
|
|
256:zmm13h
|
|
256:zmm14h
|
|
256:zmm15h
|
|
256:zmm16h
|
|
256:zmm17h
|
|
256:zmm18h
|
|
256:zmm19h
|
|
256:zmm20h
|
|
256:zmm21h
|
|
256:zmm22h
|
|
256:zmm23h
|
|
256:zmm24h
|
|
256:zmm25h
|
|
256:zmm26h
|
|
256:zmm27h
|
|
256:zmm28h
|
|
256:zmm29h
|
|
256:zmm30h
|
|
256:zmm31h
|