Permalink
Please sign in to comment.
Showing
with
32 additions
and 27 deletions.
- +2 −2 Makefile
- +19 −0 crates/io/io.rs
- +2 −20 crates/io/lib.rs
- +1 −1 crates/io/mmio.rs
- +1 −1 crates/io/pio.rs
- +1 −1 crates/ion
- +1 −1 crates/system/syscall/redox.rs
- +1 −1 crates/system/syscall/unix.rs
- +2 −0 rustc-i386.sh
- +2 −0 rustc-x86_64.sh
4
Makefile
19
crates/io/io.rs
@@ -0,0 +1,19 @@ | ||
+use core::cmp::PartialEq; | ||
+use core::ops::{BitAnd, BitOr, Not}; | ||
+ | ||
+pub trait Io<T> { | ||
+ fn read(&self) -> T; | ||
+ fn write(&mut self, value: T); | ||
+ | ||
+ fn readf(&self, flags: T) -> bool where T: BitAnd<Output = T> + PartialEq<T> + Copy { | ||
+ (self.read() & flags) as T == flags | ||
+ } | ||
+ | ||
+ fn writef(&mut self, flags: T, value: bool) where T: BitAnd<Output = T> + BitOr<Output = T> + Not<Output = T> { | ||
+ let tmp: T = match value { | ||
+ true => self.read() | flags, | ||
+ false => self.read() & !flags, | ||
+ }; | ||
+ self.write(tmp); | ||
+ } | ||
+} |
22
crates/io/lib.rs
2
crates/io/mmio.rs
2
crates/io/pio.rs
2
crates/ion
@@ -1 +1 @@ | ||
-Subproject commit f3fd7098f4696a58f6cce671a41efd58fda03580 | ||
+Subproject commit 861748f6d53a708504a33ba6535214f3a2cf3e93 |
2
crates/system/syscall/redox.rs
2
crates/system/syscall/unix.rs
2
rustc-i386.sh
@@ -0,0 +1,2 @@ | ||
+#!/bin/bash | ||
+rustc -L build/i386-unknown-redox/debug $* |
2
rustc-x86_64.sh
@@ -0,0 +1,2 @@ | ||
+#!/bin/bash | ||
+rustc -L build/x86_64-unknown-redox/debug $* |
0 comments on commit
ebbea07