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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
use crate::x86::assembler::*;
use crate::x86::operands::*;
use super::super::opcodes::*;
use crate::core::emitter::*;
use crate::core::operand::*;
/// A dummy operand that represents no register. Here just for simplicity.
const NOREG: Operand = Operand::new();
/// `CLUI` (CLUI).
/// CLUI clears the user interrupt flag (UIF). Its effect takes place immediately: a user interrupt cannot be delivered on the instruction boundary following CLUI.
///
///
/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/CLUI.html).
///
/// Supported operand variants:
///
/// ```text
/// +---+----------+
/// | # | Operands |
/// +---+----------+
/// | 1 | (none) |
/// +---+----------+
/// ```
pub trait CluiEmitter {
fn clui(&mut self);
}
impl<'a> CluiEmitter for Assembler<'a> {
fn clui(&mut self) {
self.emit(CLUI, &NOREG, &NOREG, &NOREG, &NOREG);
}
}
/// `SENDUIPI` (SENDUIPI).
/// The SENDUIPI instruction sends the user interprocessor interrupt (IPI) indicated by its register operand. (The operand always has 64 bits; operand-size overrides such as the prefix 66 are ignored.)
///
///
/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/SENDUIPI.html).
///
/// Supported operand variants:
///
/// ```text
/// +---+----------+
/// | # | Operands |
/// +---+----------+
/// | 1 | Gpq |
/// +---+----------+
/// ```
pub trait SenduipiEmitter<A> {
fn senduipi(&mut self, op0: A);
}
impl<'a> SenduipiEmitter<Gpq> for Assembler<'a> {
fn senduipi(&mut self, op0: Gpq) {
self.emit(SENDUIPIR, op0.as_operand(), &NOREG, &NOREG, &NOREG);
}
}
/// `STUI` (STUI).
/// STUI sets the user interrupt flag (UIF). Its effect takes place immediately; a user interrupt may be delivered on the instruction boundary following STUI. (This is in contrast with STI, whose effect is delayed by one instruction).
///
///
/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/STUI.html).
///
/// Supported operand variants:
///
/// ```text
/// +---+----------+
/// | # | Operands |
/// +---+----------+
/// | 1 | (none) |
/// +---+----------+
/// ```
pub trait StuiEmitter {
fn stui(&mut self);
}
impl<'a> StuiEmitter for Assembler<'a> {
fn stui(&mut self) {
self.emit(STUI, &NOREG, &NOREG, &NOREG, &NOREG);
}
}
/// `TESTUI`.
///
/// Supported operand variants:
///
/// ```text
/// +---+----------+
/// | # | Operands |
/// +---+----------+
/// | 1 | (none) |
/// +---+----------+
/// ```
pub trait TestuiEmitter {
fn testui(&mut self);
}
impl<'a> TestuiEmitter for Assembler<'a> {
fn testui(&mut self) {
self.emit(TESTUI, &NOREG, &NOREG, &NOREG, &NOREG);
}
}
/// `UIRET` (UIRET).
/// UIRET returns from the handling of a user interrupt. It can be executed regardless of CPL.
///
///
/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/UIRET.html).
///
/// Supported operand variants:
///
/// ```text
/// +---+----------+
/// | # | Operands |
/// +---+----------+
/// | 1 | (none) |
/// +---+----------+
/// ```
pub trait UiretEmitter {
fn uiret(&mut self);
}
impl<'a> UiretEmitter for Assembler<'a> {
fn uiret(&mut self) {
self.emit(UIRET, &NOREG, &NOREG, &NOREG, &NOREG);
}
}
impl<'a> Assembler<'a> {
/// `CLUI` (CLUI).
/// CLUI clears the user interrupt flag (UIF). Its effect takes place immediately: a user interrupt cannot be delivered on the instruction boundary following CLUI.
///
///
/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/CLUI.html).
///
/// Supported operand variants:
///
/// ```text
/// +---+----------+
/// | # | Operands |
/// +---+----------+
/// | 1 | (none) |
/// +---+----------+
/// ```
#[inline]
pub fn clui(&mut self)
where Assembler<'a>: CluiEmitter {
<Self as CluiEmitter>::clui(self);
}
/// `SENDUIPI` (SENDUIPI).
/// The SENDUIPI instruction sends the user interprocessor interrupt (IPI) indicated by its register operand. (The operand always has 64 bits; operand-size overrides such as the prefix 66 are ignored.)
///
///
/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/SENDUIPI.html).
///
/// Supported operand variants:
///
/// ```text
/// +---+----------+
/// | # | Operands |
/// +---+----------+
/// | 1 | Gpq |
/// +---+----------+
/// ```
#[inline]
pub fn senduipi<A>(&mut self, op0: A)
where Assembler<'a>: SenduipiEmitter<A> {
<Self as SenduipiEmitter<A>>::senduipi(self, op0);
}
/// `STUI` (STUI).
/// STUI sets the user interrupt flag (UIF). Its effect takes place immediately; a user interrupt may be delivered on the instruction boundary following STUI. (This is in contrast with STI, whose effect is delayed by one instruction).
///
///
/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/STUI.html).
///
/// Supported operand variants:
///
/// ```text
/// +---+----------+
/// | # | Operands |
/// +---+----------+
/// | 1 | (none) |
/// +---+----------+
/// ```
#[inline]
pub fn stui(&mut self)
where Assembler<'a>: StuiEmitter {
<Self as StuiEmitter>::stui(self);
}
/// `TESTUI`.
///
/// Supported operand variants:
///
/// ```text
/// +---+----------+
/// | # | Operands |
/// +---+----------+
/// | 1 | (none) |
/// +---+----------+
/// ```
#[inline]
pub fn testui(&mut self)
where Assembler<'a>: TestuiEmitter {
<Self as TestuiEmitter>::testui(self);
}
/// `UIRET` (UIRET).
/// UIRET returns from the handling of a user interrupt. It can be executed regardless of CPL.
///
///
/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/UIRET.html).
///
/// Supported operand variants:
///
/// ```text
/// +---+----------+
/// | # | Operands |
/// +---+----------+
/// | 1 | (none) |
/// +---+----------+
/// ```
#[inline]
pub fn uiret(&mut self)
where Assembler<'a>: UiretEmitter {
<Self as UiretEmitter>::uiret(self);
}
}