Move duplicated code into new files
[deliverable/binutils-gdb.git] / gdb / common / i386-xstate.h
CommitLineData
c131fcee
L
1/* Common code for i386 XSAVE extended state.
2
ecd75fc8 3 Copyright (C) 2010-2014 Free Software Foundation, Inc.
c131fcee
L
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20#ifndef I386_XSTATE_H
21#define I386_XSTATE_H 1
22
23/* The extended state feature bits. */
24#define I386_XSTATE_X87 (1ULL << 0)
25#define I386_XSTATE_SSE (1ULL << 1)
26#define I386_XSTATE_AVX (1ULL << 2)
1dbcd68c
WT
27#define I386_XSTATE_BNDREGS (1ULL << 3)
28#define I386_XSTATE_BNDCFG (1ULL << 4)
244ec0da 29#define I386_XSTATE_MPX (I386_XSTATE_BNDREGS | I386_XSTATE_BNDCFG)
c131fcee 30
01f9f808
MS
31/* AVX 512 adds three feature bits. All three must be enabled. */
32#define I386_XSTATE_K (1ULL << 5)
33#define I386_XSTATE_ZMM_H (1ULL << 6)
34#define I386_XSTATE_ZMM (1ULL << 7)
35#define I386_XSTATE_AVX512 (I386_XSTATE_K | I386_XSTATE_ZMM_H \
36 | I386_XSTATE_ZMM)
37
c131fcee 38/* Supported mask and size of the extended state. */
3a13a53b 39#define I386_XSTATE_X87_MASK I386_XSTATE_X87
c131fcee
L
40#define I386_XSTATE_SSE_MASK (I386_XSTATE_X87 | I386_XSTATE_SSE)
41#define I386_XSTATE_AVX_MASK (I386_XSTATE_SSE_MASK | I386_XSTATE_AVX)
244ec0da 42#define I386_XSTATE_MPX_MASK (I386_XSTATE_AVX_MASK | I386_XSTATE_MPX)
01f9f808
MS
43#define I386_XSTATE_AVX512_MASK (I386_XSTATE_AVX_MASK | I386_XSTATE_AVX512)
44#define I386_XSTATE_MPX_AVX512_MASK (I386_XSTATE_MPX_MASK | I386_XSTATE_AVX512)
1dbcd68c 45
01f9f808 46#define I386_XSTATE_ALL_MASK (I386_XSTATE_MPX_AVX512_MASK)
c131fcee
L
47
48#define I386_XSTATE_SSE_SIZE 576
49#define I386_XSTATE_AVX_SIZE 832
1dbcd68c
WT
50#define I386_XSTATE_BNDREGS_SIZE 1024
51#define I386_XSTATE_BNDCFG_SIZE 1088
01f9f808
MS
52#define I386_XSTATE_AVX512_SIZE 2688
53#define I386_XSTATE_MAX_SIZE 2688
1dbcd68c 54
c131fcee 55
244ec0da
WT
56/* In case one of the MPX XCR0 bits is set we consider we have MPX. */
57#define HAS_MPX(XCR0) (((XCR0) & I386_XSTATE_MPX) != 0)
58#define HAS_AVX(XCR0) (((XCR0) & I386_XSTATE_AVX) != 0)
01f9f808 59#define HAS_AVX512(XCR0) (((XCR0) & I386_XSTATE_AVX512) != 0)
244ec0da 60
c131fcee 61/* Get I386 XSAVE extended state size. */
1dbcd68c 62#define I386_XSTATE_SIZE(XCR0) \
01f9f808
MS
63 (HAS_AVX512 (XCR0) ? I386_XSTATE_AVX512_SIZE : \
64 (HAS_MPX (XCR0) ? I386_XSTATE_BNDCFG_SIZE : \
65 (HAS_AVX (XCR0) ? I386_XSTATE_AVX_SIZE : I386_XSTATE_SSE_SIZE)))
c131fcee
L
66
67#endif /* I386_XSTATE_H */
This page took 0.300308 seconds and 4 git commands to generate.