* Fire up multiple processors

* Use IPIs to wake up secondary processors

* Much better exception information

* Modifications to show more information on fault

* WIP: Use real libstd

* Add TLS (not complete)

* Add random function, export getpid, cleanup

* Do not spin APs until new context

* Update rust

* Update rust

* Use rd/wrfsbase

* Implement TLS

* Implement compiler builtins and update rust

* Update rust

* Back to Redox libstd

* Update rust
This commit is contained in:
Jeremy Soller 2016-10-31 10:49:00 -06:00 committed by GitHub
parent 25dc44b348
commit 149b0297a4
54 changed files with 1121 additions and 380 deletions

View file

@ -6,7 +6,7 @@ use std::{cmp, str, u16};
use netutils::{getcfg, MacAddr, EthernetII};
use syscall;
use syscall::error::{Error, Result, EACCES, EBADF, EINVAL, EWOULDBLOCK};
use syscall::error::{Error, Result, EACCES, EBADF, EINVAL, EIO, EWOULDBLOCK};
use syscall::flag::O_NONBLOCK;
use syscall::scheme::SchemeMut;
@ -63,7 +63,7 @@ impl EthernetScheme {
impl SchemeMut for EthernetScheme {
fn open(&mut self, url: &[u8], flags: usize, uid: u32, _gid: u32) -> Result<usize> {
if uid == 0 {
let mac_addr = MacAddr::from_str(&getcfg("mac").map_err(|err| err.into_sys())?);
let mac_addr = MacAddr::from_str(&getcfg("mac").map_err(|err| Error::new(err.raw_os_error().unwrap_or(EIO)))?);
let path = try!(str::from_utf8(url).or(Err(Error::new(EINVAL))));
let ethertype = u16::from_str_radix(path, 16).unwrap_or(0);
@ -121,7 +121,7 @@ impl SchemeMut for EthernetScheme {
if let Some(mut frame) = EthernetII::from_bytes(buf) {
frame.header.src = handle.host_addr;
frame.header.ethertype.set(handle.ethertype);
self.network.write(&frame.to_bytes()).map_err(|err| err.into_sys())
self.network.write(&frame.to_bytes()).map_err(|err| Error::new(err.raw_os_error().unwrap_or(EIO)))
} else {
Err(Error::new(EINVAL))
}

View file

@ -12,7 +12,7 @@ use std::os::unix::io::FromRawFd;
use std::rc::Rc;
use std::{slice, str, thread};
use syscall::data::Packet;
use syscall::error::{Error, Result, EACCES, EADDRNOTAVAIL, EBADF, EINVAL, ENOENT, EWOULDBLOCK};
use syscall::error::{Error, Result, EACCES, EADDRNOTAVAIL, EBADF, EIO, EINVAL, ENOENT, EWOULDBLOCK};
use syscall::flag::{EVENT_READ, O_NONBLOCK};
use syscall::scheme::SchemeMut;
@ -275,7 +275,7 @@ impl SchemeMut for Ipd {
data: ip.to_bytes()
};
interface.ip_file.write(&frame.to_bytes()).map_err(|err| err.into_sys())?;
interface.ip_file.write(&frame.to_bytes()).map_err(|err| Error::new(err.raw_os_error().unwrap_or(EIO)))?;
return Ok(buf.len());
}

View file

@ -15,7 +15,7 @@ use std::rc::Rc;
use event::EventQueue;
use netutils::{n16, n32, Ipv4, Ipv4Addr, Ipv4Header, Tcp, TcpHeader, Checksum, TCP_FIN, TCP_SYN, TCP_RST, TCP_PSH, TCP_ACK};
use syscall::data::Packet;
use syscall::error::{Error, Result, EACCES, EADDRINUSE, EBADF, EINVAL, EISCONN, EMSGSIZE, ENOTCONN, EWOULDBLOCK};
use syscall::error::{Error, Result, EACCES, EADDRINUSE, EBADF, EIO, EINVAL, EISCONN, EMSGSIZE, ENOTCONN, EWOULDBLOCK};
use syscall::flag::{EVENT_READ, O_CREAT, O_RDWR, O_NONBLOCK};
use syscall::scheme::SchemeMut;
@ -274,7 +274,7 @@ impl Tcpd {
let tcp = handle.create_tcp(TCP_ACK | TCP_PSH, buf.to_vec());
let ip = handle.create_ip(self.rng.gen(), tcp.to_bytes());
let result = self.tcp_file.write(&ip.to_bytes()).map_err(|err| err.into_sys());
let result = self.tcp_file.write(&ip.to_bytes()).map_err(|err| Error::new(err.raw_os_error().unwrap_or(EIO)));
if result.is_ok() {
handle.seq += buf.len() as u32;
}
@ -422,7 +422,7 @@ impl SchemeMut for Tcpd {
let tcp = handle.create_tcp(TCP_SYN, Vec::new());
let ip = handle.create_ip(self.rng.gen(), tcp.to_bytes());
self.tcp_file.write(&ip.to_bytes()).map_err(|err| err.into_sys())?;
self.tcp_file.write(&ip.to_bytes()).map_err(|err| Error::new(err.raw_os_error().unwrap_or(EIO)))?;
handle.seq += 1;
}
@ -469,7 +469,7 @@ impl SchemeMut for Tcpd {
let tcp = new_handle.create_tcp(TCP_SYN | TCP_ACK, Vec::new());
let ip = new_handle.create_ip(self.rng.gen(), tcp.to_bytes());
self.tcp_file.write(&ip.to_bytes()).map_err(|err| err.into_sys()).and(Ok(buf.len()))?;
self.tcp_file.write(&ip.to_bytes()).map_err(|err| Error::new(err.raw_os_error().unwrap_or(EIO))).and(Ok(buf.len()))?;
new_handle.seq += 1;
} else {
@ -506,7 +506,7 @@ impl SchemeMut for Tcpd {
let tcp = new_handle.create_tcp(TCP_SYN, Vec::new());
let ip = new_handle.create_ip(self.rng.gen(), tcp.to_bytes());
self.tcp_file.write(&ip.to_bytes()).map_err(|err| err.into_sys()).and(Ok(buf.len()))?;
self.tcp_file.write(&ip.to_bytes()).map_err(|err| Error::new(err.raw_os_error().unwrap_or(EIO))).and(Ok(buf.len()))?;
} else {
return Err(Error::new(EINVAL));
}
@ -559,7 +559,7 @@ impl SchemeMut for Tcpd {
State::Established => {
let tcp = handle.create_tcp(TCP_ACK | TCP_PSH, buf.to_vec());
let ip = handle.create_ip(self.rng.gen(), tcp.to_bytes());
self.tcp_file.write(&ip.to_bytes()).map_err(|err| err.into_sys())?;
self.tcp_file.write(&ip.to_bytes()).map_err(|err| Error::new(err.raw_os_error().unwrap_or(EIO)))?;
handle.seq += buf.len() as u32;
Ok(buf.len())
},
@ -611,7 +611,7 @@ impl SchemeMut for Tcpd {
let tcp = handle.create_tcp(TCP_FIN | TCP_ACK, Vec::new());
let ip = handle.create_ip(self.rng.gen(), tcp.to_bytes());
self.tcp_file.write(&ip.to_bytes()).map_err(|err| err.into_sys())?;
self.tcp_file.write(&ip.to_bytes()).map_err(|err| Error::new(err.raw_os_error().unwrap_or(EIO)))?;
handle.seq += 1;
@ -622,7 +622,7 @@ impl SchemeMut for Tcpd {
let tcp = handle.create_tcp(TCP_FIN | TCP_ACK, Vec::new());
let ip = handle.create_ip(self.rng.gen(), tcp.to_bytes());
self.tcp_file.write(&ip.to_bytes()).map_err(|err| err.into_sys())?;
self.tcp_file.write(&ip.to_bytes()).map_err(|err| Error::new(err.raw_os_error().unwrap_or(EIO)))?;
handle.seq += 1;

View file

@ -15,7 +15,7 @@ use std::rc::Rc;
use event::EventQueue;
use netutils::{n16, Ipv4, Ipv4Addr, Ipv4Header, Udp, UdpHeader, Checksum};
use syscall::data::Packet;
use syscall::error::{Error, Result, EACCES, EADDRINUSE, EBADF, EINVAL, EMSGSIZE, ENOTCONN, EWOULDBLOCK};
use syscall::error::{Error, Result, EACCES, EADDRINUSE, EBADF, EIO, EINVAL, EMSGSIZE, ENOTCONN, EWOULDBLOCK};
use syscall::flag::{EVENT_READ, O_CREAT, O_RDWR, O_NONBLOCK};
use syscall::scheme::SchemeMut;
@ -265,7 +265,7 @@ impl SchemeMut for Udpd {
data: ip_data
};
self.udp_file.write(&ip.to_bytes()).map_err(|err| err.into_sys()).and(Ok(buf.len()))
self.udp_file.write(&ip.to_bytes()).map_err(|err| Error::new(err.raw_os_error().unwrap_or(EIO))).and(Ok(buf.len()))
}
}