Skip to main content

asmkit/x86/features/
HRESET.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/// `HRESET` (HRESET). 
11/// Requests the processor to selectively reset selected components of hardware history maintained by the current logical processor. HRESET operation is controlled by the implicit EAX operand. The value of the explicit imm8 operand is ignored. This instruction can only be executed at privilege level 0.
12///
13///
14/// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/HRESET.html).
15///
16/// Supported operand variants:
17///
18/// ```text
19/// +---+----------+
20/// | # | Operands |
21/// +---+----------+
22/// | 1 | Imm      |
23/// +---+----------+
24/// ```
25pub trait HresetEmitter<A> {
26    fn hreset(&mut self, op0: A);
27}
28
29impl<'a> HresetEmitter<Imm> for Assembler<'a> {
30    fn hreset(&mut self, op0: Imm) {
31        self.emit(HRESETI, op0.as_operand(), &NOREG, &NOREG, &NOREG);
32    }
33}
34
35
36impl<'a> Assembler<'a> {
37    /// `HRESET` (HRESET). 
38    /// Requests the processor to selectively reset selected components of hardware history maintained by the current logical processor. HRESET operation is controlled by the implicit EAX operand. The value of the explicit imm8 operand is ignored. This instruction can only be executed at privilege level 0.
39    ///
40    ///
41    /// For more details, see the [Intel manual](https://www.felixcloutier.com/x86/HRESET.html).
42    ///
43    /// Supported operand variants:
44    ///
45    /// ```text
46    /// +---+----------+
47    /// | # | Operands |
48    /// +---+----------+
49    /// | 1 | Imm      |
50    /// +---+----------+
51    /// ```
52    #[inline]
53    pub fn hreset<A>(&mut self, op0: A)
54    where Assembler<'a>: HresetEmitter<A> {
55        <Self as HresetEmitter<A>>::hreset(self, op0);
56    }
57}