diff --git a/Kernel/Makefile b/Kernel/Makefile index 9c3beab861b19a67441597893d1eaf69ece0763d..7d96fdd066261e9a389908fdc220f6a30c15c595 100644 --- a/Kernel/Makefile +++ b/Kernel/Makefile @@ -146,15 +146,6 @@ doc/$(ARCH)/kernel/index.html: Core/main.rs $(OBJDIR)libkernel.rlib doc/$(ARCH)/core/index.html: ../libcore/lib.rs $(OBJDIR)libcore.rlib -ifeq ($(RUSTC_DATE),) - RUSTUP_VER := nightly - LIBCORE_URL := https://static.rust-lang.org/dist/rustc-nightly-src.tar.gz -else - RUSTUP_VER := nightly-$(RUSTC_DATE) - LIBCORE_URL := https://static.rust-lang.org/dist/$(RUSTC_DATE)/rustc-nightly-src.tar.gz -endif -RUSTUP_SRC_DIR = $(firstword $(wildcard ../.prefix/toolchains/nightly-*/lib/rustlib/src/rust/src))/ - # === # Toolchain maintainence # - Downloads rustc and libcore @@ -165,7 +156,8 @@ UPDATE: curl https://static.rust-lang.org/rustup/rustup-init.sh -sSf | RUSTUP_HOME=$(abspath ../.prefix) CARGO_HOME=$(abspath ../.prefix) sh -s -- --default-toolchain none --no-modify-path -y $(call fn_rustcmd,rustup) update $(RUSTUP_VER) $(call fn_rustcmd,rustup) default $(RUSTUP_VER) - $(call fn_rustcmd,rustup) component add rust-src + #$(call fn_rustcmd,rustup) component add rust-src + curl $(LIBCORE_URL) test -f ../.prefix/bin/xargo || $(CARGO) install xargo ../libcore/lib.rs: ../libcore_nofp.patch $(RUSTUP_SRC_DIR)libcore/lib.rs diff --git a/Makefile b/Makefile index d891c770a1f4b05c80a73625d1509b01efb0d6ad..900ba3c5f4277f26191f1432b252236a18c952d5 100644 --- a/Makefile +++ b/Makefile @@ -22,5 +22,15 @@ clean: UPDATE: @echo ">>> Updating rustc and libcore" - @make -C Kernel/ UPDATE --no-print-directory - @make -C Kernel/ ../libcore/lib.rs --no-print-directory + #@make -C Kernel/ UPDATE --no-print-directory + #@make -C Kernel/ ../libcore/lib.rs --no-print-directory + # + @mkdir -p ../.prefix + curl https://static.rust-lang.org/rustup/rustup-init.sh -sSf | RUSTUP_HOME=$(abspath ../.prefix) CARGO_HOME=$(abspath ../.prefix) sh -s -- --default-toolchain none --no-modify-path -y + $(call fn_rustcmd,rustup) update $(RUSTUP_VER) + $(call fn_rustcmd,rustup) default $(RUSTUP_VER) + #$(call fn_rustcmd,rustup) component add rust-src + curl $(RUSTC_SRC_URL) -o rustc-nightly-src.tar.gz + tar -xf rustc-nightly-src.tar.gz --wildcards rustc-nightly-src/src/lib\* rustc-nightly-src/src/stdsimd rustc-nightly-src/vendor/compiler_builtins + rm -rf rustc-nightly-src/src/libcompiler_builtins; mv rustc-nightly-src/vendor/compiler_builtins rustc-nightly-src/src/libcompiler_builtins + test -f .prefix/bin/xargo || $(CARGO) install xargo diff --git a/Usermode/Makefile b/Usermode/Makefile index 59f92215958d09210f267305b5c1409c1ae473d7..17f94bf6896967cb3bc475206da08ab53b93354e 100644 --- a/Usermode/Makefile +++ b/Usermode/Makefile @@ -29,7 +29,8 @@ TARGET_SPEC := target-$(ARCH).json RUST_COMMON_FLAGS := --target=$(TARGET_SPEC) --cfg 'arch="$(ARCH)"' --cfg nightly RUST_COMMON_FLAGS += -L $(LIBDIR) -RUSTUP_SRC_DIR = $(firstword $(wildcard ../.prefix/toolchains/nightly-*/lib/rustlib/src/rust/src))/ +XARGO := RUST_TARGET_PATH=$(dir $(abspath $(TARGET_SPEC))) $(XARGO) +XARGO_FLAGS := --target target-$(ARCH) RUSTFLAGS := $(RUST_COMMON_FLAGS) RUSTFLAGS += -O @@ -79,6 +80,7 @@ LOADER_DEPS := $(patsubst %,$(LIBDIR)lib%.rlib,$(call fn_getdeps,loader/src/main # Most binary targets have simple templates, but loader and libcore are special # loader: Requires an assembly stub # > Linking is done in two steps so that --gc-sections works +#$(BINDIR)loader: loader/link.ld $(OBJDIR)loader/start.ao $(OBJDIR)loader/src/main.o $(BINDIR)loader: loader/link.ld $(OBJDIR)loader/start.ao $(OBJDIR)loader/src/main.o $(LOADER_DEPS) @mkdir -p $(dir $@) @echo [LD] $@ @@ -87,6 +89,12 @@ $(BINDIR)loader: loader/link.ld $(OBJDIR)loader/start.ao $(OBJDIR)loader/src/mai $V$(OBJCOPY) $(OBJDIR)loader.elf -O binary $@ $V$(OBJDUMP) -CS $(OBJDIR)loader.elf > $(OBJDIR)loader.dsm $(OBJDIR)loader/src/main.o: $(LOADER_DEPS) +#$(OBJDIR)loader/src/main.o: +# $(XARGO) build $(XARGO_FLAGS) --manifest-path loader/Cargo.toml + +.PHONY: xargo +xargo: + $(XARGO) build $(XARGO_FLAGS) # Low-level loader dummy dynamic library # - Used to tell ld that `loader`'s exported symbols actually exist diff --git a/Usermode/liballoc_system/heap.rs b/Usermode/liballoc_system/heap.rs index 6d0093e67c8f3fea73d8b1c9114417ab2fa55695..c1fc7239dc2788f224ed918a4678fc3ea2dec36e 100644 --- a/Usermode/liballoc_system/heap.rs +++ b/Usermode/liballoc_system/heap.rs @@ -4,12 +4,12 @@ use sync::Mutex; use core::mem::{align_of,size_of}; -#[cfg(arch="amd64")] const HEAP_LIMITS: (usize,usize) = (0x1000_0000_0000, 0x7000_0000_0000); -#[cfg(arch="amd64")] const PAGE_SIZE: usize = 0x1000; -#[cfg(arch="armv7")] const HEAP_LIMITS: (usize,usize) = (0x1000_0000, 0x7000_0000); -#[cfg(arch="armv7")] const PAGE_SIZE: usize = 0x2000; -#[cfg(arch="armv8")] const HEAP_LIMITS: (usize,usize) = (0x1000_0000, 0x7000_0000); -#[cfg(arch="armv8")] const PAGE_SIZE: usize = 0x4000; +#[cfg(target_arch="x86_64")] const HEAP_LIMITS: (usize,usize) = (0x1000_0000_0000, 0x7000_0000_0000); +#[cfg(target_arch="x86_64")] const PAGE_SIZE: usize = 0x1000; +#[cfg(target_arch="arm")] const HEAP_LIMITS: (usize,usize) = (0x1000_0000, 0x7000_0000); +#[cfg(target_arch="arm")] const PAGE_SIZE: usize = 0x2000; +#[cfg(target_arch="aarch64")] const HEAP_LIMITS: (usize,usize) = (0x1000_0000, 0x7000_0000); +#[cfg(target_arch="aarch64")] const PAGE_SIZE: usize = 0x4000; pub const EMPTY: *mut u8 = 1 as *mut u8; diff --git a/Usermode/libstd/src/lib.rs b/Usermode/libstd/src/lib.rs index 100790a3ca6723942267067c809ddd095f133751..e6817824f9f6d77a695d20ac26dd841770b59df2 100644 --- a/Usermode/libstd/src/lib.rs +++ b/Usermode/libstd/src/lib.rs @@ -4,6 +4,7 @@ // A clone of rust's libstd customised to work correctly on Tifflin #![crate_type="rlib"] #![crate_name="std"] +//#![feature(staged_api)] // stability #![feature(lang_items)] // Allow definition of lang_items #![feature(linkage)] // Used for low-level runtime #![feature(core_intrinsics)] diff --git a/Usermode/libstd_rt/lib.rs b/Usermode/libstd_rt/lib.rs index efec02f907d7460fb7cbae93730cde66189ecfe0..f051e41c329ed1222400a737da30d61363c5d178 100644 --- a/Usermode/libstd_rt/lib.rs +++ b/Usermode/libstd_rt/lib.rs @@ -17,9 +17,9 @@ mod std { pub use core::fmt; } -#[cfg(arch="armv7")] +#[cfg(target_arch="arm")] enum Void {} -#[cfg(arch="armv7")] +#[cfg(target_arch="arm")] mod memory { pub mod virt { pub fn is_reserved<T>(p: *const T) -> bool { @@ -36,14 +36,9 @@ mod memory { } } -#[cfg(arch="amd64")] -#[path="arch-x86_64.rs"] -mod arch; -#[cfg(arch="armv7")] -#[path="arch-armv7.rs"] -mod arch; -#[cfg(arch="armv8")] -#[path="arch-armv8.rs"] +#[cfg_attr(target_arch="x86_64", path="arch-x86_64.rs")] +#[cfg_attr(target_arch="arm", path="arch-armv7.rs")] +#[cfg_attr(target_arch="aarch64", path="arch-armv8.rs")] mod arch; fn begin_panic_fmt(msg: &::core::fmt::Arguments, file_line: (&str, u32)) -> ! { diff --git a/Usermode/libsyscalls/lib.rs b/Usermode/libsyscalls/lib.rs index 63e911ff6f5df1697de16ec5eabf3f17706a0b89..f5c801d1c29a6b1a9d5f3e20454c8cbe5f25cad6 100644 --- a/Usermode/libsyscalls/lib.rs +++ b/Usermode/libsyscalls/lib.rs @@ -71,11 +71,11 @@ mod values; pub enum Void {} -#[cfg(arch="amd64")] #[path="raw-amd64.rs"] +#[cfg(target_arch="x86_64")] #[path="raw-amd64.rs"] mod raw; -#[cfg(arch="armv7")] #[path="raw-armv7.rs"] +#[cfg(target_arch="arm")] #[path="raw-armv7.rs"] mod raw; -#[cfg(arch="armv8")] #[path="raw-armv8.rs"] +#[cfg(target_arch="aarch64")] #[path="raw-armv8.rs"] mod raw; #[macro_use] diff --git a/Usermode/libwtk/input/button.rs b/Usermode/libwtk/input/button.rs index 9b925180e19357ac3fca4242f83be4361e4c91e5..ac4d3a9a21d2b0321d9e73ef649c01b140a29eab 100644 --- a/Usermode/libwtk/input/button.rs +++ b/Usermode/libwtk/input/button.rs @@ -19,14 +19,11 @@ where state: RefCell<State>, } -#[cfg(nightly)] pub type ButtonBcb<'a, T> = Button<T, BoxCb<'a, T>>; -#[cfg(nightly)] /// Wrapper around a Box<Fn> that allows a `Button` to be stored in a struct pub struct BoxCb<'a, T: 'a + ::Element>(Box<Fn(&ButtonInner<T>, &mut ::window::WindowTrait)+'a>); -#[cfg(nightly)] impl<'a, 'b1, 'b2, 'b3, T> ::std::ops::Fn<(&'b1 ButtonInner<T>, &'b2 mut (::window::WindowTrait<'b3> + 'b2))> for BoxCb<'a, T> where T: 'a + ::Element @@ -35,7 +32,6 @@ where self.0.call(args) } } -#[cfg(nightly)] impl<'a, 'b1, 'b2, 'b3, T> ::std::ops::FnMut<(&'b1 ButtonInner<T>, &'b2 mut (::window::WindowTrait<'b3> + 'b2))> for BoxCb<'a, T> where T: 'a + ::Element @@ -44,7 +40,6 @@ where self.call(args) } } -#[cfg(nightly)] impl<'a, 'b1, 'b2, 'b3, T> ::std::ops::FnOnce<(&'b1 ButtonInner<T>, &'b2 mut (::window::WindowTrait<'b3> + 'b2))> for BoxCb<'a, T> where T: 'a + ::Element @@ -83,7 +78,6 @@ impl<'a, T> Button<T, BoxCb<'a, T>> where T: ::Element, { - #[cfg(nightly)] pub fn new_boxfn<F2>(ele: T, cb: F2) -> Self where F2: 'a + Fn(&ButtonInner<T>, &mut ::window::WindowTrait) diff --git a/Usermode/libwtk/lib.rs b/Usermode/libwtk/lib.rs index 51af0a51ac80b4485abbd25763c2b65500f8f1d5..05d7a72f6fad53d0aba08bfad043be9a4debf3a9 100644 --- a/Usermode/libwtk/lib.rs +++ b/Usermode/libwtk/lib.rs @@ -3,7 +3,7 @@ // //! Tifflin window toolkit #![feature(const_fn)] -#![cfg_attr(nightly, feature(unboxed_closures,fn_traits))] +#![feature(unboxed_closures,fn_traits)] extern crate async; extern crate byteorder; diff --git a/common.mk b/common.mk index 6a6f015d7be33ea966152c860257966df6d3ecf8..b12df46846a1a3c463fa0844d8688bfd3338607f 100644 --- a/common.mk +++ b/common.mk @@ -14,6 +14,15 @@ else $(error Unknown architecture $(ARCH) in common.mk) endif + +ifeq ($(RUSTC_DATE),) + RUSTUP_VER := nightly + RUSTC_SRC_URL := https://static.rust-lang.org/dist/rustc-nightly-src.tar.gz +else + RUSTUP_VER := nightly-$(RUSTC_DATE) + RUSTC_SRC_URL := https://static.rust-lang.org/dist/$(RUSTC_DATE)/rustc-nightly-src.tar.gz +endif + CC := $(TRIPLE)-gcc LD := $(TRIPLE)-ld AS := $(TRIPLE)-as @@ -31,7 +40,9 @@ fn_rustcmd = RUSTUP_HOME=$(abspath $(PREFIX)) CARGO_HOME=$(abspath $(PREFIX)) $( RUSTC := $(call fn_rustcmd,rustc) RUSTDOC := $(call fn_rustcmd,rustdoc) CARGO := $(call fn_rustcmd,cargo) -XARGO := $(call fn_rustcmd,xargo) +XARGO := XARGO_HOME=$(abspath $(PREFIX)xargo) $(call fn_rustcmd,xargo) -RUSTUP_SRC_DIR = $(firstword $(wildcard $(PREFIX)toolchains/nightly-*/lib/rustlib/src/rust/src))/ +#RUSTUP_SRC_DIR = $(firstword $(wildcard $(PREFIX)toolchains/nightly-*/lib/rustlib/src/rust/src))/ +RUSTUP_SRC_DIR := $(abspath $(ROOTDIR)/rustc-nightly-src/src)/ +$(warning $(RUSTUP_SRC_DIR))