* Switch to real standard, fix daemonization on real standard

* Update submodules

* Remove --cfg redox

* Update rust, syscall

* Update submodules

* Update orbutils
This commit is contained in:
Jeremy Soller 2016-11-14 11:06:55 -07:00 committed by GitHub
commit 5fd7b2b71d
14 changed files with 56 additions and 46 deletions

View file

@ -13,10 +13,10 @@ KCARGOFLAGS=--target $(KTARGET).json --release -- -C soft-float
TARGET=$(ARCH)-unknown-redox
BUILD=build/userspace
RUSTC=./rustc.sh
RUSTCFLAGS=--target $(TARGET).json -C opt-level=2 -C debuginfo=0 --cfg redox
RUSTCFLAGS=--target $(TARGET).json -C opt-level=2 -C debuginfo=0
RUSTDOC=./rustdoc.sh
CARGO=RUSTC="$(RUSTC)" RUSTDOC="$(RUSTDOC)" cargo
CARGOFLAGS=--target $(TARGET).json --release -- --cfg redox
CARGOFLAGS=--target $(TARGET).json --release --
# Default targets
.PHONY: all clean doc ref test update qemu bochs drivers schemes coreutils extrautils netutils userutils wireshark FORCE
@ -213,7 +213,7 @@ else
%.list: %
objdump -C -M intel -D $< > $@
$(KBUILD)/harddrive.bin: $(KBUILD)/kernel $(BUILD)/filesystem.bin bootloader/$(ARCH)/**
$(KBUILD)/harddrive.bin: $(KBUILD)/kernel bootloader/$(ARCH)/** $(BUILD)/filesystem.bin
nasm -f bin -o $@ -D ARCH_$(ARCH) -ibootloader/$(ARCH)/ bootloader/$(ARCH)/harddrive.asm
qemu: $(KBUILD)/harddrive.bin
@ -311,13 +311,13 @@ $(BUILD)/libopenlibm.a: libstd/openlibm/libopenlibm.a
mkdir -p $(BUILD)
cp $< $@
$(BUILD)/libstd.rlib: libstd/Cargo.toml libstd/src/** $(BUILD)/libcore.rlib $(BUILD)/liballoc.rlib $(BUILD)/librustc_unicode.rlib $(BUILD)/libcollections.rlib $(BUILD)/librand.rlib $(BUILD)/libopenlibm.a
$(CARGO) rustc --verbose --manifest-path $< $(CARGOFLAGS) -o $@
cp libstd/target/$(TARGET)/release/deps/*.rlib $(BUILD)
#$(BUILD)/libstd.rlib: libstd_real/Cargo.toml rust/src/libstd/** $(BUILD)/libcore.rlib $(BUILD)/liballoc.rlib $(BUILD)/librustc_unicode.rlib $(BUILD)/libcollections.rlib $(BUILD)/librand.rlib $(BUILD)/libopenlibm.a
#$(BUILD)/libstd.rlib: libstd/Cargo.toml libstd/src/** $(BUILD)/libcore.rlib $(BUILD)/liballoc.rlib $(BUILD)/librustc_unicode.rlib $(BUILD)/libcollections.rlib $(BUILD)/librand.rlib $(BUILD)/libopenlibm.a
# $(CARGO) rustc --verbose --manifest-path $< $(CARGOFLAGS) -o $@
# cp libstd_real/target/$(TARGET)/release/deps/*.rlib $(BUILD)
# cp libstd/target/$(TARGET)/release/deps/*.rlib $(BUILD)
$(BUILD)/libstd.rlib: libstd_real/Cargo.toml rust/src/libstd/** $(BUILD)/libcore.rlib $(BUILD)/liballoc.rlib $(BUILD)/librustc_unicode.rlib $(BUILD)/libcollections.rlib $(BUILD)/librand.rlib $(BUILD)/libopenlibm.a
$(CARGO) rustc --verbose --manifest-path $< $(CARGOFLAGS) -o $@
cp libstd_real/target/$(TARGET)/release/deps/*.rlib $(BUILD)
initfs/bin/%: drivers/%/Cargo.toml drivers/%/src/** $(BUILD)/libstd.rlib
mkdir -p initfs/bin

View file

@ -7,7 +7,7 @@ extern crate io;
extern crate spin;
extern crate syscall;
use std::{env, thread, usize};
use std::{env, usize};
use std::fs::File;
use std::io::{Read, Write};
use std::os::unix::io::{AsRawFd, FromRawFd};
@ -29,7 +29,8 @@ fn main() {
print!("{}", format!(" + AHCI on: {:X} IRQ: {}\n", bar, irq));
thread::spawn(move || {
// Daemonize
if unsafe { syscall::clone(0).unwrap() } == 0 {
let address = unsafe { syscall::physmap(bar, 4096, MAP_WRITE).expect("ahcid: failed to map address") };
{
let socket_fd = syscall::open(":disk", syscall::O_RDWR | syscall::O_CREAT | syscall::O_NONBLOCK).expect("ahcid: failed to create disk scheme");
@ -69,5 +70,5 @@ fn main() {
}
}
unsafe { let _ = syscall::physunmap(address); }
});
}
}

View file

@ -6,7 +6,7 @@ extern crate netutils;
extern crate syscall;
use std::cell::RefCell;
use std::{env, thread};
use std::env;
use std::fs::File;
use std::io::{Read, Write, Result};
use std::os::unix::io::{AsRawFd, FromRawFd};
@ -29,7 +29,8 @@ fn main() {
print!("{}", format!(" + E1000 on: {:X}, IRQ: {}\n", bar, irq));
thread::spawn(move || {
// Daemonize
if unsafe { syscall::clone(0).unwrap() } == 0 {
let socket_fd = syscall::open(":network", syscall::O_RDWR | syscall::O_CREAT | syscall::O_NONBLOCK).expect("e1000d: failed to create network scheme");
let socket = Arc::new(RefCell::new(unsafe { File::from_raw_fd(socket_fd) }));
@ -128,5 +129,5 @@ fn main() {
}
}
unsafe { let _ = syscall::physunmap(address); }
});
}
}

View file

@ -11,7 +11,7 @@ use std::env;
use std::fs::File;
use std::io::{Read, Write, Result};
use std::os::unix::io::AsRawFd;
use std::{mem, thread};
use std::mem;
use event::EventQueue;
use orbclient::{KeyEvent, MouseEvent};
@ -123,7 +123,8 @@ impl<'a> Ps2d<'a> {
}
fn main() {
thread::spawn(|| {
// Daemonize
if unsafe { syscall::clone(0).unwrap() } == 0 {
unsafe {
iopl(3).expect("ps2d: failed to get I/O permission");
asm!("cli" : : : : "intel", "volatile");
@ -188,5 +189,5 @@ fn main() {
let (keyboard, data) = event_queue.run().expect("ps2d: failed to handle events");
ps2d.handle(keyboard, data);
}
});
}
}

View file

@ -7,7 +7,7 @@ extern crate netutils;
extern crate syscall;
use std::cell::RefCell;
use std::{env, thread};
use std::env;
use std::fs::File;
use std::io::{Read, Write, Result};
use std::os::unix::io::{AsRawFd, FromRawFd};
@ -30,7 +30,8 @@ fn main() {
print!("{}", format!(" + RTL8168 on: {:X}, IRQ: {}\n", bar, irq));
thread::spawn(move || {
// Daemonize
if unsafe { syscall::clone(0).unwrap() } == 0 {
let socket_fd = syscall::open(":network", syscall::O_RDWR | syscall::O_CREAT | syscall::O_NONBLOCK).expect("rtl8168d: failed to create network scheme");
let socket = Arc::new(RefCell::new(unsafe { File::from_raw_fd(socket_fd) }));
@ -133,5 +134,5 @@ fn main() {
}
}
unsafe { let _ = syscall::physunmap(address); }
});
}
}

View file

@ -6,7 +6,7 @@ extern crate alloc;
extern crate orbclient;
extern crate syscall;
use std::{env, mem, thread};
use std::{env, mem};
use std::fs::File;
use std::io::{Read, Write};
use syscall::{physmap, physunmap, Packet, SchemeMut, EVENT_READ, MAP_WRITE, MAP_WRITE_COMBINE};
@ -49,7 +49,8 @@ fn main() {
}
if physbaseptr > 0 {
thread::spawn(move || {
// Daemonize
if unsafe { syscall::clone(0).unwrap() } == 0 {
let mut socket = File::create(":display").expect("vesad: failed to create display scheme");
let size = width * height;
@ -103,6 +104,6 @@ fn main() {
}
}
}
});
}
}
}

View file

@ -8,7 +8,6 @@ use std::fs::File;
use std::io::{Result, Read, Write};
use std::os::unix::io::FromRawFd;
use std::rc::Rc;
use std::thread;
use syscall::{Packet, SchemeMut, EWOULDBLOCK};
@ -17,7 +16,8 @@ use scheme::EthernetScheme;
mod scheme;
fn main() {
thread::spawn(move || {
// Daemonize
if unsafe { syscall::clone(0).unwrap() } == 0 {
let network_fd = syscall::open("network:", syscall::O_RDWR | syscall::O_NONBLOCK).expect("ethernetd: failed to open network");
let network = unsafe { File::from_raw_fd(network_fd) };
@ -90,5 +90,5 @@ fn main() {
event_queue.trigger_all(0).expect("ethernetd: failed to trigger events");
event_queue.run().expect("ethernetd: failed to run event loop");
});
}
}

View file

@ -3,7 +3,6 @@ extern crate syscall;
use std::fs::File;
use std::io::{Read, Write};
use std::str;
use std::thread;
use syscall::{Packet, Result, Scheme};
@ -25,7 +24,8 @@ impl Scheme for ExampleScheme {
}
fn main(){
thread::spawn(move || {
// Daemonize
if unsafe { syscall::clone(0).unwrap() } == 0 {
let mut socket = File::create(":example").expect("example: failed to create example scheme");
let scheme = ExampleScheme;
loop {
@ -35,5 +35,5 @@ fn main(){
scheme.handle(&mut packet);
socket.write(&packet).expect("example: failed to write responses to example scheme");
}
});
}
}

View file

@ -10,7 +10,7 @@ use std::fs::File;
use std::io::{self, Read, Write};
use std::os::unix::io::FromRawFd;
use std::rc::Rc;
use std::{slice, str, thread};
use std::{slice, str};
use syscall::data::Packet;
use syscall::error::{Error, Result, EACCES, EADDRNOTAVAIL, EBADF, EIO, EINVAL, ENOENT, EWOULDBLOCK};
use syscall::flag::{EVENT_READ, O_NONBLOCK};
@ -326,7 +326,8 @@ impl SchemeMut for Ipd {
}
fn main() {
thread::spawn(move || {
// Daemonize
if unsafe { syscall::clone(0).unwrap() } == 0 {
let scheme_fd = syscall::open(":ip", syscall::O_RDWR | syscall::O_CREAT | syscall::O_NONBLOCK).expect("ipd: failed to create :ip");
let scheme_file = unsafe { File::from_raw_fd(scheme_fd) };
@ -367,5 +368,5 @@ fn main() {
event_queue.trigger_all(0).expect("ipd: failed to trigger event queue");
event_queue.run().expect("ipd: failed to run event queue");
});
}
}

View file

@ -7,7 +7,7 @@ use std::collections::{BTreeMap, VecDeque};
use std::fs::File;
use std::io::{Read, Write};
use std::rc::{Rc, Weak};
use std::{str, thread};
use std::str;
use syscall::data::Packet;
use syscall::error::{Error, Result, EBADF, EINVAL, ENOENT, EPIPE, EWOULDBLOCK};
@ -289,7 +289,8 @@ impl PtySlave {
}
fn main(){
thread::spawn(move || {
// Daemonize
if unsafe { syscall::clone(0).unwrap() } == 0 {
let mut socket = File::create(":pty").expect("pty: failed to create pty scheme");
let mut scheme = PtyScheme::new();
let mut todo = Vec::new();
@ -375,5 +376,5 @@ fn main(){
}
}
}
});
}
}

View file

@ -7,7 +7,6 @@ extern crate rand;
use std::fs::File;
use std::io::{Read, Write};
use std::thread;
use rand::chacha::ChaChaRng;
use rand::Rng;
@ -51,7 +50,8 @@ impl SchemeMut for RandScheme {
fn main(){
let has_rdrand = CpuId::new().get_feature_info().unwrap().has_rdrand();
thread::spawn(move || {
// Daemonize
if unsafe { syscall::clone(0).unwrap() } == 0 {
let mut socket = File::create(":rand").expect("rand: failed to create rand scheme");
let mut rng = ChaChaRng::new_unseeded();
@ -78,5 +78,5 @@ fn main(){
scheme.handle(&mut packet);
socket.write(&packet).expect("rand: failed to write responses to rand scheme");
}
});
}
}

View file

@ -8,7 +8,7 @@ use std::collections::{BTreeMap, VecDeque};
use std::cell::RefCell;
use std::fs::File;
use std::io::{self, Read, Write};
use std::{mem, slice, str, thread};
use std::{mem, slice, str};
use std::os::unix::io::FromRawFd;
use std::rc::Rc;
@ -652,7 +652,8 @@ impl SchemeMut for Tcpd {
}
fn main() {
thread::spawn(move || {
// Daemonize
if unsafe { syscall::clone(0).unwrap() } == 0 {
let scheme_fd = syscall::open(":tcp", O_RDWR | O_CREAT | O_NONBLOCK).expect("tcpd: failed to create :tcp");
let scheme_file = unsafe { File::from_raw_fd(scheme_fd) };
@ -677,5 +678,5 @@ fn main() {
event_queue.trigger_all(0).expect("tcpd: failed to trigger event queue");
event_queue.run().expect("tcpd: failed to run event queue");
});
}
}

View file

@ -8,7 +8,7 @@ use std::collections::{BTreeMap, VecDeque};
use std::cell::RefCell;
use std::fs::File;
use std::io::{self, Read, Write};
use std::{mem, slice, str, thread};
use std::{mem, slice, str};
use std::os::unix::io::FromRawFd;
use std::rc::Rc;
@ -319,7 +319,8 @@ impl SchemeMut for Udpd {
}
fn main() {
thread::spawn(move || {
// Daemonize
if unsafe { syscall::clone(0).unwrap() } == 0 {
let scheme_fd = syscall::open(":udp", O_RDWR | O_CREAT | O_NONBLOCK).expect("udpd: failed to create :udp");
let scheme_file = unsafe { File::from_raw_fd(scheme_fd) };
@ -344,5 +345,5 @@ fn main() {
event_queue.trigger_all(0).expect("udpd: failed to trigger event queue");
event_queue.run().expect("udpd: failed to run event queue");
});
}
}

View file

@ -22,5 +22,6 @@
"no-compiler-rt": true,
"no-default-libraries": true,
"position-independent-executables": false,
"has-elf-tls": true
"has-elf-tls": true,
"panic-strategy": "abort"
}