diff options
author | 2016-07-04 14:08:17 +0200 | |
---|---|---|
committer | 2016-07-04 14:08:17 +0200 | |
commit | c12e050a69dd1a9b04f07ab78a166c6371d35a6f (patch) | |
tree | fea35bcf5b507efdd4c1c0f5dab146360c70478a /src/lib.rs | |
parent | 32257991aaa3700620f1d6c180cfec3e2d65a360 (diff) | |
parent | bd2950de1a48d72cbb718cc9a367142e0eb97b72 (diff) | |
download | rust-x86-c12e050a69dd1a9b04f07ab78a166c6371d35a6f.tar.gz rust-x86-c12e050a69dd1a9b04f07ab78a166c6371d35a6f.tar.zst rust-x86-c12e050a69dd1a9b04f07ab78a166c6371d35a6f.zip |
Merge pull request #16 from QuiltOS/master
Fix #15: Combine with https://github.com/Tobba/libcpu
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 70 |
1 files changed, 17 insertions, 53 deletions
@@ -1,13 +1,13 @@ +#![cfg(any(target_arch="x86", target_arch="x86_64"))] + #![feature(const_fn)] #![feature(asm)] +#![feature(associated_consts)] #![no_std] #![cfg_attr(test, allow(unused_features))] -#![crate_name = "x86"] -#![crate_type = "lib"] - #[macro_use] -mod bitflags; +extern crate bitflags; #[macro_use] extern crate raw_cpuid; @@ -16,57 +16,21 @@ extern crate raw_cpuid; #[macro_use] extern crate phf; +#[cfg(target_arch="x86")] +pub mod bits32; +#[cfg(target_arch="x86_64")] +pub mod bits64; +pub mod shared; + +pub mod current { + #[cfg(target_arch="x86")] + pub use bits32::*; + #[cfg(target_arch="x86_64")] + pub use bits64::*; +} + mod std { pub use core::fmt; pub use core::ops; pub use core::option; } - -macro_rules! bit { - ( $x:expr ) => { - 1 << $x - }; -} - -macro_rules! check_flag { - ($doc:meta, $fun:ident, $flag:ident) => ( - #[$doc] - pub fn $fun(&self) -> bool { - self.contains($flag) - } - ) -} - -macro_rules! is_bit_set { - ($field:expr, $bit:expr) => ( - $field & (1 << $bit) > 0 - ) -} - -macro_rules! check_bit_fn { - ($doc:meta, $fun:ident, $field:ident, $bit:expr) => ( - #[$doc] - pub fn $fun(&self) -> bool { - is_bit_set!(self.$field, $bit) - } - ) -} - -pub mod io; -pub mod controlregs; -pub mod msr; -pub mod time; -pub mod irq; -pub mod rflags; -pub mod paging; -pub mod segmentation; -pub mod task; -pub mod dtables; -pub mod syscall; -pub mod sgx; -#[cfg(feature = "performance-counter")] -pub mod perfcnt; -pub mod cpuid { - pub use raw_cpuid::*; -} -pub mod tlb; |