diff options
Diffstat (limited to 'gdb/arch')
-rw-r--r-- | gdb/arch/aarch64-gcs-linux.h | 44 | ||||
-rw-r--r-- | gdb/arch/aarch64.c | 8 | ||||
-rw-r--r-- | gdb/arch/aarch64.h | 10 | ||||
-rw-r--r-- | gdb/arch/amd64-linux-tdesc.c | 31 | ||||
-rw-r--r-- | gdb/arch/amd64-linux-tdesc.h | 7 | ||||
-rw-r--r-- | gdb/arch/amd64.c | 25 | ||||
-rw-r--r-- | gdb/arch/amd64.h | 10 | ||||
-rw-r--r-- | gdb/arch/arc.c | 1 | ||||
-rw-r--r-- | gdb/arch/i386-linux-tdesc.c | 29 | ||||
-rw-r--r-- | gdb/arch/i386-linux-tdesc.h | 5 | ||||
-rw-r--r-- | gdb/arch/i386.c | 19 | ||||
-rw-r--r-- | gdb/arch/i386.h | 7 | ||||
-rw-r--r-- | gdb/arch/loongarch.c | 1 | ||||
-rw-r--r-- | gdb/arch/riscv.c | 1 | ||||
-rw-r--r-- | gdb/arch/x86-linux-tdesc-features.c | 60 | ||||
-rw-r--r-- | gdb/arch/x86-linux-tdesc-features.h | 27 |
16 files changed, 190 insertions, 95 deletions
diff --git a/gdb/arch/aarch64-gcs-linux.h b/gdb/arch/aarch64-gcs-linux.h new file mode 100644 index 0000000..922c779 --- /dev/null +++ b/gdb/arch/aarch64-gcs-linux.h @@ -0,0 +1,44 @@ +/* Common Linux target-dependent definitions for AArch64 GCS + + Copyright (C) 2025 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 <http://www.gnu.org/licenses/>. */ + +#ifndef GDB_ARCH_AARCH64_GCS_LINUX_H +#define GDB_ARCH_AARCH64_GCS_LINUX_H + +#include <stdint.h> + +/* Feature check for Guarded Control Stack. */ +#ifndef HWCAP_GCS +#define HWCAP_GCS (1UL << 32) +#endif + +/* Make sure we only define these if the kernel header doesn't. */ +#ifndef GCS_MAGIC + +/* GCS state (NT_ARM_GCS). */ + +struct user_gcs +{ + uint64_t features_enabled; + uint64_t features_locked; + uint64_t gcspr_el0; +}; + +#endif /* GCS_MAGIC */ + +#endif /* GDB_ARCH_AARCH64_GCS_LINUX_H */ diff --git a/gdb/arch/aarch64.c b/gdb/arch/aarch64.c index 3e1ca05..dff2bc1 100644 --- a/gdb/arch/aarch64.c +++ b/gdb/arch/aarch64.c @@ -26,6 +26,8 @@ #include "../features/aarch64-sme.c" #include "../features/aarch64-sme2.c" #include "../features/aarch64-tls.c" +#include "../features/aarch64-gcs.c" +#include "../features/aarch64-gcs-linux.c" /* See arch/aarch64.h. */ @@ -65,6 +67,12 @@ aarch64_create_target_description (const aarch64_features &features) if (features.sme2) regnum = create_feature_aarch64_sme2 (tdesc.get (), regnum); + if (features.gcs) + regnum = create_feature_aarch64_gcs (tdesc.get (), regnum); + + if (features.gcs_linux) + regnum = create_feature_aarch64_gcs_linux (tdesc.get (), regnum); + return tdesc.release (); } diff --git a/gdb/arch/aarch64.h b/gdb/arch/aarch64.h index ee18b74..679d845 100644 --- a/gdb/arch/aarch64.h +++ b/gdb/arch/aarch64.h @@ -51,6 +51,12 @@ struct aarch64_features /* Whether SME2 is supported. */ bool sme2 = false; + + /* Whether Guarded Control Stack is supported. */ + bool gcs = false; + + /* Whether Guarded Control Stack Linux features are supported. */ + bool gcs_linux = false; }; inline bool operator==(const aarch64_features &lhs, const aarch64_features &rhs) @@ -60,7 +66,9 @@ inline bool operator==(const aarch64_features &lhs, const aarch64_features &rhs) && lhs.mte == rhs.mte && lhs.tls == rhs.tls && lhs.svq == rhs.svq - && lhs.sme2 == rhs.sme2; + && lhs.sme2 == rhs.sme2 + && lhs.gcs == rhs.gcs + && lhs.gcs_linux == rhs.gcs_linux; } namespace std diff --git a/gdb/arch/amd64-linux-tdesc.c b/gdb/arch/amd64-linux-tdesc.c index 91de758..8796662 100644 --- a/gdb/arch/amd64-linux-tdesc.c +++ b/gdb/arch/amd64-linux-tdesc.c @@ -26,34 +26,35 @@ /* See arch/amd64-linux-tdesc.h. */ const struct target_desc * -amd64_linux_read_description (uint64_t xcr0, bool is_x32) +amd64_linux_read_description (uint64_t xstate_bv, bool is_x32) { /* The type used for the amd64 and x32 target description caches. */ using tdesc_cache_type = std::unordered_map<uint64_t, const target_desc_up>; /* Caches for the previously seen amd64 and x32 target descriptions, - indexed by the xcr0 value that created the target description. These - need to be static within this function to ensure they are initialised - before first use. */ + indexed by the xstate_bv value that created the target + description. These need to be static within this function to ensure + they are initialised before first use. */ static tdesc_cache_type amd64_tdesc_cache, x32_tdesc_cache; tdesc_cache_type &tdesc_cache = is_x32 ? x32_tdesc_cache : amd64_tdesc_cache; - /* Only some bits are checked when creating a tdesc, but the XCR0 value - contains other feature bits that are not relevant for tdesc creation. - When indexing into the TDESC_CACHE we need to use a consistent xcr0 - value otherwise we might fail to find an existing tdesc which has the - same set of relevant bits set. */ - xcr0 &= is_x32 - ? x86_linux_x32_xcr0_feature_mask () - : x86_linux_amd64_xcr0_feature_mask (); + /* Only some bits are checked when creating a tdesc, but the + xstate_bv value contains other feature bits that are not + relevant for tdesc creation. + When indexing into the TDESC_CACHE we need to use a consistent + xstate_bv value otherwise we might fail to find an existing + tdesc which has the same set of relevant bits set. */ + xstate_bv &= is_x32 + ? x86_linux_x32_xstate_bv_feature_mask () + : x86_linux_amd64_xstate_bv_feature_mask (); - const auto it = tdesc_cache.find (xcr0); + const auto it = tdesc_cache.find (xstate_bv); if (it != tdesc_cache.end ()) return it->second.get (); /* Create the previously unseen target description. */ - target_desc_up tdesc (amd64_create_target_description (xcr0, is_x32, + target_desc_up tdesc (amd64_create_target_description (xstate_bv, is_x32, true, true)); x86_linux_post_init_tdesc (tdesc.get (), true); @@ -61,6 +62,6 @@ amd64_linux_read_description (uint64_t xcr0, bool is_x32) target_desc_up. This is safe as the cache (and the pointers contained within it) are not deleted until GDB exits. */ target_desc *ptr = tdesc.get (); - tdesc_cache.emplace (xcr0, std::move (tdesc)); + tdesc_cache.emplace (xstate_bv, std::move (tdesc)); return ptr; } diff --git a/gdb/arch/amd64-linux-tdesc.h b/gdb/arch/amd64-linux-tdesc.h index 8806a13..4c0c591 100644 --- a/gdb/arch/amd64-linux-tdesc.h +++ b/gdb/arch/amd64-linux-tdesc.h @@ -22,9 +22,10 @@ struct target_desc; -/* Return the AMD64 target descriptions corresponding to XCR0 and IS_X32. */ +/* Return the AMD64 target descriptions corresponding to XSTATE_BV and + IS_X32. */ -extern const target_desc *amd64_linux_read_description (uint64_t xcr0, - bool is_x32); +extern const target_desc *amd64_linux_read_description + (uint64_t xstate_bv, bool is_x32); #endif /* GDB_ARCH_AMD64_LINUX_TDESC_H */ diff --git a/gdb/arch/amd64.c b/gdb/arch/amd64.c index 252650b..9fbe802 100644 --- a/gdb/arch/amd64.c +++ b/gdb/arch/amd64.c @@ -28,16 +28,15 @@ #include "../features/i386/64bit-sse.c" #include "../features/i386/pkeys.c" +#include "../features/i386/64bit-ssp.c" +#include "../features/i386/32bit-ssp.c" #include "../features/i386/x32-core.c" -/* Create amd64 target descriptions according to XCR0. If IS_X32 is - true, create the x32 ones. If IS_LINUX is true, create target - descriptions for Linux. If SEGMENTS is true, then include - the "org.gnu.gdb.i386.segments" feature registers. */ +/* See arch/amd64.h. */ target_desc * -amd64_create_target_description (uint64_t xcr0, bool is_x32, bool is_linux, - bool segments) +amd64_create_target_description (uint64_t xstate_bv, bool is_x32, + bool is_linux, bool segments) { target_desc_up tdesc = allocate_target_description (); @@ -62,14 +61,22 @@ amd64_create_target_description (uint64_t xcr0, bool is_x32, bool is_linux, if (segments) regnum = create_feature_i386_64bit_segments (tdesc.get (), regnum); - if (xcr0 & X86_XSTATE_AVX) + if (xstate_bv & X86_XSTATE_AVX) regnum = create_feature_i386_64bit_avx (tdesc.get (), regnum); - if (xcr0 & X86_XSTATE_AVX512) + if (xstate_bv & X86_XSTATE_AVX512) regnum = create_feature_i386_64bit_avx512 (tdesc.get (), regnum); - if (xcr0 & X86_XSTATE_PKRU) + if (xstate_bv & X86_XSTATE_PKRU) regnum = create_feature_i386_pkeys (tdesc.get (), regnum); + if (xstate_bv & X86_XSTATE_CET_U) + { + if (!is_x32) + regnum = create_feature_i386_64bit_ssp (tdesc.get (), regnum); + else + regnum = create_feature_i386_32bit_ssp (tdesc.get (), regnum); + } + return tdesc.release (); } diff --git a/gdb/arch/amd64.h b/gdb/arch/amd64.h index 695660c..60c17eb 100644 --- a/gdb/arch/amd64.h +++ b/gdb/arch/amd64.h @@ -21,7 +21,13 @@ #include "gdbsupport/tdesc.h" #include <stdint.h> -target_desc *amd64_create_target_description (uint64_t xcr0, bool is_x32, - bool is_linux, bool segments); +/* Create amd64 target descriptions according to XSTATE_BV. If + IS_X32 is true, create the x32 ones. If IS_LINUX is true, create + target descriptions for Linux. If SEGMENTS is true, then include + the "org.gnu.gdb.i386.segments" feature registers. */ + +target_desc *amd64_create_target_description (uint64_t xstate_bv, + bool is_x32, bool is_linux, + bool segments); #endif /* GDB_ARCH_AMD64_H */ diff --git a/gdb/arch/arc.c b/gdb/arch/arc.c index efe7111..b7de1da 100644 --- a/gdb/arch/arc.c +++ b/gdb/arch/arc.c @@ -17,7 +17,6 @@ #include "arc.h" -#include <stdlib.h> #include <unordered_map> #include <string> diff --git a/gdb/arch/i386-linux-tdesc.c b/gdb/arch/i386-linux-tdesc.c index 5151317..bd736eb 100644 --- a/gdb/arch/i386-linux-tdesc.c +++ b/gdb/arch/i386-linux-tdesc.c @@ -25,32 +25,35 @@ /* See arch/i386-linux-tdesc.h. */ const target_desc * -i386_linux_read_description (uint64_t xcr0) +i386_linux_read_description (uint64_t xstate_bv) { - /* Cache of previously seen i386 target descriptions, indexed by the xcr0 - value that created the target description. This needs to be static - within this function to ensure it is initialised before first use. */ + /* Cache of previously seen i386 target descriptions, indexed by the + xstate_bv value that created the target description. This + needs to be static within this function to ensure it is initialised + before first use. */ static std::unordered_map<uint64_t, const target_desc_up> i386_tdesc_cache; - /* Only some bits are checked when creating a tdesc, but the XCR0 value - contains other feature bits that are not relevant for tdesc creation. - When indexing into the I386_TDESC_CACHE we need to use a consistent - xcr0 value otherwise we might fail to find an existing tdesc which has - the same set of relevant bits set. */ - xcr0 &= x86_linux_i386_xcr0_feature_mask (); + /* Only some bits are checked when creating a tdesc, but the + XSTATE_BV value contains other feature bits that are not relevant + for tdesc creation. When indexing into the I386_TDESC_CACHE + we need to use a consistent XSTATE_BV value otherwise we might fail + to find an existing tdesc which has the same set of relevant bits + set. */ + xstate_bv &= x86_linux_i386_xstate_bv_feature_mask (); - const auto it = i386_tdesc_cache.find (xcr0); + const auto it = i386_tdesc_cache.find (xstate_bv); if (it != i386_tdesc_cache.end ()) return it->second.get (); /* Create the previously unseen target description. */ - target_desc_up tdesc (i386_create_target_description (xcr0, true, false)); + target_desc_up tdesc + (i386_create_target_description (xstate_bv, true, false)); x86_linux_post_init_tdesc (tdesc.get (), false); /* Add to the cache, and return a pointer borrowed from the target_desc_up. This is safe as the cache (and the pointers contained within it) are not deleted until GDB exits. */ target_desc *ptr = tdesc.get (); - i386_tdesc_cache.emplace (xcr0, std::move (tdesc)); + i386_tdesc_cache.emplace (xstate_bv, std::move (tdesc)); return ptr; } diff --git a/gdb/arch/i386-linux-tdesc.h b/gdb/arch/i386-linux-tdesc.h index 2c3c174..1cf2931 100644 --- a/gdb/arch/i386-linux-tdesc.h +++ b/gdb/arch/i386-linux-tdesc.h @@ -22,8 +22,9 @@ struct target_desc; -/* Return the i386 target description corresponding to XCR0. */ +/* Return the i386 target description corresponding to XSTATE_BV. */ -extern const struct target_desc *i386_linux_read_description (uint64_t xcr0); +extern const struct target_desc *i386_linux_read_description + (uint64_t xstate_bv); #endif /* GDB_ARCH_I386_LINUX_TDESC_H */ diff --git a/gdb/arch/i386.c b/gdb/arch/i386.c index 835df53..4ec4f10 100644 --- a/gdb/arch/i386.c +++ b/gdb/arch/i386.c @@ -28,11 +28,13 @@ #include "../features/i386/32bit-avx512.c" #include "../features/i386/32bit-segments.c" #include "../features/i386/pkeys.c" +#include "../features/i386/32bit-ssp.c" -/* Create i386 target descriptions according to XCR0. */ +/* See arch/i386.h. */ target_desc * -i386_create_target_description (uint64_t xcr0, bool is_linux, bool segments) +i386_create_target_description (uint64_t xstate_bv, bool is_linux, + bool segments) { target_desc_up tdesc = allocate_target_description (); @@ -44,10 +46,10 @@ i386_create_target_description (uint64_t xcr0, bool is_linux, bool segments) long regnum = 0; - if (xcr0 & X86_XSTATE_X87) + if (xstate_bv & X86_XSTATE_X87) regnum = create_feature_i386_32bit_core (tdesc.get (), regnum); - if (xcr0 & X86_XSTATE_SSE) + if (xstate_bv & X86_XSTATE_SSE) regnum = create_feature_i386_32bit_sse (tdesc.get (), regnum); if (is_linux) @@ -56,14 +58,17 @@ i386_create_target_description (uint64_t xcr0, bool is_linux, bool segments) if (segments) regnum = create_feature_i386_32bit_segments (tdesc.get (), regnum); - if (xcr0 & X86_XSTATE_AVX) + if (xstate_bv & X86_XSTATE_AVX) regnum = create_feature_i386_32bit_avx (tdesc.get (), regnum); - if (xcr0 & X86_XSTATE_AVX512) + if (xstate_bv & X86_XSTATE_AVX512) regnum = create_feature_i386_32bit_avx512 (tdesc.get (), regnum); - if (xcr0 & X86_XSTATE_PKRU) + if (xstate_bv & X86_XSTATE_PKRU) regnum = create_feature_i386_pkeys (tdesc.get (), regnum); + if (xstate_bv & X86_XSTATE_CET_U) + regnum = create_feature_i386_32bit_ssp (tdesc.get (), regnum); + return tdesc.release (); } diff --git a/gdb/arch/i386.h b/gdb/arch/i386.h index 1fc4101..91a581f 100644 --- a/gdb/arch/i386.h +++ b/gdb/arch/i386.h @@ -21,7 +21,12 @@ #include "gdbsupport/tdesc.h" #include <stdint.h> -target_desc *i386_create_target_description (uint64_t xcr0, bool is_linux, +/* Create i386 target descriptions according to XSTATE_BV. If IS_LINUX is + true, create target descriptions for Linux. If SEGMENTS is true, then + include the "org.gnu.gdb.i386.segments" feature registers. */ + +target_desc *i386_create_target_description (uint64_t xstate_bv, + bool is_linux, bool segments); #endif /* GDB_ARCH_I386_H */ diff --git a/gdb/arch/loongarch.c b/gdb/arch/loongarch.c index 07c6d4d..25e698d 100644 --- a/gdb/arch/loongarch.c +++ b/gdb/arch/loongarch.c @@ -16,7 +16,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "loongarch.h" -#include <stdlib.h> #include <unordered_map> /* Target description features. */ diff --git a/gdb/arch/riscv.c b/gdb/arch/riscv.c index a6188ea..c698fa2 100644 --- a/gdb/arch/riscv.c +++ b/gdb/arch/riscv.c @@ -16,7 +16,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "riscv.h" -#include <stdlib.h> #include <unordered_map> #include "../features/riscv/32bit-cpu.c" diff --git a/gdb/arch/x86-linux-tdesc-features.c b/gdb/arch/x86-linux-tdesc-features.c index f65920c..bc34378 100644 --- a/gdb/arch/x86-linux-tdesc-features.c +++ b/gdb/arch/x86-linux-tdesc-features.c @@ -28,18 +28,21 @@ We want to cache target descriptions, and this is currently done in three separate caches, one each for i386, amd64, and x32. Additionally, - the caching we're discussing here is Linux only, and for Linux, the only - thing that has an impact on target description creation is the xcr0 - value. - - In order to ensure the cache functions correctly we need to filter out - only those xcr0 feature bits that are relevant, we can then cache target - descriptions based on the relevant feature bits. Two xcr0 values might - be different, but have the same relevant feature bits. In this case we - would expect the two xcr0 values to map to the same cache entry. */ + the caching we're discussing here is Linux only. Currently for Linux, + the only thing that has an impact on target description creation are + the supported features in xsave which are modelled by a xstate_bv + value, which has the same format than the state component bitmap. + + In order to ensure the cache functions correctly we need to filter only + those xstate_bv feature bits that are relevant, we can then cache + target descriptions based on the relevant feature bits. Two xstate_bv + values might be different, but have the same relevant feature bits. In + this case we would expect the two xstate_bv values to map to the same + cache entry. */ struct x86_xstate_feature { - /* The xstate feature mask. This is a mask against an xcr0 value. */ + /* The xstate feature mask. This is a mask against the state component + bitmap. */ uint64_t feature; /* Is this feature checked when creating an i386 target description. */ @@ -56,12 +59,13 @@ struct x86_xstate_feature { checked when building a target description for i386, amd64, or x32. If in the future, due to simplifications or refactoring, this table ever - ends up with 'true' for every xcr0 feature on every target type, then this - is an indication that this table should probably be removed, and that the - rest of the code in this file can be simplified. */ + ends up with 'true' for every xsave feature on every target type, then + this is an indication that this table should probably be removed, and + that the rest of the code in this file can be simplified. */ static constexpr x86_xstate_feature x86_linux_all_xstate_features[] = { /* Feature, i386, amd64, x32. */ + { X86_XSTATE_CET_U, false, true, true }, { X86_XSTATE_PKRU, true, true, true }, { X86_XSTATE_AVX512, true, true, true }, { X86_XSTATE_AVX, true, true, true }, @@ -73,7 +77,7 @@ static constexpr x86_xstate_feature x86_linux_all_xstate_features[] = { that are checked for when building an i386 target description. */ static constexpr uint64_t -x86_linux_i386_xcr0_feature_mask_1 () +x86_linux_i386_xstate_bv_feature_mask_1 () { uint64_t mask = 0; @@ -88,7 +92,7 @@ x86_linux_i386_xcr0_feature_mask_1 () that are checked for when building an amd64 target description. */ static constexpr uint64_t -x86_linux_amd64_xcr0_feature_mask_1 () +x86_linux_amd64_xstate_bv_feature_mask_1 () { uint64_t mask = 0; @@ -103,7 +107,7 @@ x86_linux_amd64_xcr0_feature_mask_1 () that are checked for when building an x32 target description. */ static constexpr uint64_t -x86_linux_x32_xcr0_feature_mask_1 () +x86_linux_x32_xstate_bv_feature_mask_1 () { uint64_t mask = 0; @@ -117,25 +121,25 @@ x86_linux_x32_xcr0_feature_mask_1 () /* See arch/x86-linux-tdesc-features.h. */ uint64_t -x86_linux_i386_xcr0_feature_mask () +x86_linux_i386_xstate_bv_feature_mask () { - return x86_linux_i386_xcr0_feature_mask_1 (); + return x86_linux_i386_xstate_bv_feature_mask_1 (); } /* See arch/x86-linux-tdesc-features.h. */ uint64_t -x86_linux_amd64_xcr0_feature_mask () +x86_linux_amd64_xstate_bv_feature_mask () { - return x86_linux_amd64_xcr0_feature_mask_1 (); + return x86_linux_amd64_xstate_bv_feature_mask_1 (); } /* See arch/x86-linux-tdesc-features.h. */ uint64_t -x86_linux_x32_xcr0_feature_mask () +x86_linux_x32_xstate_bv_feature_mask () { - return x86_linux_x32_xcr0_feature_mask_1 (); + return x86_linux_x32_xstate_bv_feature_mask_1 (); } #ifdef GDBSERVER @@ -143,7 +147,7 @@ x86_linux_x32_xcr0_feature_mask () /* See arch/x86-linux-tdesc-features.h. */ int -x86_linux_xcr0_to_tdesc_idx (uint64_t xcr0) +x86_linux_xstate_bv_to_tdesc_idx (uint64_t xstate_bv) { /* The following table shows which features are checked for when creating the target descriptions (see nat/x86-linux-tdesc.c), the feature order @@ -160,7 +164,7 @@ x86_linux_xcr0_to_tdesc_idx (uint64_t xcr0) for (int i = 0; i < ARRAY_SIZE (x86_linux_all_xstate_features); ++i) { - if ((xcr0 & x86_linux_all_xstate_features[i].feature) + if ((xstate_bv & x86_linux_all_xstate_features[i].feature) == x86_linux_all_xstate_features[i].feature) idx |= (1 << i); } @@ -250,17 +254,17 @@ x86_linux_i386_tdesc_count () /* See arch/x86-linux-tdesc-features.h. */ uint64_t -x86_linux_tdesc_idx_to_xcr0 (int idx) +x86_linux_tdesc_idx_to_xstate_bv (int idx) { - uint64_t xcr0 = 0; + uint64_t xstate_bv = 0; for (int i = 0; i < ARRAY_SIZE (x86_linux_all_xstate_features); ++i) { if ((idx & (1 << i)) != 0) - xcr0 |= x86_linux_all_xstate_features[i].feature; + xstate_bv |= x86_linux_all_xstate_features[i].feature; } - return xcr0; + return xstate_bv; } #endif /* IN_PROCESS_AGENT */ diff --git a/gdb/arch/x86-linux-tdesc-features.h b/gdb/arch/x86-linux-tdesc-features.h index 89fe7ce..bc72727 100644 --- a/gdb/arch/x86-linux-tdesc-features.h +++ b/gdb/arch/x86-linux-tdesc-features.h @@ -27,17 +27,20 @@ the set of features which are checked for when creating the target description for each of amd64, x32, and i386. */ -extern uint64_t x86_linux_amd64_xcr0_feature_mask (); -extern uint64_t x86_linux_x32_xcr0_feature_mask (); -extern uint64_t x86_linux_i386_xcr0_feature_mask (); +extern uint64_t x86_linux_amd64_xstate_bv_feature_mask (); +extern uint64_t x86_linux_x32_xstate_bv_feature_mask (); +extern uint64_t x86_linux_i386_xstate_bv_feature_mask (); #ifdef GDBSERVER -/* Convert an xcr0 value into an integer. The integer will be passed from - gdbserver to the in-process-agent where it will then be passed through - x86_linux_tdesc_idx_to_xcr0 to get back the original xcr0 value. */ +/* Convert an XSTATE_BV value into an integer. XSTATE_BV has the same + format than the state component bitmap and does include user and + supervisor state components. The integer will be passed from gdbserver + to the in-process-agent where it will then be passed through + x86_linux_tdesc_idx_to_xstate_bv to get back the original value. */ -extern int x86_linux_xcr0_to_tdesc_idx (uint64_t xcr0); + +extern int x86_linux_xstate_bv_to_tdesc_idx (uint64_t xstate_bv); #endif /* GDBSERVER */ @@ -51,11 +54,13 @@ extern int x86_linux_amd64_tdesc_count (); extern int x86_linux_x32_tdesc_count (); extern int x86_linux_i386_tdesc_count (); -/* Convert an index number (as returned from x86_linux_xcr0_to_tdesc_idx) - into an xcr0 value which can then be used to create a target - description. */ +/* Convert an index number (as returned from + x86_linux_xstate_bv_to_tdesc_idx) into an xstate_bv value which can + then be used to create a target description. + The return mask has the same format than the state component bitmap + and does include user and supervisor state components. */ -extern uint64_t x86_linux_tdesc_idx_to_xcr0 (int idx); +extern uint64_t x86_linux_tdesc_idx_to_xstate_bv (int idx); #endif /* IN_PROCESS_AGENT */ |