diff options
author | 2016-07-04 14:08:17 +0200 | |
---|---|---|
committer | 2016-07-04 14:08:17 +0200 | |
commit | c12e050a69dd1a9b04f07ab78a166c6371d35a6f (patch) | |
tree | fea35bcf5b507efdd4c1c0f5dab146360c70478a /src/shared/mod.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/shared/mod.rs')
-rw-r--r-- | src/shared/mod.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/shared/mod.rs b/src/shared/mod.rs new file mode 100644 index 0000000..42a7aa4 --- /dev/null +++ b/src/shared/mod.rs @@ -0,0 +1,24 @@ +pub mod control_regs; +pub mod descriptor; +pub mod dtables; +pub mod io; +pub mod irq; +pub mod msr; +pub mod paging; +pub mod flags; +pub mod segmentation; +pub mod task; + +#[derive(Copy, Clone, PartialEq, Eq)] +#[repr(u8)] +pub enum PrivilegeLevel { + Ring0 = 0, + Ring1 = 1, + Ring2 = 2, + Ring3 = 3, +} + +#[inline(always)] +pub unsafe fn halt() { + asm!("hlt" :::: "volatile", "intel"); +} |