diff options
Diffstat (limited to 'src/bits64/rflags.rs')
-rw-r--r-- | src/bits64/rflags.rs | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/bits64/rflags.rs b/src/bits64/rflags.rs index 937d3d3..6301420 100644 --- a/src/bits64/rflags.rs +++ b/src/bits64/rflags.rs @@ -4,65 +4,65 @@ //! The upper 32 bits of RFLAGS register is reserved. //! The lower 32 bits of RFLAGS is the same as EFLAGS. -use ::PrivilegeLevel; +use ::Ring; /// The RFLAGS register. /// This is duplicated code from bits32 eflags.rs. bitflags! { - pub flags RFlags: u64 { + pub struct RFlags: u64 { /// ID Flag (ID) - const FLAGS_ID = 1 << 21, + const FLAGS_ID = 1 << 21; /// Virtual Interrupt Pending (VIP) - const FLAGS_VIP = 1 << 20, + const FLAGS_VIP = 1 << 20; /// Virtual Interrupt Flag (VIF) - const FLAGS_VIF = 1 << 19, + const FLAGS_VIF = 1 << 19; /// Alignment Check (AC) - const FLAGS_AC = 1 << 18, + const FLAGS_AC = 1 << 18; /// Virtual-8086 Mode (VM) - const FLAGS_VM = 1 << 17, + const FLAGS_VM = 1 << 17; /// Resume Flag (RF) - const FLAGS_RF = 1 << 16, + const FLAGS_RF = 1 << 16; /// Nested Task (NT) - const FLAGS_NT = 1 << 14, + const FLAGS_NT = 1 << 14; /// I/O Privilege Level (IOPL) 0 - const FLAGS_IOPL0 = 0b00 << 12, + const FLAGS_IOPL0 = 0b00 << 12; /// I/O Privilege Level (IOPL) 1 - const FLAGS_IOPL1 = 0b01 << 12, + const FLAGS_IOPL1 = 0b01 << 12; /// I/O Privilege Level (IOPL) 2 - const FLAGS_IOPL2 = 0b10 << 12, + const FLAGS_IOPL2 = 0b10 << 12; /// I/O Privilege Level (IOPL) 3 - const FLAGS_IOPL3 = 0b11 << 12, + const FLAGS_IOPL3 = 0b11 << 12; /// Overflow Flag (OF) - const FLAGS_OF = 1 << 11, + const FLAGS_OF = 1 << 11; /// Direction Flag (DF) - const FLAGS_DF = 1 << 10, + const FLAGS_DF = 1 << 10; /// Interrupt Enable Flag (IF) - const FLAGS_IF = 1 << 9, + const FLAGS_IF = 1 << 9; /// Trap Flag (TF) - const FLAGS_TF = 1 << 8, + const FLAGS_TF = 1 << 8; /// Sign Flag (SF) - const FLAGS_SF = 1 << 7, + const FLAGS_SF = 1 << 7; /// Zero Flag (ZF) - const FLAGS_ZF = 1 << 6, + const FLAGS_ZF = 1 << 6; /// Auxiliary Carry Flag (AF) - const FLAGS_AF = 1 << 4, + const FLAGS_AF = 1 << 4; /// Parity Flag (PF) - const FLAGS_PF = 1 << 2, + const FLAGS_PF = 1 << 2; /// Bit 1 is always 1. - const FLAGS_A1 = 1 << 1, + const FLAGS_A1 = 1 << 1; /// Carry Flag (CF) - const FLAGS_CF = 1 << 0, + const FLAGS_CF = 1 << 0; } } impl RFlags { /// Creates a new Flags entry. Ensures bit 1 is set. pub const fn new() -> RFlags { - FLAGS_A1 + RFlags::FLAGS_A1 } /// Creates a new Flags with the given I/O privilege level. - pub const fn from_priv(iopl: PrivilegeLevel) -> RFlags { + pub const fn from_priv(iopl: Ring) -> RFlags { RFlags { bits: (iopl as u64) << 12 } } } |