asmkit/x86/features/INVLPGB.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/// `INVLPGB`.
11///
12/// Supported operand variants:
13///
14/// ```text
15/// +---+----------+
16/// | # | Operands |
17/// +---+----------+
18/// | 1 | (none) |
19/// +---+----------+
20/// ```
21pub trait InvlpgbEmitter {
22 fn invlpgb(&mut self);
23}
24
25impl<'a> InvlpgbEmitter for Assembler<'a> {
26 fn invlpgb(&mut self) {
27 self.emit(INVLPGB, &NOREG, &NOREG, &NOREG, &NOREG);
28 }
29}
30
31/// `TLBSYNC`.
32///
33/// Supported operand variants:
34///
35/// ```text
36/// +---+----------+
37/// | # | Operands |
38/// +---+----------+
39/// | 1 | (none) |
40/// +---+----------+
41/// ```
42pub trait TlbsyncEmitter {
43 fn tlbsync(&mut self);
44}
45
46impl<'a> TlbsyncEmitter for Assembler<'a> {
47 fn tlbsync(&mut self) {
48 self.emit(TLBSYNC, &NOREG, &NOREG, &NOREG, &NOREG);
49 }
50}
51
52
53impl<'a> Assembler<'a> {
54 /// `INVLPGB`.
55 ///
56 /// Supported operand variants:
57 ///
58 /// ```text
59 /// +---+----------+
60 /// | # | Operands |
61 /// +---+----------+
62 /// | 1 | (none) |
63 /// +---+----------+
64 /// ```
65 #[inline]
66 pub fn invlpgb(&mut self)
67 where Assembler<'a>: InvlpgbEmitter {
68 <Self as InvlpgbEmitter>::invlpgb(self);
69 }
70 /// `TLBSYNC`.
71 ///
72 /// Supported operand variants:
73 ///
74 /// ```text
75 /// +---+----------+
76 /// | # | Operands |
77 /// +---+----------+
78 /// | 1 | (none) |
79 /// +---+----------+
80 /// ```
81 #[inline]
82 pub fn tlbsync(&mut self)
83 where Assembler<'a>: TlbsyncEmitter {
84 <Self as TlbsyncEmitter>::tlbsync(self);
85 }
86}