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/model_specific.rs
+83Lines changed: 83 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -71,6 +71,12 @@ pub struct SCet;
71
71
#[derive(Debug)]
72
72
pubstructPat;
73
73
74
+
/// IA32_APIC_BASE: status and location of the local APIC
75
+
///
76
+
/// IA32_APIC_BASE must be supported on the CPU, otherwise, a general protection exception will occur. Support can be detected using the `cpuid` instruction.
77
+
#[derive(Debug)]
78
+
pubstructApicBase;
79
+
74
80
implEfer{
75
81
/// The underlying model specific register.
76
82
pubconstMSR:Msr = Msr(0xC000_0080);
@@ -132,6 +138,11 @@ impl Pat {
132
138
];
133
139
}
134
140
141
+
implApicBase{
142
+
/// The underlying model specific register.
143
+
pubconstMSR:Msr = Msr(0x1B);
144
+
}
145
+
135
146
bitflags!{
136
147
/// Flags of the Extended Feature Enable Register.
137
148
#[repr(transparent)]
@@ -218,14 +229,33 @@ impl PatMemoryType {
218
229
}
219
230
}
220
231
232
+
bitflags!{
233
+
/// Flags for the Advanced Programmable Interrupt Controler Base Register.
let reserved = old_flags & !(ApicBaseFlags::all().bits());
788
+
let new_flags = reserved | flags.bits();
789
+
790
+
unsafe{
791
+
Self::write_raw(frame, new_flags);
792
+
}
793
+
}
794
+
795
+
/// Writes the IA32_APIC_BASE MSR flags.
796
+
///
797
+
/// Does not preserve any bits, including reserved fields.
798
+
///
799
+
/// ## Safety
800
+
///
801
+
/// Unsafe because it's possible to set reserved bits to `1` and changing the APIC base address allows hijacking a page of physical memory space in ways that would violate Rust's memory rules.
0 commit comments