You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/registers/control.rs
+9-1
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,8 @@ bitflags! {
24
24
///
25
25
/// This flags allows lazily saving x87/MMX/SSE instructions on hardware context switches.
26
26
constTASK_SWITCHED = 1 << 3;
27
+
/// Indicates support of 387DX math coprocessor instructions when set
28
+
constEXTENSION_TYPE = 1 << 4;
27
29
/// Enables the native error reporting mechanism for x87 FPU errors.
28
30
constNUMERIC_ERROR = 1 << 5;
29
31
/// Controls whether supervisor-level writes to read-only pages are inhibited.
@@ -114,14 +116,20 @@ bitflags! {
114
116
constPCID = 1 << 17;
115
117
/// Enables extendet processor state management instructions, including XGETBV and XSAVE.
116
118
constOSXSAVE = 1 << 18;
119
+
/// When set, the `LOADIWKEY` instruction is available; additionally, if system firmware has activated the AES key locker instructions, register EBX of CPUID leaf 0x19, bit 0 (AESKLE) is set and the AES key locker instructions are enabled. See the [Intel Key Locker Specification](https://software.intel.com/content/www/us/en/develop/download/intel-key-locker-specification.html) for information on this feature.
120
+
constKEY_LOCKER = 1 << 19;
117
121
/// Prevents the execution of instructions that reside in pages accessible by user-mode
118
122
/// software when the processor is in supervisor-mode.
/// Enables restrictions for supervisor-mode software when reading data from user-mode
121
125
/// pages.
122
126
constSUPERVISOR_MODE_ACCESS_PREVENTION = 1 << 21;
123
-
/// Enables 4-level paging to associate each linear address with a protection key.
127
+
/// Enables 4-level and 5-level paging to associate each linear address with a protection key in user mode.
124
128
constPROTECTION_KEY = 1 << 22;
129
+
/// When set, enables intel control-flow enforcement technology. See chapter 18 of the Intel software developer manuals, volume 1, for more information.
130
+
constCONTROL_FLOW_ENFORCEMENT = 1 << 23;
131
+
/// When set, allows 4-level and 5-level paging implementations to use the `IA32_PKRS` MSR to specify, for each protection key, whether supervisor-mode linear addresses with a particular protection key can be read or written.
Copy file name to clipboardExpand all lines: src/registers/xcontrol.rs
+18-1
Original file line number
Diff line number
Diff line change
@@ -16,8 +16,18 @@ bitflags! {
16
16
/// Enables 256-bit SSE
17
17
/// Must be set to enable AVX
18
18
constYMM = 1<<2;
19
+
/// When set, MPX instructions are enabled and the bound registers BND0-BND3 can be managed by XSAVE.
20
+
constBNDREG = 1 << 3;
21
+
/// When set, MPX instructions can be executed and XSAVE can manage the BNDCFGU and BNDSTATUS registers.
22
+
constBNDCSR = 1 << 4;
23
+
/// If set, AVX-512 instructions can be executed and XSAVE can manage the K0-K7 mask registers.
24
+
constOPMASK = 1 << 5;
25
+
/// If set, AVX-512 instructions can be executed and XSAVE can be used to manage the upper halves of the lower ZMM registers.
26
+
constZMM_HI256 = 1 << 6;
27
+
/// If set, AVX-512 instructions can be executed and XSAVE can manage the upper ZMM registers.
28
+
constHI16_ZMM = 1 << 7;
19
29
/// When set, PKRU state management is supported by
20
-
/// ZSAVE/XRSTOR
30
+
/// XSAVE/XRSTOR
21
31
constMPK = 1<<9;
22
32
/// When set the Lightweight Profiling extensions are enabled
23
33
constLWP = 1<<62;
@@ -68,6 +78,13 @@ mod x86_64 {
68
78
let old_value = Self::read_raw();
69
79
let reserved = old_value & !(XCr0Flags::all().bits());
70
80
let new_value = reserved | flags.bits();
81
+
assert!(flags.contains(XCr0Flags::X87),"The X87 flag must be set");
82
+
assert!((flags.contains(XCr0Flags::AVX) && flags.contains(XCr0Flags::OPMASK) && flags.contains(XCr0Flags::ZMM_HI256) && flags.contains(XCr0Flags::HI16_ZMM)) || !(flags.contains(XCr0Flags::AVX) && flags.contains(XCr0Flags::OPMASK) && flags.contains(XCr0Flags::ZMM_HI256) && flags.contains(XCr0Flags::HI16_ZMM)),"You must enable AVX to set or unset any of XCR0.opmask, XCR0.ZMM_Hi256, and XCR0.Hi16_ZMM");
83
+
if !flags.contains(XCr0Flags::AVX) && (flags.contains(XCr0Flags::OPMASK) || flags.contains(XCr0Flags::ZMM_HI256) || flags.contains(XCr0Flags::HI16_ZMM)){
84
+
panic!("You must have AVX enabled to set XCR0.opmask, XCR0.ZMM_Hi256, or XCR0.Hi16_ZMM");
85
+
}
86
+
assert!((flags.contains(XCr0Flags::BNDREG) && flags.contains(XCr0Flags::BNDCSR)) || !(flags.contains(XCr0Flags::BNDREG) && flags.contains(XCr0Flags::BNDCSR)),"BNDREG and BNDCSR must be set and unset together");
87
+
assert!((flags.contains(XCr0Flags::OPMASK) && flags.contains(XCr0Flags::ZMM_HI256) && flags.contains(XCr0Flags::HI16_ZMM)) || !(flags.contains(XCr0Flags::OPMASK) && flags.contains(XCr0Flags::ZMM_HI256) && flags.contains(XCr0Flags::HI16_ZMM)),"You must set or unset all of XCR0.opmask, XCR0.ZMM_Hi256, and XCR0.Hi16_ZMM");
0 commit comments