#![cfg(target_arch="x86_64")]
#![warn(missing_docs)]
#![feature(const_fn)]
#![feature(asm)]
#![feature(associated_consts)]
#![feature(abi_x86_interrupt)]
#![cfg_attr(test, allow(unused_features))]
#![no_std]
pub use address::{VirtualAddress, PhysicalAddress};
extern crate bit_field;
#[macro_use]
mod bitflags;
pub mod instructions;
pub mod registers;
pub mod structures;
mod address;
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
#[repr(u8)]
pub enum PrivilegeLevel {
Ring0 = 0,
Ring1 = 1,
Ring2 = 2,
Ring3 = 3,
}
impl PrivilegeLevel {
pub fn from_u16(value: u16) -> PrivilegeLevel {
match value {
0 => PrivilegeLevel::Ring0,
1 => PrivilegeLevel::Ring1,
2 => PrivilegeLevel::Ring2,
3 => PrivilegeLevel::Ring3,
i => panic!("{} is not a valid privilege level", i),
}
}
}