1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
/* Hardware Transactional Memory (HTM) intrinsics.
Copyright (C) 2013 Free Software Foundation, Inc.
Contributed by Peter Bergner <bergner@vnet.ibm.com>.
This file 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 file 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.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef __HTM__
# error "HTM instruction set not enabled"
#endif /* __HTM__ */
#ifndef _HTMINTRIN_H
#define _HTMINTRIN_H
#include <stdint.h>
typedef uint64_t texasr_t;
typedef uint32_t texasru_t;
typedef uint32_t texasrl_t;
typedef uintptr_t tfiar_t;
typedef uintptr_t tfhar_t;
#define _HTM_STATE(CR0) ((CR0 >> 1) & 0x3)
#define _HTM_NONTRANSACTIONAL 0x0
#define _HTM_SUSPENDED 0x1
#define _HTM_TRANSACTIONAL 0x2
/* The following macros use the IBM bit numbering for BITNUM
as used in the ISA documentation. */
#define _TEXASR_EXTRACT_BITS(TEXASR,BITNUM,SIZE) \
(((TEXASR) >> (63-(BITNUM))) & ((1<<(SIZE))-1))
#define _TEXASRU_EXTRACT_BITS(TEXASR,BITNUM,SIZE) \
(((TEXASR) >> (31-(BITNUM))) & ((1<<(SIZE))-1))
#define _TEXASR_FAILURE_CODE(TEXASR) \
_TEXASR_EXTRACT_BITS(TEXASR, 7, 8)
#define _TEXASRU_FAILURE_CODE(TEXASRU) \
_TEXASRU_EXTRACT_BITS(TEXASRU, 7, 8)
#define _TEXASR_FAILURE_PERSISTENT(TEXASR) \
_TEXASR_EXTRACT_BITS(TEXASR, 7, 1)
#define _TEXASRU_FAILURE_PERSISTENT(TEXASRU) \
_TEXASRU_EXTRACT_BITS(TEXASRU, 7, 1)
#define _TEXASR_DISALLOWED(TEXASR) \
_TEXASR_EXTRACT_BITS(TEXASR, 8, 1)
#define _TEXASRU_DISALLOWED(TEXASRU) \
_TEXASRU_EXTRACT_BITS(TEXASRU, 8, 1)
#define _TEXASR_NESTING_OVERFLOW(TEXASR) \
_TEXASR_EXTRACT_BITS(TEXASR, 9, 1)
#define _TEXASRU_NESTING_OVERFLOW(TEXASRU) \
_TEXASRU_EXTRACT_BITS(TEXASRU, 9, 1)
#define _TEXASR_FOOTPRINT_OVERFLOW(TEXASR) \
_TEXASR_EXTRACT_BITS(TEXASR, 10, 1)
#define _TEXASRU_FOOTPRINT_OVERFLOW(TEXASRU) \
_TEXASRU_EXTRACT_BITS(TEXASRU, 10, 1)
#define _TEXASR_SELF_INDUCED_CONFLICT(TEXASR) \
_TEXASR_EXTRACT_BITS(TEXASR, 11, 1)
#define _TEXASRU_SELF_INDUCED_CONFLICT(TEXASRU) \
_TEXASRU_EXTRACT_BITS(TEXASRU, 11, 1)
#define _TEXASR_NON_TRANSACTIONAL_CONFLICT(TEXASR) \
_TEXASR_EXTRACT_BITS(TEXASR, 12, 1)
#define _TEXASRU_NON_TRANSACTIONAL_CONFLICT(TEXASRU) \
_TEXASRU_EXTRACT_BITS(TEXASRU, 12, 1)
#define _TEXASR_TRANSACTION_CONFLICT(TEXASR) \
_TEXASR_EXTRACT_BITS(TEXASR, 13, 1)
#define _TEXASRU_TRANSACTION_CONFLICT(TEXASRU) \
_TEXASRU_EXTRACT_BITS(TEXASRU, 13, 1)
#define _TEXASR_TRANSLATION_INVALIDATION_CONFLICT(TEXASR) \
_TEXASR_EXTRACT_BITS(TEXASR, 14, 1)
#define _TEXASRU_TRANSLATION_INVALIDATION_CONFLICT(TEXASRU) \
_TEXASRU_EXTRACT_BITS(TEXASRU, 14, 1)
#define _TEXASR_IMPLEMENTAION_SPECIFIC(TEXASR) \
_TEXASR_EXTRACT_BITS(TEXASR, 15, 1)
#define _TEXASRU_IMPLEMENTAION_SPECIFIC(TEXASRU) \
_TEXASRU_EXTRACT_BITS(TEXASRU, 15, 1)
#define _TEXASR_INSTRUCTION_FETCH_CONFLICT(TEXASR) \
_TEXASR_EXTRACT_BITS(TEXASR, 16, 1)
#define _TEXASRU_INSTRUCTION_FETCH_CONFLICT(TEXASRU) \
_TEXASRU_EXTRACT_BITS(TEXASRU, 16, 1)
#define _TEXASR_ABORT(TEXASR) \
_TEXASR_EXTRACT_BITS(TEXASR, 31, 1)
#define _TEXASRU_ABORT(TEXASRU) \
_TEXASRU_EXTRACT_BITS(TEXASRU, 31, 1)
#define _TEXASR_SUSPENDED(TEXASR) \
_TEXASR_EXTRACT_BITS(TEXASR, 32, 1)
#define _TEXASR_PRIVILEGE(TEXASR) \
_TEXASR_EXTRACT_BITS(TEXASR, 35, 2)
#define _TEXASR_FAILURE_SUMMARY(TEXASR) \
_TEXASR_EXTRACT_BITS(TEXASR, 36, 1)
#define _TEXASR_TFIAR_EXACT(TEXASR) \
_TEXASR_EXTRACT_BITS(TEXASR, 37, 1)
#define _TEXASR_ROT(TEXASR) \
_TEXASR_EXTRACT_BITS(TEXASR, 38, 1)
#define _TEXASR_TRANSACTION_LEVEL(TEXASR) \
_TEXASR_EXTRACT_BITS(TEXASR, 63, 12)
#endif /* _HTMINTRIN_H */
|