
* Port previous ethernet scheme * Add ipd * Fix initfs rebuilds, use QEMU user networking addresses in ipd * Add tcp/udp, netutils, dns, and network config * Add fsync to network driver * Add dns, router, subnet by default * Fix e1000 driver. Make ethernet and IP non-blocking to avoid deadlocks * Add orbital server, WIP * Add futex * Add orbutils and orbital * Update libstd, orbutils, and orbital Move ANSI key encoding to vesad * Add orbital assets * Update orbital * Update to add login manager * Add blocking primitives, block for most things except waitpid, update orbital * Wait in waitpid and IRQ, improvements for other waits * Fevent in root scheme * WIP: Switch to using fevent * Reorganize * Event based e1000d driver * Superuser-only access to some network schemes, display, and disk * Superuser root and irq schemes * Fix orbital
32 lines
682 B
Rust
32 lines
682 B
Rust
use core::intrinsics::{volatile_load, volatile_store};
|
|
use core::mem::uninitialized;
|
|
use core::ops::{BitAnd, BitOr, Not};
|
|
|
|
use super::io::Io;
|
|
|
|
#[repr(packed)]
|
|
pub struct Mmio<T> {
|
|
value: T,
|
|
}
|
|
|
|
impl<T> Mmio<T> {
|
|
/// Create a new Mmio without initializing
|
|
pub fn new() -> Self {
|
|
Mmio {
|
|
value: unsafe { uninitialized() }
|
|
}
|
|
}
|
|
}
|
|
|
|
impl<T> Io for Mmio<T> where T: Copy + PartialEq + BitAnd<Output = T> + BitOr<Output = T> + Not<Output = T> {
|
|
type Value = T;
|
|
|
|
fn read(&self) -> T {
|
|
unsafe { volatile_load(&self.value) }
|
|
}
|
|
|
|
fn write(&mut self, value: T) {
|
|
unsafe { volatile_store(&mut self.value, value) };
|
|
}
|
|
}
|