From 2735833d5fb220983d09770087b573fed5bf93cd Mon Sep 17 00:00:00 2001 From: Walfred Tedeschi Date: Fri, 27 Jan 2017 15:19:14 +0100 Subject: [PATCH] amd64-linux: expose system register FS_BASE and GS_BASE for Linux. This patch allows examination of the registers FS_BASE and GS_BASE for Linux Systems running on 64bit. Tests for simple read and write of the new registers is also added with this patch. 2017-01-27 Walfred Tedeschi Richard Henderson gdb/ChangeLog: * amd64-linux-nat.c (PTRACE_ARCH_PRCTL): New define. (amd64_linux_fetch_inferior_registers): Add case to fetch FS_BASE GS_BASE for older kernels. (amd64_linux_store_inferior_registers): Add case to store FS_BASE GS_BASE for older kernels. * amd64-linux-tdep.c (amd64_linux_gregset_reg_offset): Add FS_BASE and GS_BASE to the offset table. (amd64_linux_register_reggroup_p): Add FS_BASE and GS_BASE to the system register group. * amd64-nat.c (amd64_native_gregset_reg_offset): Implements case for older kernels. * amd64-tdep.c (amd64_init_abi): Add segment registers for the amd64 ABI. * amd64-tdep.h (amd64_regnum): Add AMD64_FSBASE_REGNUM and AMD64_GSBASE_REGNUM. (AMD64_NUM_REGS): Set to AMD64_GSBASE_REGNUM + 1. * features/Makefile (amd64-linux.dat, amd64-avx-linux.dat) (amd64-mpx-linux.dat, amd64-avx512-linux.dat, x32-linux.dat) (x32-avx-linux.dat, x32-avx512-linux.dat): Add i386/64bit-segments.xml in those rules. * features/i386/64bit-segments.xml: New file. * features/i386/amd64-avx-mpx-linux.xml: Add 64bit-segments.xml. * features/i386/amd64-avx-linux.xml: Add 64bit-segments.xml. * features/i386/amd64-avx512-linux.xml: Add 64bit-segments.xml. * features/i386/amd64-mpx-linux.xml: Add 64bit-segments.xml. * features/i386/x32-avx512-linux.xml: Add 64bit-segments.xml. * features/i386/x32-avx-linux.xml: Add 64bit-segments.xml. * features/i386/amd64-linux.xml: Add 64bit-segments.xml. * features/i386/amd64-avx-linux.c: Regenerated. * features/i386/amd64-avx-mpx-linux.c: Regenerated. * features/i386/amd64-avx-mpx.c: Regenerated. * features/i386/amd64-avx512-linux.c: Regenerated. * features/i386/amd64-linux.c: Regenerated. * features/i386/amd64-mpx-linux.c: Regenerated. * features/i386/i386-avx-mpx-linux.c: Regenerated. * features/i386/i386-avx-mpx.c: Regenerated. * features/i386/x32-avx-linux.c: Regenerated. * features/i386/x32-avx512-linux.c: Regenerated. * regformats/i386/amd64-avx-linux.dat: Regenerated. * regformats/i386/amd64-avx-mpx-linux.dat: Regenerated. * regformats/i386/amd64-avx512-linux.dat: Regenerated. * regformats/i386/amd64-linux.dat: Regenerated. * regformats/i386/amd64-mpx-linux.dat: Regenerated. * regformats/i386/x32-avx-linux.dat: Regenerated. * regformats/i386/x32-avx512-linux.dat: Regenerated. * regformats/i386/x32-linux.dat: Regenerated. gdb/doc/ChangeLog: * gdb.texinfo (i386 Features): Add system segment registers as feature. gdb/gdbserver/ChangeLog: * linux-x86-low.c (x86_64_regmap): Add fs_base and gs_base to the register table. (x86_fill_gregset): Add support for old kernels for the fs_base and gs_base system registers. (x86_store_gregset): Likewise. * configure.srv (srv_i386_64bit_xmlfiles): Add 64bit-segments.xml. gdb/testsuite/ChangeLog: * gdb.arch/amd64-gs_base.c: New file. * gdb.arch/amd64-gs_base.exp: New file. Change-Id: I2e0eeb93058a2320d4d3b045082643cfe4aff963 Signed-off-by: Walfred Tedeschi --- gdb/ChangeLog | 50 +++++ gdb/amd64-linux-nat.c | 60 +++++- gdb/amd64-linux-tdep.c | 7 +- gdb/amd64-nat.c | 7 + gdb/amd64-tdep.c | 13 ++ gdb/amd64-tdep.h | 6 +- gdb/doc/ChangeLog | 5 + gdb/doc/gdb.texinfo | 3 + gdb/features/Makefile | 17 +- gdb/features/i386/64bit-segments.xml | 12 ++ gdb/features/i386/amd64-avx-linux.c | 36 ++-- gdb/features/i386/amd64-avx-linux.xml | 1 + gdb/features/i386/amd64-avx-mpx-linux.c | 48 ++--- gdb/features/i386/amd64-avx-mpx-linux.xml | 1 + gdb/features/i386/amd64-avx512-linux.c | 192 ++++++++++---------- gdb/features/i386/amd64-avx512-linux.xml | 1 + gdb/features/i386/amd64-linux.c | 4 + gdb/features/i386/amd64-linux.xml | 1 + gdb/features/i386/amd64-mpx-linux.c | 16 +- gdb/features/i386/amd64-mpx-linux.xml | 1 + gdb/features/i386/x32-avx-linux.c | 36 ++-- gdb/features/i386/x32-avx-linux.xml | 1 + gdb/features/i386/x32-avx512-linux.c | 192 ++++++++++---------- gdb/features/i386/x32-avx512-linux.xml | 1 + gdb/features/i386/x32-linux.c | 4 + gdb/features/i386/x32-linux.xml | 1 + gdb/gdbserver/configure.srv | 2 +- gdb/gdbserver/linux-x86-low.c | 32 ++++ gdb/regformats/i386/amd64-avx-linux.dat | 2 + gdb/regformats/i386/amd64-avx-mpx-linux.dat | 2 + gdb/regformats/i386/amd64-avx512-linux.dat | 2 + gdb/regformats/i386/amd64-linux.dat | 2 + gdb/regformats/i386/amd64-mpx-linux.dat | 2 + gdb/regformats/i386/x32-avx-linux.dat | 2 + gdb/regformats/i386/x32-avx512-linux.dat | 2 + gdb/regformats/i386/x32-linux.dat | 2 + gdb/testsuite/ChangeLog | 5 + gdb/testsuite/gdb.arch/amd64-gs_base.c | 24 +++ gdb/testsuite/gdb.arch/amd64-gs_base.exp | 49 +++++ 39 files changed, 579 insertions(+), 265 deletions(-) create mode 100644 gdb/features/i386/64bit-segments.xml create mode 100644 gdb/testsuite/gdb.arch/amd64-gs_base.c create mode 100644 gdb/testsuite/gdb.arch/amd64-gs_base.exp diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d4af52a02c2..327b327fdd1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,53 @@ +2017-01-27 Walfred Tedeschi + Richard Henderson + + * amd64-linux-nat.c (PTRACE_ARCH_PRCTL): New define. + (amd64_linux_fetch_inferior_registers): Add case to fetch FS_BASE + GS_BASE for older kernels. + (amd64_linux_store_inferior_registers): Add case to store FS_BASE + GS_BASE for older kernels. + * amd64-linux-tdep.c (amd64_linux_gregset_reg_offset): Add FS_BASE + and GS_BASE to the offset table. + (amd64_linux_register_reggroup_p): Add FS_BASE and GS_BASE to the + system register group. + * amd64-nat.c (amd64_native_gregset_reg_offset): Implements case + for older kernels. + * amd64-tdep.c (amd64_init_abi): Add segment registers for the + amd64 ABI. + * amd64-tdep.h (amd64_regnum): Add AMD64_FSBASE_REGNUM and + AMD64_GSBASE_REGNUM. + (AMD64_NUM_REGS): Set to AMD64_GSBASE_REGNUM + 1. + * features/Makefile (amd64-linux.dat, amd64-avx-linux.dat) + (amd64-mpx-linux.dat, amd64-avx512-linux.dat, x32-linux.dat) + (x32-avx-linux.dat, x32-avx512-linux.dat): Add + i386/64bit-segments.xml in those rules. + * features/i386/64bit-segments.xml: New file. + * features/i386/amd64-avx-mpx-linux.xml: Add 64bit-segments.xml. + * features/i386/amd64-avx-linux.xml: Add 64bit-segments.xml. + * features/i386/amd64-avx512-linux.xml: Add 64bit-segments.xml. + * features/i386/amd64-mpx-linux.xml: Add 64bit-segments.xml. + * features/i386/x32-avx512-linux.xml: Add 64bit-segments.xml. + * features/i386/x32-avx-linux.xml: Add 64bit-segments.xml. + * features/i386/amd64-linux.xml: Add 64bit-segments.xml. + * features/i386/amd64-avx-linux.c: Regenerated. + * features/i386/amd64-avx-mpx-linux.c: Regenerated. + * features/i386/amd64-avx-mpx.c: Regenerated. + * features/i386/amd64-avx512-linux.c: Regenerated. + * features/i386/amd64-linux.c: Regenerated. + * features/i386/amd64-mpx-linux.c: Regenerated. + * features/i386/i386-avx-mpx-linux.c: Regenerated. + * features/i386/i386-avx-mpx.c: Regenerated. + * features/i386/x32-avx-linux.c: Regenerated. + * features/i386/x32-avx512-linux.c: Regenerated. + * regformats/i386/amd64-avx-linux.dat: Regenerated. + * regformats/i386/amd64-avx-mpx-linux.dat: Regenerated. + * regformats/i386/amd64-avx512-linux.dat: Regenerated. + * regformats/i386/amd64-linux.dat: Regenerated. + * regformats/i386/amd64-mpx-linux.dat: Regenerated. + * regformats/i386/x32-avx-linux.dat: Regenerated. + * regformats/i386/x32-avx512-linux.dat: Regenerated. + * regformats/i386/x32-linux.dat: Regenerated. + 2017-01-27 Walfred Tedeschi * amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c index 4a2036b0f92..528984cb4db 100644 --- a/gdb/amd64-linux-nat.c +++ b/gdb/amd64-linux-nat.c @@ -40,6 +40,12 @@ #include "nat/linux-ptrace.h" #include "nat/amd64-linux-siginfo.h" +/* This definition comes from prctl.h. Kernels older than 2.5.64 + do not have it. */ +#ifndef PTRACE_ARCH_PRCTL +#define PTRACE_ARCH_PRCTL 30 +#endif + /* Mapping between the general-purpose registers in GNU/Linux x86-64 `struct user' format and GDB's register cache layout for GNU/Linux i386. @@ -171,6 +177,30 @@ amd64_linux_fetch_inferior_registers (struct target_ops *ops, amd64_supply_fxsave (regcache, -1, &fpregs); } +#ifndef HAVE_STRUCT_USER_REGS_STRUCT_FS_BASE + { + /* PTRACE_ARCH_PRCTL is obsolete since 2.6.25, where the + fs_base and gs_base fields of user_regs_struct can be + used directly. */ + unsigned long base; + + if (regnum == -1 || regnum == AMD64_FSBASE_REGNUM) + { + if (ptrace (PTRACE_ARCH_PRCTL, tid, &base, ARCH_GET_FS) < 0) + perror_with_name (_("Couldn't get segment register fs_base")); + + regcache_raw_supply (regcache, AMD64_FSBASE_REGNUM, &base); + } + + if (regnum == -1 || regnum == AMD64_GSBASE_REGNUM) + { + if (ptrace (PTRACE_ARCH_PRCTL, tid, &base, ARCH_GET_GS) < 0) + perror_with_name (_("Couldn't get segment register gs_base")); + + regcache_raw_supply (regcache, AMD64_GSBASE_REGNUM, &base); + } + } +#endif } } @@ -237,6 +267,30 @@ amd64_linux_store_inferior_registers (struct target_ops *ops, if (ptrace (PTRACE_SETFPREGS, tid, 0, (long) &fpregs) < 0) perror_with_name (_("Couldn't write floating point status")); } + +#ifndef HAVE_STRUCT_USER_REGS_STRUCT_FS_BASE + { + /* PTRACE_ARCH_PRCTL is obsolete since 2.6.25, where the + fs_base and gs_base fields of user_regs_struct can be + used directly. */ + void *base; + + if (regnum == -1 || regnum == AMD64_FSBASE_REGNUM) + { + regcache_raw_collect (regcache, AMD64_FSBASE_REGNUM, &base); + + if (ptrace (PTRACE_ARCH_PRCTL, tid, base, ARCH_SET_FS) < 0) + perror_with_name (_("Couldn't write segment register fs_base")); + } + if (regnum == -1 || regnum == AMD64_GSBASE_REGNUM) + { + + regcache_raw_collect (regcache, AMD64_GSBASE_REGNUM, &base); + if (ptrace (PTRACE_ARCH_PRCTL, tid, base, ARCH_SET_GS) < 0) + perror_with_name (_("Couldn't write segment register gs_base")); + } + } +#endif } } @@ -265,11 +319,7 @@ ps_get_thread_area (struct ps_prochandle *ph, } else { - /* This definition comes from prctl.h, but some kernels may not - have it. */ -#ifndef PTRACE_ARCH_PRCTL -#define PTRACE_ARCH_PRCTL 30 -#endif + /* FIXME: ezannoni-2003-07-09 see comment above about include file order. We could be getting bogus values for these two. */ gdb_assert (FS < ELF_NGREG); diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c index 1e9f75f2c02..b9d71763924 100644 --- a/gdb/amd64-linux-tdep.c +++ b/gdb/amd64-linux-tdep.c @@ -103,6 +103,9 @@ int amd64_linux_gregset_reg_offset[] = -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + + /* End of hardware registers */ + 21 * 8, 22 * 8, /* fs_base and gs_base. */ 15 * 8 /* "orig_rax" */ }; @@ -284,7 +287,9 @@ static int amd64_linux_register_reggroup_p (struct gdbarch *gdbarch, int regnum, struct reggroup *group) { - if (regnum == AMD64_LINUX_ORIG_RAX_REGNUM) + if (regnum == AMD64_LINUX_ORIG_RAX_REGNUM + || regnum == AMD64_FSBASE_REGNUM + || regnum == AMD64_GSBASE_REGNUM) return (group == system_reggroup || group == save_reggroup || group == restore_reggroup); diff --git a/gdb/amd64-nat.c b/gdb/amd64-nat.c index 680105b47c8..ff0433997ea 100644 --- a/gdb/amd64-nat.c +++ b/gdb/amd64-nat.c @@ -68,6 +68,13 @@ amd64_native_gregset_reg_offset (struct gdbarch *gdbarch, int regnum) if (regnum >= num_regs) return -1; + /* Kernels that predate Linux 2.6.25 don't provide access to + these segment registers in user_regs_struct. */ +#ifndef HAVE_STRUCT_USER_REGS_STRUCT_FS_BASE + if (regnum == AMD64_FSBASE_REGNUM || regnum == AMD64_GSBASE_REGNUM) + return -1; +#endif + return reg_offset[regnum]; } diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index fc1f134a180..233c65acc29 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -3047,6 +3047,19 @@ amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) tdep->bnd0r_regnum = AMD64_BND0R_REGNUM; } + if (tdesc_find_feature (tdesc, "org.gnu.gdb.i386.segments") != NULL) + { + const struct tdesc_feature *feature = + tdesc_find_feature (tdesc, "org.gnu.gdb.i386.segments"); + struct tdesc_arch_data *tdesc_data_segments = + (struct tdesc_arch_data *) info.tdep_info; + + tdesc_numbered_register (feature, tdesc_data_segments, + AMD64_FSBASE_REGNUM, "fs_base"); + tdesc_numbered_register (feature, tdesc_data_segments, + AMD64_GSBASE_REGNUM, "gs_base"); + } + tdep->num_byte_regs = 20; tdep->num_word_regs = 16; tdep->num_dword_regs = 16; diff --git a/gdb/amd64-tdep.h b/gdb/amd64-tdep.h index 3f84947ca19..8ccf03111ca 100644 --- a/gdb/amd64-tdep.h +++ b/gdb/amd64-tdep.h @@ -76,13 +76,15 @@ enum amd64_regnum AMD64_K0_REGNUM, AMD64_K7_REGNUM = AMD64_K0_REGNUM + 7, AMD64_ZMM0H_REGNUM, - AMD64_ZMM31H_REGNUM = AMD64_ZMM0H_REGNUM + 31 + AMD64_ZMM31H_REGNUM = AMD64_ZMM0H_REGNUM + 31, + AMD64_FSBASE_REGNUM, + AMD64_GSBASE_REGNUM }; /* Number of general purpose registers. */ #define AMD64_NUM_GREGS 24 -#define AMD64_NUM_REGS (AMD64_ZMM31H_REGNUM + 1) +#define AMD64_NUM_REGS (AMD64_GSBASE_REGNUM + 1) extern struct target_desc *tdesc_amd64; diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index a47c4f5cc97..670e9b75bfc 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2017-01-27 Walfred Tedeschi + + * gdb.texinfo (i386 Features): Add system segment registers + as feature. + 2017-01-24 Simon Marchi * python.texi (Events In Python): Fix typo. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index dcca91bd688..b9b4c8247c8 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -41180,6 +41180,9 @@ Memory Protection Extension (MPX). It should describe the following registers: The @samp{org.gnu.gdb.i386.linux} feature is optional. It should describe a single register, @samp{orig_eax}. +The @samp{org.gnu.gdb.i386.segments} feature is optional. It should +describe two system registers: @samp{fs_base} and @samp{gs_base}. + The @samp{org.gnu.gdb.i386.avx512} feature is optional and requires the @samp{org.gnu.gdb.i386.avx} feature. It should describe additional @sc{xmm} registers: diff --git a/gdb/features/Makefile b/gdb/features/Makefile index 63f82488cba..5a826415f15 100644 --- a/gdb/features/Makefile +++ b/gdb/features/Makefile @@ -259,7 +259,7 @@ $(outdir)/i386/i386-linux.dat: i386/32bit-core.xml i386/32bit-sse.xml \ i386/32bit-linux.xml $(outdir)/i386/amd64.dat: i386/64bit-core.xml i386/64bit-sse.xml $(outdir)/i386/amd64-linux.dat: i386/64bit-core.xml i386/64bit-sse.xml \ - i386/64bit-linux.xml + i386/64bit-linux.xml i386/64bit-segments.xml $(outdir)/i386/i386-avx.dat: i386/32bit-core.xml i386/32bit-avx.xml $(outdir)/i386/i386-avx-linux.dat: i386/32bit-core.xml i386/32bit-avx.xml \ i386/32bit-linux.xml @@ -279,11 +279,11 @@ $(outdir)/i386/i386-mmx.dat: i386/32bit-core.xml $(outdir)/i386/i386-mmx-linux.dat: i386/32bit-core.xml i386/32bit-linux.xml $(outdir)/i386/amd64-avx.dat: i386/64bit-core.xml i386/64bit-avx.xml $(outdir)/i386/amd64-avx-linux.dat: i386/64bit-core.xml i386/64bit-avx.xml \ - i386/64bit-linux.xml + i386/64bit-linux.xml i386/64bit-segments.xml $(outdir)/i386/amd64-mpx-linux.dat: i386/64bit-core.xml i386/64bit-avx.xml \ - i386/64bit-linux.xml i386/64bit-mpx.xml + i386/64bit-linux.xml i386/64bit-segments.xml i386/64bit-mpx.xml $(outdir)/i386/amd64-avx-mpx-linux.dat: i386/64bit-core.xml \ - i386/64bit-linux.xml i386/64bit-mpx.xml + i386/64bit-linux.xml i386/64bit-segments.xml i386/64bit-mpx.xml $(outdir)/i386/amd64-mpx.dat: i386/64bit-core.xml i386/64bit-avx.xml \ i386/64bit-mpx.xml $(outdir)/i386/amd64-avx-mpx.dat: i386/64bit-core.xml \ @@ -292,17 +292,18 @@ $(outdir)/i386/amd64-avx512.dat: i386/64bit-core.xml i386/64bit-avx.xml \ i386/64bit-mpx.xml i386/64bit-avx512.xml $(outdir)/i386/amd64-avx512-linux.dat: i386/64bit-core.xml i386/64bit-avx.xml \ i386/64bit-mpx.xml i386/64bit-avx512.xml \ - i386/64bit-linux.xml + i386/64bit-linux.xml i386/64bit-segments.xml $(outdir)/i386/x32.dat: i386/x32-core.xml i386/64bit-sse.xml $(outdir)/i386/x32-linux.dat: i386/x32-core.xml i386/64bit-sse.xml \ - i386/64bit-linux.xml + i386/64bit-linux.xml i386/64bit-segments.xml $(outdir)/i386/x32-avx.dat: i386/x32-core.xml i386/64bit-avx.xml $(outdir)/i386/x32-avx-linux.dat: i386/x32-core.xml i386/64bit-avx.xml \ - i386/64bit-linux.xml + i386/64bit-linux.xml i386/64bit-segments.xml $(outdir)/i386/x32-avx512.dat: i386/x32-core.xml i386/64bit-avx.xml \ i386/64bit-mpx.xml i386/64bit-avx512.xml $(outdir)/i386/x32-avx512-linux.dat: i386/x32-core.xml i386/64bit-avx.xml \ - i386/64bit-mpx.xml i386/64bit-avx512.xml i386/64bit-linux.xml + i386/64bit-mpx.xml i386/64bit-avx512.xml \ + i386/64bit-linux.xml i386/64bit-segments.xml # 'all' doesn't build the C files, so don't delete them in 'clean' # either. diff --git a/gdb/features/i386/64bit-segments.xml b/gdb/features/i386/64bit-segments.xml new file mode 100644 index 00000000000..db57a14996b --- /dev/null +++ b/gdb/features/i386/64bit-segments.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/gdb/features/i386/amd64-avx-linux.c b/gdb/features/i386/amd64-avx-linux.c index 9c8f9ebc398..1d56dbff8b1 100644 --- a/gdb/features/i386/amd64-avx-linux.c +++ b/gdb/features/i386/amd64-avx-linux.c @@ -151,23 +151,27 @@ initialize_tdesc_amd64_avx_linux (void) feature = tdesc_create_feature (result, "org.gnu.gdb.i386.linux"); tdesc_create_reg (feature, "orig_rax", 57, 1, NULL, 64, "int"); + feature = tdesc_create_feature (result, "org.gnu.gdb.i386.segments"); + tdesc_create_reg (feature, "fs_base", 58, 1, NULL, 64, "int"); + tdesc_create_reg (feature, "gs_base", 59, 1, NULL, 64, "int"); + feature = tdesc_create_feature (result, "org.gnu.gdb.i386.avx"); - tdesc_create_reg (feature, "ymm0h", 58, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm1h", 59, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm2h", 60, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm3h", 61, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm4h", 62, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm5h", 63, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm6h", 64, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm7h", 65, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm8h", 66, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm9h", 67, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm10h", 68, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm11h", 69, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm12h", 70, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm13h", 71, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm14h", 72, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm15h", 73, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm0h", 60, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm1h", 61, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm2h", 62, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm3h", 63, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm4h", 64, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm5h", 65, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm6h", 66, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm7h", 67, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm8h", 68, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm9h", 69, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm10h", 70, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm11h", 71, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm12h", 72, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm13h", 73, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm14h", 74, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm15h", 75, 1, NULL, 128, "uint128"); tdesc_amd64_avx_linux = result; } diff --git a/gdb/features/i386/amd64-avx-linux.xml b/gdb/features/i386/amd64-avx-linux.xml index 470dd553db4..2dac9cd3c7e 100644 --- a/gdb/features/i386/amd64-avx-linux.xml +++ b/gdb/features/i386/amd64-avx-linux.xml @@ -14,5 +14,6 @@ + diff --git a/gdb/features/i386/amd64-avx-mpx-linux.c b/gdb/features/i386/amd64-avx-mpx-linux.c index 46054803cc9..26c133975dc 100644 --- a/gdb/features/i386/amd64-avx-mpx-linux.c +++ b/gdb/features/i386/amd64-avx-mpx-linux.c @@ -151,23 +151,27 @@ initialize_tdesc_amd64_avx_mpx_linux (void) feature = tdesc_create_feature (result, "org.gnu.gdb.i386.linux"); tdesc_create_reg (feature, "orig_rax", 57, 1, NULL, 64, "int"); + feature = tdesc_create_feature (result, "org.gnu.gdb.i386.segments"); + tdesc_create_reg (feature, "fs_base", 58, 1, NULL, 64, "int"); + tdesc_create_reg (feature, "gs_base", 59, 1, NULL, 64, "int"); + feature = tdesc_create_feature (result, "org.gnu.gdb.i386.avx"); - tdesc_create_reg (feature, "ymm0h", 58, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm1h", 59, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm2h", 60, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm3h", 61, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm4h", 62, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm5h", 63, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm6h", 64, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm7h", 65, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm8h", 66, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm9h", 67, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm10h", 68, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm11h", 69, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm12h", 70, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm13h", 71, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm14h", 72, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm15h", 73, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm0h", 60, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm1h", 61, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm2h", 62, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm3h", 63, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm4h", 64, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm5h", 65, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm6h", 66, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm7h", 67, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm8h", 68, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm9h", 69, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm10h", 70, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm11h", 71, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm12h", 72, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm13h", 73, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm14h", 74, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm15h", 75, 1, NULL, 128, "uint128"); feature = tdesc_create_feature (result, "org.gnu.gdb.i386.mpx"); type = tdesc_create_struct (feature, "br128"); @@ -200,12 +204,12 @@ initialize_tdesc_amd64_avx_mpx_linux (void) field_type = tdesc_named_type (feature, "_bndcfgu"); tdesc_add_field (type, "config", field_type); - tdesc_create_reg (feature, "bnd0raw", 74, 1, NULL, 128, "br128"); - tdesc_create_reg (feature, "bnd1raw", 75, 1, NULL, 128, "br128"); - tdesc_create_reg (feature, "bnd2raw", 76, 1, NULL, 128, "br128"); - tdesc_create_reg (feature, "bnd3raw", 77, 1, NULL, 128, "br128"); - tdesc_create_reg (feature, "bndcfgu", 78, 1, NULL, 64, "cfgu"); - tdesc_create_reg (feature, "bndstatus", 79, 1, NULL, 64, "status"); + tdesc_create_reg (feature, "bnd0raw", 76, 1, NULL, 128, "br128"); + tdesc_create_reg (feature, "bnd1raw", 77, 1, NULL, 128, "br128"); + tdesc_create_reg (feature, "bnd2raw", 78, 1, NULL, 128, "br128"); + tdesc_create_reg (feature, "bnd3raw", 79, 1, NULL, 128, "br128"); + tdesc_create_reg (feature, "bndcfgu", 80, 1, NULL, 64, "cfgu"); + tdesc_create_reg (feature, "bndstatus", 81, 1, NULL, 64, "status"); tdesc_amd64_avx_mpx_linux = result; } diff --git a/gdb/features/i386/amd64-avx-mpx-linux.xml b/gdb/features/i386/amd64-avx-mpx-linux.xml index e29317f6d8c..433f7778c3d 100644 --- a/gdb/features/i386/amd64-avx-mpx-linux.xml +++ b/gdb/features/i386/amd64-avx-mpx-linux.xml @@ -14,6 +14,7 @@ + diff --git a/gdb/features/i386/amd64-avx512-linux.c b/gdb/features/i386/amd64-avx512-linux.c index ec3ba61b858..b071f624030 100644 --- a/gdb/features/i386/amd64-avx512-linux.c +++ b/gdb/features/i386/amd64-avx512-linux.c @@ -151,23 +151,27 @@ initialize_tdesc_amd64_avx512_linux (void) feature = tdesc_create_feature (result, "org.gnu.gdb.i386.linux"); tdesc_create_reg (feature, "orig_rax", 57, 1, NULL, 64, "int"); + feature = tdesc_create_feature (result, "org.gnu.gdb.i386.segments"); + tdesc_create_reg (feature, "fs_base", 58, 1, NULL, 64, "int"); + tdesc_create_reg (feature, "gs_base", 59, 1, NULL, 64, "int"); + feature = tdesc_create_feature (result, "org.gnu.gdb.i386.avx"); - tdesc_create_reg (feature, "ymm0h", 58, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm1h", 59, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm2h", 60, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm3h", 61, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm4h", 62, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm5h", 63, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm6h", 64, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm7h", 65, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm8h", 66, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm9h", 67, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm10h", 68, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm11h", 69, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm12h", 70, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm13h", 71, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm14h", 72, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm15h", 73, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm0h", 60, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm1h", 61, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm2h", 62, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm3h", 63, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm4h", 64, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm5h", 65, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm6h", 66, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm7h", 67, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm8h", 68, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm9h", 69, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm10h", 70, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm11h", 71, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm12h", 72, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm13h", 73, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm14h", 74, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm15h", 75, 1, NULL, 128, "uint128"); feature = tdesc_create_feature (result, "org.gnu.gdb.i386.mpx"); type = tdesc_create_struct (feature, "br128"); @@ -200,12 +204,12 @@ initialize_tdesc_amd64_avx512_linux (void) field_type = tdesc_named_type (feature, "_bndcfgu"); tdesc_add_field (type, "config", field_type); - tdesc_create_reg (feature, "bnd0raw", 74, 1, NULL, 128, "br128"); - tdesc_create_reg (feature, "bnd1raw", 75, 1, NULL, 128, "br128"); - tdesc_create_reg (feature, "bnd2raw", 76, 1, NULL, 128, "br128"); - tdesc_create_reg (feature, "bnd3raw", 77, 1, NULL, 128, "br128"); - tdesc_create_reg (feature, "bndcfgu", 78, 1, NULL, 64, "cfgu"); - tdesc_create_reg (feature, "bndstatus", 79, 1, NULL, 64, "status"); + tdesc_create_reg (feature, "bnd0raw", 76, 1, NULL, 128, "br128"); + tdesc_create_reg (feature, "bnd1raw", 77, 1, NULL, 128, "br128"); + tdesc_create_reg (feature, "bnd2raw", 78, 1, NULL, 128, "br128"); + tdesc_create_reg (feature, "bnd3raw", 79, 1, NULL, 128, "br128"); + tdesc_create_reg (feature, "bndcfgu", 80, 1, NULL, 64, "cfgu"); + tdesc_create_reg (feature, "bndstatus", 81, 1, NULL, 64, "status"); feature = tdesc_create_feature (result, "org.gnu.gdb.i386.avx512"); field_type = tdesc_named_type (feature, "ieee_single"); @@ -245,78 +249,78 @@ initialize_tdesc_amd64_avx512_linux (void) field_type = tdesc_named_type (feature, "uint128"); tdesc_create_vector (feature, "v2ui128", field_type, 2); - tdesc_create_reg (feature, "xmm16", 80, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm17", 81, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm18", 82, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm19", 83, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm20", 84, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm21", 85, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm22", 86, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm23", 87, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm24", 88, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm25", 89, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm26", 90, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm27", 91, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm28", 92, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm29", 93, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm30", 94, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm31", 95, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "ymm16h", 96, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm17h", 97, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm18h", 98, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm19h", 99, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm20h", 100, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm21h", 101, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm22h", 102, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm23h", 103, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm24h", 104, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm25h", 105, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm26h", 106, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm27h", 107, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm28h", 108, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm29h", 109, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm30h", 110, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm31h", 111, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "k0", 112, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "k1", 113, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "k2", 114, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "k3", 115, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "k4", 116, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "k5", 117, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "k6", 118, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "k7", 119, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "zmm0h", 120, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm1h", 121, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm2h", 122, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm3h", 123, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm4h", 124, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm5h", 125, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm6h", 126, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm7h", 127, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm8h", 128, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm9h", 129, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm10h", 130, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm11h", 131, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm12h", 132, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm13h", 133, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm14h", 134, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm15h", 135, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm16h", 136, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm17h", 137, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm18h", 138, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm19h", 139, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm20h", 140, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm21h", 141, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm22h", 142, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm23h", 143, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm24h", 144, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm25h", 145, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm26h", 146, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm27h", 147, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm28h", 148, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm29h", 149, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm30h", 150, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm31h", 151, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "xmm16", 82, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm17", 83, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm18", 84, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm19", 85, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm20", 86, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm21", 87, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm22", 88, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm23", 89, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm24", 90, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm25", 91, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm26", 92, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm27", 93, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm28", 94, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm29", 95, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm30", 96, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm31", 97, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "ymm16h", 98, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm17h", 99, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm18h", 100, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm19h", 101, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm20h", 102, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm21h", 103, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm22h", 104, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm23h", 105, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm24h", 106, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm25h", 107, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm26h", 108, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm27h", 109, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm28h", 110, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm29h", 111, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm30h", 112, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm31h", 113, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "k0", 114, 1, NULL, 64, "uint64"); + tdesc_create_reg (feature, "k1", 115, 1, NULL, 64, "uint64"); + tdesc_create_reg (feature, "k2", 116, 1, NULL, 64, "uint64"); + tdesc_create_reg (feature, "k3", 117, 1, NULL, 64, "uint64"); + tdesc_create_reg (feature, "k4", 118, 1, NULL, 64, "uint64"); + tdesc_create_reg (feature, "k5", 119, 1, NULL, 64, "uint64"); + tdesc_create_reg (feature, "k6", 120, 1, NULL, 64, "uint64"); + tdesc_create_reg (feature, "k7", 121, 1, NULL, 64, "uint64"); + tdesc_create_reg (feature, "zmm0h", 122, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm1h", 123, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm2h", 124, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm3h", 125, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm4h", 126, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm5h", 127, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm6h", 128, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm7h", 129, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm8h", 130, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm9h", 131, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm10h", 132, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm11h", 133, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm12h", 134, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm13h", 135, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm14h", 136, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm15h", 137, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm16h", 138, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm17h", 139, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm18h", 140, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm19h", 141, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm20h", 142, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm21h", 143, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm22h", 144, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm23h", 145, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm24h", 146, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm25h", 147, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm26h", 148, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm27h", 149, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm28h", 150, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm29h", 151, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm30h", 152, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm31h", 153, 1, NULL, 256, "v2ui128"); tdesc_amd64_avx512_linux = result; } diff --git a/gdb/features/i386/amd64-avx512-linux.xml b/gdb/features/i386/amd64-avx512-linux.xml index 2ee2e8bbd51..516f4e32e3d 100644 --- a/gdb/features/i386/amd64-avx512-linux.xml +++ b/gdb/features/i386/amd64-avx512-linux.xml @@ -14,6 +14,7 @@ + diff --git a/gdb/features/i386/amd64-linux.c b/gdb/features/i386/amd64-linux.c index 02aeba523d0..0e921ba9a16 100644 --- a/gdb/features/i386/amd64-linux.c +++ b/gdb/features/i386/amd64-linux.c @@ -151,5 +151,9 @@ initialize_tdesc_amd64_linux (void) feature = tdesc_create_feature (result, "org.gnu.gdb.i386.linux"); tdesc_create_reg (feature, "orig_rax", 57, 1, NULL, 64, "int"); + feature = tdesc_create_feature (result, "org.gnu.gdb.i386.segments"); + tdesc_create_reg (feature, "fs_base", 58, 1, NULL, 64, "int"); + tdesc_create_reg (feature, "gs_base", 59, 1, NULL, 64, "int"); + tdesc_amd64_linux = result; } diff --git a/gdb/features/i386/amd64-linux.xml b/gdb/features/i386/amd64-linux.xml index 2ce9341b389..7d3a9f2e843 100644 --- a/gdb/features/i386/amd64-linux.xml +++ b/gdb/features/i386/amd64-linux.xml @@ -14,4 +14,5 @@ + diff --git a/gdb/features/i386/amd64-mpx-linux.c b/gdb/features/i386/amd64-mpx-linux.c index a20ca4fbd9f..e26a74a7f72 100644 --- a/gdb/features/i386/amd64-mpx-linux.c +++ b/gdb/features/i386/amd64-mpx-linux.c @@ -151,6 +151,10 @@ initialize_tdesc_amd64_mpx_linux (void) feature = tdesc_create_feature (result, "org.gnu.gdb.i386.linux"); tdesc_create_reg (feature, "orig_rax", 57, 1, NULL, 64, "int"); + feature = tdesc_create_feature (result, "org.gnu.gdb.i386.segments"); + tdesc_create_reg (feature, "fs_base", 58, 1, NULL, 64, "int"); + tdesc_create_reg (feature, "gs_base", 59, 1, NULL, 64, "int"); + feature = tdesc_create_feature (result, "org.gnu.gdb.i386.mpx"); type = tdesc_create_struct (feature, "br128"); field_type = tdesc_named_type (feature, "uint64"); @@ -182,12 +186,12 @@ initialize_tdesc_amd64_mpx_linux (void) field_type = tdesc_named_type (feature, "_bndcfgu"); tdesc_add_field (type, "config", field_type); - tdesc_create_reg (feature, "bnd0raw", 58, 1, NULL, 128, "br128"); - tdesc_create_reg (feature, "bnd1raw", 59, 1, NULL, 128, "br128"); - tdesc_create_reg (feature, "bnd2raw", 60, 1, NULL, 128, "br128"); - tdesc_create_reg (feature, "bnd3raw", 61, 1, NULL, 128, "br128"); - tdesc_create_reg (feature, "bndcfgu", 62, 1, NULL, 64, "cfgu"); - tdesc_create_reg (feature, "bndstatus", 63, 1, NULL, 64, "status"); + tdesc_create_reg (feature, "bnd0raw", 60, 1, NULL, 128, "br128"); + tdesc_create_reg (feature, "bnd1raw", 61, 1, NULL, 128, "br128"); + tdesc_create_reg (feature, "bnd2raw", 62, 1, NULL, 128, "br128"); + tdesc_create_reg (feature, "bnd3raw", 63, 1, NULL, 128, "br128"); + tdesc_create_reg (feature, "bndcfgu", 64, 1, NULL, 64, "cfgu"); + tdesc_create_reg (feature, "bndstatus", 65, 1, NULL, 64, "status"); tdesc_amd64_mpx_linux = result; } diff --git a/gdb/features/i386/amd64-mpx-linux.xml b/gdb/features/i386/amd64-mpx-linux.xml index 9c7cf9a1f16..853b819f785 100644 --- a/gdb/features/i386/amd64-mpx-linux.xml +++ b/gdb/features/i386/amd64-mpx-linux.xml @@ -14,5 +14,6 @@ + diff --git a/gdb/features/i386/x32-avx-linux.c b/gdb/features/i386/x32-avx-linux.c index b12c71cff4b..84068150486 100644 --- a/gdb/features/i386/x32-avx-linux.c +++ b/gdb/features/i386/x32-avx-linux.c @@ -151,23 +151,27 @@ initialize_tdesc_x32_avx_linux (void) feature = tdesc_create_feature (result, "org.gnu.gdb.i386.linux"); tdesc_create_reg (feature, "orig_rax", 57, 1, NULL, 64, "int"); + feature = tdesc_create_feature (result, "org.gnu.gdb.i386.segments"); + tdesc_create_reg (feature, "fs_base", 58, 1, NULL, 64, "int"); + tdesc_create_reg (feature, "gs_base", 59, 1, NULL, 64, "int"); + feature = tdesc_create_feature (result, "org.gnu.gdb.i386.avx"); - tdesc_create_reg (feature, "ymm0h", 58, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm1h", 59, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm2h", 60, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm3h", 61, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm4h", 62, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm5h", 63, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm6h", 64, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm7h", 65, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm8h", 66, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm9h", 67, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm10h", 68, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm11h", 69, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm12h", 70, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm13h", 71, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm14h", 72, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm15h", 73, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm0h", 60, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm1h", 61, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm2h", 62, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm3h", 63, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm4h", 64, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm5h", 65, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm6h", 66, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm7h", 67, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm8h", 68, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm9h", 69, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm10h", 70, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm11h", 71, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm12h", 72, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm13h", 73, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm14h", 74, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm15h", 75, 1, NULL, 128, "uint128"); tdesc_x32_avx_linux = result; } diff --git a/gdb/features/i386/x32-avx-linux.xml b/gdb/features/i386/x32-avx-linux.xml index f60a443a5ed..89d2e7c76a8 100644 --- a/gdb/features/i386/x32-avx-linux.xml +++ b/gdb/features/i386/x32-avx-linux.xml @@ -14,5 +14,6 @@ + diff --git a/gdb/features/i386/x32-avx512-linux.c b/gdb/features/i386/x32-avx512-linux.c index 7b2ab90fef8..399499632ba 100644 --- a/gdb/features/i386/x32-avx512-linux.c +++ b/gdb/features/i386/x32-avx512-linux.c @@ -151,23 +151,27 @@ initialize_tdesc_x32_avx512_linux (void) feature = tdesc_create_feature (result, "org.gnu.gdb.i386.linux"); tdesc_create_reg (feature, "orig_rax", 57, 1, NULL, 64, "int"); + feature = tdesc_create_feature (result, "org.gnu.gdb.i386.segments"); + tdesc_create_reg (feature, "fs_base", 58, 1, NULL, 64, "int"); + tdesc_create_reg (feature, "gs_base", 59, 1, NULL, 64, "int"); + feature = tdesc_create_feature (result, "org.gnu.gdb.i386.avx"); - tdesc_create_reg (feature, "ymm0h", 58, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm1h", 59, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm2h", 60, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm3h", 61, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm4h", 62, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm5h", 63, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm6h", 64, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm7h", 65, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm8h", 66, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm9h", 67, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm10h", 68, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm11h", 69, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm12h", 70, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm13h", 71, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm14h", 72, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm15h", 73, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm0h", 60, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm1h", 61, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm2h", 62, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm3h", 63, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm4h", 64, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm5h", 65, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm6h", 66, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm7h", 67, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm8h", 68, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm9h", 69, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm10h", 70, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm11h", 71, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm12h", 72, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm13h", 73, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm14h", 74, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm15h", 75, 1, NULL, 128, "uint128"); feature = tdesc_create_feature (result, "org.gnu.gdb.i386.mpx"); type = tdesc_create_struct (feature, "br128"); @@ -200,12 +204,12 @@ initialize_tdesc_x32_avx512_linux (void) field_type = tdesc_named_type (feature, "_bndcfgu"); tdesc_add_field (type, "config", field_type); - tdesc_create_reg (feature, "bnd0raw", 74, 1, NULL, 128, "br128"); - tdesc_create_reg (feature, "bnd1raw", 75, 1, NULL, 128, "br128"); - tdesc_create_reg (feature, "bnd2raw", 76, 1, NULL, 128, "br128"); - tdesc_create_reg (feature, "bnd3raw", 77, 1, NULL, 128, "br128"); - tdesc_create_reg (feature, "bndcfgu", 78, 1, NULL, 64, "cfgu"); - tdesc_create_reg (feature, "bndstatus", 79, 1, NULL, 64, "status"); + tdesc_create_reg (feature, "bnd0raw", 76, 1, NULL, 128, "br128"); + tdesc_create_reg (feature, "bnd1raw", 77, 1, NULL, 128, "br128"); + tdesc_create_reg (feature, "bnd2raw", 78, 1, NULL, 128, "br128"); + tdesc_create_reg (feature, "bnd3raw", 79, 1, NULL, 128, "br128"); + tdesc_create_reg (feature, "bndcfgu", 80, 1, NULL, 64, "cfgu"); + tdesc_create_reg (feature, "bndstatus", 81, 1, NULL, 64, "status"); feature = tdesc_create_feature (result, "org.gnu.gdb.i386.avx512"); field_type = tdesc_named_type (feature, "ieee_single"); @@ -245,78 +249,78 @@ initialize_tdesc_x32_avx512_linux (void) field_type = tdesc_named_type (feature, "uint128"); tdesc_create_vector (feature, "v2ui128", field_type, 2); - tdesc_create_reg (feature, "xmm16", 80, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm17", 81, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm18", 82, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm19", 83, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm20", 84, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm21", 85, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm22", 86, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm23", 87, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm24", 88, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm25", 89, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm26", 90, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm27", 91, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm28", 92, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm29", 93, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm30", 94, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "xmm31", 95, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "ymm16h", 96, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm17h", 97, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm18h", 98, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm19h", 99, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm20h", 100, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm21h", 101, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm22h", 102, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm23h", 103, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm24h", 104, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm25h", 105, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm26h", 106, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm27h", 107, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm28h", 108, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm29h", 109, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm30h", 110, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "ymm31h", 111, 1, NULL, 128, "uint128"); - tdesc_create_reg (feature, "k0", 112, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "k1", 113, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "k2", 114, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "k3", 115, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "k4", 116, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "k5", 117, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "k6", 118, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "k7", 119, 1, NULL, 64, "uint64"); - tdesc_create_reg (feature, "zmm0h", 120, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm1h", 121, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm2h", 122, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm3h", 123, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm4h", 124, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm5h", 125, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm6h", 126, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm7h", 127, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm8h", 128, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm9h", 129, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm10h", 130, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm11h", 131, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm12h", 132, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm13h", 133, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm14h", 134, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm15h", 135, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm16h", 136, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm17h", 137, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm18h", 138, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm19h", 139, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm20h", 140, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm21h", 141, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm22h", 142, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm23h", 143, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm24h", 144, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm25h", 145, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm26h", 146, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm27h", 147, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm28h", 148, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm29h", 149, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm30h", 150, 1, NULL, 256, "v2ui128"); - tdesc_create_reg (feature, "zmm31h", 151, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "xmm16", 82, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm17", 83, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm18", 84, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm19", 85, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm20", 86, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm21", 87, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm22", 88, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm23", 89, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm24", 90, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm25", 91, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm26", 92, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm27", 93, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm28", 94, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm29", 95, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm30", 96, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "xmm31", 97, 1, NULL, 128, "vec128"); + tdesc_create_reg (feature, "ymm16h", 98, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm17h", 99, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm18h", 100, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm19h", 101, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm20h", 102, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm21h", 103, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm22h", 104, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm23h", 105, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm24h", 106, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm25h", 107, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm26h", 108, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm27h", 109, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm28h", 110, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm29h", 111, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm30h", 112, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "ymm31h", 113, 1, NULL, 128, "uint128"); + tdesc_create_reg (feature, "k0", 114, 1, NULL, 64, "uint64"); + tdesc_create_reg (feature, "k1", 115, 1, NULL, 64, "uint64"); + tdesc_create_reg (feature, "k2", 116, 1, NULL, 64, "uint64"); + tdesc_create_reg (feature, "k3", 117, 1, NULL, 64, "uint64"); + tdesc_create_reg (feature, "k4", 118, 1, NULL, 64, "uint64"); + tdesc_create_reg (feature, "k5", 119, 1, NULL, 64, "uint64"); + tdesc_create_reg (feature, "k6", 120, 1, NULL, 64, "uint64"); + tdesc_create_reg (feature, "k7", 121, 1, NULL, 64, "uint64"); + tdesc_create_reg (feature, "zmm0h", 122, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm1h", 123, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm2h", 124, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm3h", 125, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm4h", 126, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm5h", 127, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm6h", 128, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm7h", 129, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm8h", 130, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm9h", 131, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm10h", 132, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm11h", 133, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm12h", 134, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm13h", 135, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm14h", 136, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm15h", 137, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm16h", 138, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm17h", 139, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm18h", 140, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm19h", 141, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm20h", 142, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm21h", 143, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm22h", 144, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm23h", 145, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm24h", 146, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm25h", 147, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm26h", 148, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm27h", 149, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm28h", 150, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm29h", 151, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm30h", 152, 1, NULL, 256, "v2ui128"); + tdesc_create_reg (feature, "zmm31h", 153, 1, NULL, 256, "v2ui128"); tdesc_x32_avx512_linux = result; } diff --git a/gdb/features/i386/x32-avx512-linux.xml b/gdb/features/i386/x32-avx512-linux.xml index 73238dc207f..7266c8e4862 100644 --- a/gdb/features/i386/x32-avx512-linux.xml +++ b/gdb/features/i386/x32-avx512-linux.xml @@ -14,6 +14,7 @@ + diff --git a/gdb/features/i386/x32-linux.c b/gdb/features/i386/x32-linux.c index 1262688cbed..ae49549c7f0 100644 --- a/gdb/features/i386/x32-linux.c +++ b/gdb/features/i386/x32-linux.c @@ -151,5 +151,9 @@ initialize_tdesc_x32_linux (void) feature = tdesc_create_feature (result, "org.gnu.gdb.i386.linux"); tdesc_create_reg (feature, "orig_rax", 57, 1, NULL, 64, "int"); + feature = tdesc_create_feature (result, "org.gnu.gdb.i386.segments"); + tdesc_create_reg (feature, "fs_base", 58, 1, NULL, 64, "int"); + tdesc_create_reg (feature, "gs_base", 59, 1, NULL, 64, "int"); + tdesc_x32_linux = result; } diff --git a/gdb/features/i386/x32-linux.xml b/gdb/features/i386/x32-linux.xml index a7d0899e597..023a48d5633 100644 --- a/gdb/features/i386/x32-linux.xml +++ b/gdb/features/i386/x32-linux.xml @@ -14,4 +14,5 @@ + diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv index 32675995fa6..d03dcb98064 100644 --- a/gdb/gdbserver/configure.srv +++ b/gdb/gdbserver/configure.srv @@ -35,7 +35,7 @@ ipa_x32_linux_regobj="x32-linux-ipa.o x32-avx-linux-ipa.o x32-avx512-linux-ipa.o ipa_ppc_linux_regobj="powerpc-32l-ipa.o powerpc-altivec32l-ipa.o powerpc-cell32l-ipa.o powerpc-vsx32l-ipa.o powerpc-isa205-32l-ipa.o powerpc-isa205-altivec32l-ipa.o powerpc-isa205-vsx32l-ipa.o powerpc-e500l-ipa.o powerpc-64l-ipa.o powerpc-altivec64l-ipa.o powerpc-cell64l-ipa.o powerpc-vsx64l-ipa.o powerpc-isa205-64l-ipa.o powerpc-isa205-altivec64l-ipa.o powerpc-isa205-vsx64l-ipa.o" srv_i386_32bit_xmlfiles="i386/32bit-core.xml i386/32bit-sse.xml i386/32bit-avx.xml i386/32bit-avx512.xml i386/32bit-mpx.xml" -srv_i386_64bit_xmlfiles="i386/64bit-core.xml i386/64bit-sse.xml i386/64bit-avx.xml i386/64bit-avx512.xml i386/x32-core.xml i386/64bit-mpx.xml" +srv_i386_64bit_xmlfiles="i386/64bit-core.xml i386/64bit-segments.xml i386/64bit-sse.xml i386/64bit-avx.xml i386/64bit-avx512.xml i386/x32-core.xml i386/64bit-mpx.xml" srv_i386_xmlfiles="i386/i386.xml i386/i386-avx.xml i386/i386-avx512.xml i386/i386-mpx.xml i386/i386-avx-mpx.xml i386/i386-mmx.xml $srv_i386_32bit_xmlfiles" srv_amd64_xmlfiles="i386/amd64.xml i386/amd64-avx.xml i386/amd64-avx512.xml i386/x32.xml i386/x32-avx.xml i386/x32-avx512.xml i386/amd64-mpx.xml i386/amd64-avx-mpx.xml $srv_i386_64bit_xmlfiles" srv_i386_linux_xmlfiles="i386/i386-linux.xml i386/i386-avx-linux.xml i386/i386-avx512-linux.xml i386/i386-mmx-linux.xml i386/32bit-linux.xml i386/i386-mpx-linux.xml i386/i386-avx-mpx-linux.xml $srv_i386_32bit_xmlfiles" diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c index dd9538ad66e..8fdf3248af6 100644 --- a/gdb/gdbserver/linux-x86-low.c +++ b/gdb/gdbserver/linux-x86-low.c @@ -133,6 +133,11 @@ static const int x86_64_regmap[] = -1, -1, -1, -1, -1, -1, -1, -1, -1, ORIG_RAX * 8, +#ifdef HAVE_STRUCT_USER_REGS_STRUCT_FS_BASE + 21 * 8, 22 * 8, +#else + -1, -1, +#endif -1, -1, -1, -1, /* MPX registers BND0 ... BND3. */ -1, -1, /* MPX registers BNDCFGU, BNDSTATUS. */ -1, -1, -1, -1, -1, -1, -1, -1, /* xmm16 ... xmm31 (AVX512) */ @@ -306,6 +311,20 @@ x86_fill_gregset (struct regcache *regcache, void *buf) for (i = 0; i < X86_64_NUM_REGS; i++) if (x86_64_regmap[i] != -1) collect_register (regcache, i, ((char *) buf) + x86_64_regmap[i]); + +#ifndef HAVE_STRUCT_USER_REGS_STRUCT_FS_BASE + { + unsigned long base; + int lwpid = lwpid_of (current_thread); + + collect_register_by_name (regcache, "fs_base", &base); + ptrace (PTRACE_ARCH_PRCTL, lwpid, &base, ARCH_SET_FS); + + collect_register_by_name (regcache, "gs_base", &base); + ptrace (PTRACE_ARCH_PRCTL, lwpid, &base, ARCH_SET_GS); + } +#endif + return; } @@ -332,6 +351,19 @@ x86_store_gregset (struct regcache *regcache, const void *buf) for (i = 0; i < X86_64_NUM_REGS; i++) if (x86_64_regmap[i] != -1) supply_register (regcache, i, ((char *) buf) + x86_64_regmap[i]); + +#ifndef HAVE_STRUCT_USER_REGS_STRUCT_FS_BASE + { + unsigned long base; + int lwpid = lwpid_of (current_thread); + + if (ptrace (PTRACE_ARCH_PRCTL, lwpid, &base, ARCH_GET_FS) == 0) + supply_register_by_name (regcache, "fs_base", &base); + + if (ptrace (PTRACE_ARCH_PRCTL, lwpid, &base, ARCH_GET_GS) == 0) + supply_register_by_name (regcache, "gs_base", &base); + } +#endif return; } #endif diff --git a/gdb/regformats/i386/amd64-avx-linux.dat b/gdb/regformats/i386/amd64-avx-linux.dat index d8199da50f0..7780b3b6a21 100644 --- a/gdb/regformats/i386/amd64-avx-linux.dat +++ b/gdb/regformats/i386/amd64-avx-linux.dat @@ -61,6 +61,8 @@ expedite:rbp,rsp,rip 128:xmm15 32:mxcsr 64:orig_rax +64:fs_base +64:gs_base 128:ymm0h 128:ymm1h 128:ymm2h diff --git a/gdb/regformats/i386/amd64-avx-mpx-linux.dat b/gdb/regformats/i386/amd64-avx-mpx-linux.dat index 6d453244b8f..7c2f928070f 100644 --- a/gdb/regformats/i386/amd64-avx-mpx-linux.dat +++ b/gdb/regformats/i386/amd64-avx-mpx-linux.dat @@ -61,6 +61,8 @@ expedite:rbp,rsp,rip 128:xmm15 32:mxcsr 64:orig_rax +64:fs_base +64:gs_base 128:ymm0h 128:ymm1h 128:ymm2h diff --git a/gdb/regformats/i386/amd64-avx512-linux.dat b/gdb/regformats/i386/amd64-avx512-linux.dat index dfc41e28daa..f1658d33e6d 100644 --- a/gdb/regformats/i386/amd64-avx512-linux.dat +++ b/gdb/regformats/i386/amd64-avx512-linux.dat @@ -61,6 +61,8 @@ expedite:rbp,rsp,rip 128:xmm15 32:mxcsr 64:orig_rax +64:fs_base +64:gs_base 128:ymm0h 128:ymm1h 128:ymm2h diff --git a/gdb/regformats/i386/amd64-linux.dat b/gdb/regformats/i386/amd64-linux.dat index 6914cc41452..cd16a154428 100644 --- a/gdb/regformats/i386/amd64-linux.dat +++ b/gdb/regformats/i386/amd64-linux.dat @@ -61,3 +61,5 @@ expedite:rbp,rsp,rip 128:xmm15 32:mxcsr 64:orig_rax +64:fs_base +64:gs_base diff --git a/gdb/regformats/i386/amd64-mpx-linux.dat b/gdb/regformats/i386/amd64-mpx-linux.dat index 523ae01da12..10487f69870 100644 --- a/gdb/regformats/i386/amd64-mpx-linux.dat +++ b/gdb/regformats/i386/amd64-mpx-linux.dat @@ -61,6 +61,8 @@ expedite:rbp,rsp,rip 128:xmm15 32:mxcsr 64:orig_rax +64:fs_base +64:gs_base 128:bnd0raw 128:bnd1raw 128:bnd2raw diff --git a/gdb/regformats/i386/x32-avx-linux.dat b/gdb/regformats/i386/x32-avx-linux.dat index a2b8d0265d2..eb0e395366e 100644 --- a/gdb/regformats/i386/x32-avx-linux.dat +++ b/gdb/regformats/i386/x32-avx-linux.dat @@ -61,6 +61,8 @@ expedite:rbp,rsp,rip 128:xmm15 32:mxcsr 64:orig_rax +64:fs_base +64:gs_base 128:ymm0h 128:ymm1h 128:ymm2h diff --git a/gdb/regformats/i386/x32-avx512-linux.dat b/gdb/regformats/i386/x32-avx512-linux.dat index 0f5b2ce13be..0b7f73a94c9 100644 --- a/gdb/regformats/i386/x32-avx512-linux.dat +++ b/gdb/regformats/i386/x32-avx512-linux.dat @@ -61,6 +61,8 @@ expedite:rbp,rsp,rip 128:xmm15 32:mxcsr 64:orig_rax +64:fs_base +64:gs_base 128:ymm0h 128:ymm1h 128:ymm2h diff --git a/gdb/regformats/i386/x32-linux.dat b/gdb/regformats/i386/x32-linux.dat index d976a2534cd..eee378fd846 100644 --- a/gdb/regformats/i386/x32-linux.dat +++ b/gdb/regformats/i386/x32-linux.dat @@ -61,3 +61,5 @@ expedite:rbp,rsp,rip 128:xmm15 32:mxcsr 64:orig_rax +64:fs_base +64:gs_base diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 909766dfe5c..949e80b8603 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-01-27 Walfred Tedeschi + + * gdb.arch/amd64-gs_base.c: New file. + * gdb.arch/amd64-gs_base.exp: New file. + 2017-01-26 Luis Machado * lib/memory.exp: Remove spurious empty newlines. diff --git a/gdb/testsuite/gdb.arch/amd64-gs_base.c b/gdb/testsuite/gdb.arch/amd64-gs_base.c new file mode 100644 index 00000000000..252afd3215c --- /dev/null +++ b/gdb/testsuite/gdb.arch/amd64-gs_base.c @@ -0,0 +1,24 @@ +/* Test program for fs_base and gs_base. + + Copyright 2017 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +int +main (void) +{ + return 0; +} diff --git a/gdb/testsuite/gdb.arch/amd64-gs_base.exp b/gdb/testsuite/gdb.arch/amd64-gs_base.exp new file mode 100644 index 00000000000..014cc90fc16 --- /dev/null +++ b/gdb/testsuite/gdb.arch/amd64-gs_base.exp @@ -0,0 +1,49 @@ +# Copyright 2017 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +standard_testfile + +if { ![istarget "x86_64-*linux*"] } then { + verbose "Untested x86_64 fs_base and gs_base tests." + return +} + +if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ + [list debug nowarnings]] } { + return -1 +} + +if ![runto_main] { + untested "could not run to main" + return -1 +} + +gdb_test "print /x \$fs_base" "= $hex" "print fs_base" +gdb_test "print /x \$gs_base" "= $hex" "print gs_base" + +gdb_test "print \$fs_base = 2" "= 2" "set fs_base" +gdb_test "print \$gs_base = 3" "= 3" "set gs_base" + +# Test the presence of fs_base and gs_base on the system +# register group and values. +# +set ws "\[\t \]+" +set info_reg_out [multi_line "info register sys" \ + "fs_base${ws}0x2${ws}2"\ + "gs_base${ws}0x3${ws}3"\ + "orig_rax${ws}$hex${ws}\[-\]$decimal" ] + +gdb_test "info register sys" $info_reg_out\ + "info registers fs_base and gs_base with value"