* 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
This commit is contained in:
Jeremy Soller 2016-10-13 17:21:42 -06:00 committed by GitHub
parent 372d44f88c
commit 224c43f761
92 changed files with 3415 additions and 473 deletions

View file

@ -1,31 +1,27 @@
use collections::VecDeque;
use core::str;
use core::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
use spin::{Mutex, Once};
use spin::Once;
use context;
use sync::WaitQueue;
use syscall::error::*;
use syscall::flag::EVENT_READ;
use syscall::scheme::Scheme;
pub static DEBUG_SCHEME_ID: AtomicUsize = ATOMIC_USIZE_INIT;
/// Input
static INPUT: Once<Mutex<VecDeque<u8>>> = Once::new();
/// Input queue
static INPUT: Once<WaitQueue<u8>> = Once::new();
/// Initialize contexts, called if needed
fn init_input() -> Mutex<VecDeque<u8>> {
Mutex::new(VecDeque::new())
/// Initialize input queue, called if needed
fn init_input() -> WaitQueue<u8> {
WaitQueue::new()
}
/// Get the global schemes list, const
/// Add to the input queue
#[no_mangle]
pub extern fn debug_input(b: u8) {
let len = {
let mut input = INPUT.call_once(init_input).lock();
input.push_back(b);
input.len()
};
let len = INPUT.call_once(init_input).send(b);
context::event::trigger(DEBUG_SCHEME_ID.load(Ordering::SeqCst), 0, EVENT_READ, len);
}
@ -45,22 +41,7 @@ impl Scheme for DebugScheme {
///
/// Returns the number of bytes read
fn read(&self, _file: usize, buf: &mut [u8]) -> Result<usize> {
loop {
let mut i = 0;
{
let mut input = INPUT.call_once(init_input).lock();
while i < buf.len() && ! input.is_empty() {
buf[i] = input.pop_front().expect("debug_input lost byte");
i += 1;
}
}
if i > 0 {
return Ok(i);
} else {
unsafe { context::switch(); } //TODO: Block
}
}
Ok(INPUT.call_once(init_input).receive_into(buf))
}
/// Write the `buffer` to the `file`