aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Gerd Zellweger <mail@gerdzellweger.com> 2018-04-20 20:08:43 -0700
committerGravatar Gerd Zellweger <mail@gerdzellweger.com> 2018-04-20 20:08:43 -0700
commitee389098aaff520aa36096734ac8d974d58e7181 (patch)
tree5acc891d35a1b6691c87e40b0db685d053ec8269
parent1cee98a89ce51331dc21027b6c20615dd00947c2 (diff)
downloadrust-x86-ee389098aaff520aa36096734ac8d974d58e7181.tar.gz
rust-x86-ee389098aaff520aa36096734ac8d974d58e7181.tar.zst
rust-x86-ee389098aaff520aa36096734ac8d974d58e7181.zip
Namespace changes for new bitflags format.
Signed-off-by: Gerd Zellweger <mail@gerdzellweger.com>
-rw-r--r--src/irq.rs34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/irq.rs b/src/irq.rs
index 68d675c..e28b9f8 100644
--- a/src/irq.rs
+++ b/src/irq.rs
@@ -188,43 +188,43 @@ bitflags!{
pub struct PageFaultError: u32 {
/// 0: The fault was caused by a non-present page.
/// 1: The fault was caused by a page-level protection violation
- const PFAULT_ERROR_P = bit!(0);
+ const P = bit!(0);
/// 0: The access causing the fault was a read.
/// 1: The access causing the fault was a write.
- const PFAULT_ERROR_WR = bit!(1);
+ const WR = bit!(1);
/// 0: The access causing the fault originated when the processor
/// was executing in supervisor mode.
/// 1: The access causing the fault originated when the processor
/// was executing in user mode.
- const PFAULT_ERROR_US = bit!(2);
+ const US = bit!(2);
/// 0: The fault was not caused by reserved bit violation.
/// 1: The fault was caused by reserved bits set to 1 in a page directory.
- const PFAULT_ERROR_RSVD = bit!(3);
+ const RSVD = bit!(3);
/// 0: The fault was not caused by an instruction fetch.
/// 1: The fault was caused by an instruction fetch.
- const PFAULT_ERROR_ID = bit!(4);
+ const ID = bit!(4);
/// 0: The fault was not by protection keys.
/// 1: There was a protection key violation.
- const PFAULT_ERROR_PK = bit!(5);
+ const PK = bit!(5);
}
}
impl fmt::Display for PageFaultError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- let p = match self.contains(PageFaultError::PFAULT_ERROR_P) {
+ let p = match self.contains(PageFaultError::P) {
false => "The fault was caused by a non-present page.",
true => "The fault was caused by a page-level protection violation.",
};
- let wr = match self.contains(PageFaultError::PFAULT_ERROR_WR) {
+ let wr = match self.contains(PageFaultError::WR) {
false => "The access causing the fault was a read.",
true => "The access causing the fault was a write.",
};
- let us = match self.contains(PageFaultError::PFAULT_ERROR_US) {
+ let us = match self.contains(PageFaultError::US) {
false => {
"The access causing the fault originated when the processor was executing in \
supervisor mode."
@@ -234,11 +234,11 @@ impl fmt::Display for PageFaultError {
mode."
}
};
- let rsvd = match self.contains(PageFaultError::PFAULT_ERROR_RSVD) {
+ let rsvd = match self.contains(PageFaultError::RSVD) {
false => "The fault was not caused by reserved bit violation.",
true => "The fault was caused by reserved bits set to 1 in a page directory.",
};
- let id = match self.contains(PageFaultError::PFAULT_ERROR_ID) {
+ let id = match self.contains(PageFaultError::ID) {
false => "The fault was not caused by an instruction fetch.",
true => "The fault was caused by an instruction fetch.",
};
@@ -249,12 +249,12 @@ impl fmt::Display for PageFaultError {
#[test]
fn bit_macro() {
- assert!(PageFaultError::PFAULT_ERROR_PK.bits() == 0b100000);
- assert!(PageFaultError::PFAULT_ERROR_ID.bits() == 0b10000);
- assert!(PageFaultError::PFAULT_ERROR_RSVD.bits() == 0b1000);
- assert!(PageFaultError::PFAULT_ERROR_US.bits() == 0b100);
- assert!(PageFaultError::PFAULT_ERROR_WR.bits() == 0b10);
- assert!(PageFaultError::PFAULT_ERROR_P.bits() == 0b1);
+ assert!(PageFaultError::PK.bits() == 0b100000);
+ assert!(PageFaultError::ID.bits() == 0b10000);
+ assert!(PageFaultError::RSVD.bits() == 0b1000);
+ assert!(PageFaultError::US.bits() == 0b100);
+ assert!(PageFaultError::WR.bits() == 0b10);
+ assert!(PageFaultError::P.bits() == 0b1);
}
/// Enable Interrupts.