asmkit/x86/features/XSAVEC.rs
1use crate::x86::assembler::*;
2use crate::x86::operands::*;
3use super::super::opcodes::*;
4use crate::core::emitter::*;
5use crate::core::operand::*;
6
7/// A dummy operand that represents no register. Here just for simplicity.
8const NOREG: Operand = Operand::new();
9
10/// `XSAVEC` (XSAVEC).
11/// Performs a full or partial save of processor state components to the XSAVE area located at the memory address specified by the destination operand. The implicit EDX:EAX register pair specifies a 64-bit instruction mask. The specific state components saved correspond to the bits set in the requested-feature bitmap (RFBM), which is the logical-AND of EDX:EAX and XCR0.
12///
13///
14/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/XSAVEC.html).
15///
16/// Supported operand variants:
17///
18/// ```text
19/// +---+----------+
20/// | # | Operands |
21/// +---+----------+
22/// | 1 | Mem |
23/// +---+----------+
24/// ```
25pub trait XsavecEmitter<A> {
26 fn xsavec(&mut self, op0: A);
27}
28
29impl<'a> XsavecEmitter<Mem> for Assembler<'a> {
30 fn xsavec(&mut self, op0: Mem) {
31 self.emit(XSAVEC32M, op0.as_operand(), &NOREG, &NOREG, &NOREG);
32 }
33}
34
35
36impl<'a> Assembler<'a> {
37 /// `XSAVEC` (XSAVEC).
38 /// Performs a full or partial save of processor state components to the XSAVE area located at the memory address specified by the destination operand. The implicit EDX:EAX register pair specifies a 64-bit instruction mask. The specific state components saved correspond to the bits set in the requested-feature bitmap (RFBM), which is the logical-AND of EDX:EAX and XCR0.
39 ///
40 ///
41 /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/XSAVEC.html).
42 ///
43 /// Supported operand variants:
44 ///
45 /// ```text
46 /// +---+----------+
47 /// | # | Operands |
48 /// +---+----------+
49 /// | 1 | Mem |
50 /// +---+----------+
51 /// ```
52 #[inline]
53 pub fn xsavec<A>(&mut self, op0: A)
54 where Assembler<'a>: XsavecEmitter<A> {
55 <Self as XsavecEmitter<A>>::xsavec(self, op0);
56 }
57}