1 1.1 christos /* Target description related code for GNU/Linux x86 (i386 and x86-64). 2 1.1 christos 3 1.1 christos Copyright (C) 2024 Free Software Foundation, Inc. 4 1.1 christos 5 1.1 christos This file is part of GDB. 6 1.1 christos 7 1.1 christos This program is free software; you can redistribute it and/or modify 8 1.1 christos it under the terms of the GNU General Public License as published by 9 1.1 christos the Free Software Foundation; either version 3 of the License, or 10 1.1 christos (at your option) any later version. 11 1.1 christos 12 1.1 christos This program is distributed in the hope that it will be useful, 13 1.1 christos but WITHOUT ANY WARRANTY; without even the implied warranty of 14 1.1 christos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 1.1 christos GNU General Public License for more details. 16 1.1 christos 17 1.1 christos You should have received a copy of the GNU General Public License 18 1.1 christos along with this program. If not, see <http://www.gnu.org/licenses/>. */ 19 1.1 christos 20 1.1 christos #ifndef GDB_ARCH_X86_LINUX_TDESC_FEATURES_H 21 1.1 christos #define GDB_ARCH_X86_LINUX_TDESC_FEATURES_H 22 1.1 christos 23 1.1 christos #include "gdbsupport/x86-xstate.h" 24 1.1 christos #include "gdbsupport/gdb_assert.h" 25 1.1 christos 26 1.1 christos /* Return a mask of X86_STATE_* feature flags. The returned mask indicates 27 1.1 christos the set of features which are checked for when creating the target 28 1.1 christos description for each of amd64, x32, and i386. */ 29 1.1 christos 30 1.1 christos extern uint64_t x86_linux_amd64_xcr0_feature_mask (); 31 1.1 christos extern uint64_t x86_linux_x32_xcr0_feature_mask (); 32 1.1 christos extern uint64_t x86_linux_i386_xcr0_feature_mask (); 33 1.1 christos 34 1.1 christos #ifdef GDBSERVER 35 1.1 christos 36 1.1 christos /* Convert an xcr0 value into an integer. The integer will be passed from 37 1.1 christos gdbserver to the in-process-agent where it will then be passed through 38 1.1 christos x86_linux_tdesc_idx_to_xcr0 to get back the original xcr0 value. */ 39 1.1 christos 40 1.1 christos extern int x86_linux_xcr0_to_tdesc_idx (uint64_t xcr0); 41 1.1 christos 42 1.1 christos #endif /* GDBSERVER */ 43 1.1 christos 44 1.1 christos #ifdef IN_PROCESS_AGENT 45 1.1 christos 46 1.1 christos /* Return the maximum possible number of target descriptions for each of 47 1.1 christos amd64, x32, and i386. These are used by the in-process-agent to 48 1.1 christos generate every possible target description. */ 49 1.1 christos 50 1.1 christos extern int x86_linux_amd64_tdesc_count (); 51 1.1 christos extern int x86_linux_x32_tdesc_count (); 52 1.1 christos extern int x86_linux_i386_tdesc_count (); 53 1.1 christos 54 1.1 christos /* Convert an index number (as returned from x86_linux_xcr0_to_tdesc_idx) 55 1.1 christos into an xcr0 value which can then be used to create a target 56 1.1 christos description. */ 57 1.1 christos 58 1.1 christos extern uint64_t x86_linux_tdesc_idx_to_xcr0 (int idx); 59 1.1 christos 60 1.1 christos #endif /* IN_PROCESS_AGENT */ 61 1.1 christos 62 1.1 christos #endif /* GDB_ARCH_X86_LINUX_TDESC_FEATURES_H */ 63