Skip to content

Commit

Permalink
Update to Rustc version nightly-2020-11-10 (theseus-os#329)
Browse files Browse the repository at this point in the history
* Remove stabilized features and add new required ones. 

* Change `catch_unwind` crate to accommodate new `try` intrinsic function signature. 

* Remove dependency on `core_io` crate, which was very difficult to use and update. Use `bare_io` instead. 

* Remove custom version of `memoffset` crate, as the newer compiler version builds the one on crates.io properly.

* Use llvm_asm!() macro instead of asm!(), which has been deprecated. Will move to the new safer inline assembly syntax later.

* Remove lots of unnecessary parenthesis and braces, which are now hard warnings. 

* The `Step` trait is now unsafe, so we should find an alternative implementation for `Page` and `Frame`.

* Fix problem with compiler_builtins traits now being private, so we need to expand our `truncate` implementation. This can be removed once the compiler_builtins crate implements `__truncdfsf2vfp`.

* Adapt to the new function signature for `AtomicU*::fetch_update()`

* Make similar changes to the `x86_64` and `irq_safety` libraries.
  • Loading branch information
kevinaboos authored Nov 13, 2020
1 parent d6023b1 commit 31937ac
Show file tree
Hide file tree
Showing 62 changed files with 1,968 additions and 1,657 deletions.
2,722 changes: 1,347 additions & 1,375 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,8 @@ getopts = { git = "https://github.com/kevinaboos/getopts" }
qp-trie = { git = "https://github.com/theseus-os/qp-trie-rs" }
### use our own no_std-compatible downcast-rs
downcast-rs = { git = "https://github.com/theseus-os/downcast-rs" }
### use the latest version of core_io that supports the latest nightly Rust compiler
core_io = { git = "https://github.com/theseus-os/rust-core_io" }
### use the latest version of smoltcp from github; the one on crates.io is out of date
smoltcp = { git = "https://github.com/m-labs/smoltcp" }
### use a version of memoffset where doctest is not a stable feature. The patch can be removed when
### we update our rustc verstion to 1.42. Then we can just use the version available on crates.io
memoffset = {git ="https://github.com/Ramla-I/memoffset.git"}

### These profiles fix the new rustc behavior of splitting one crate into many object files.
### That messes up our module loading, which is bad!
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ endif
### For ensuring that the host computer has the proper version of xargo
###################################################################################################

XARGO_CURRENT_SUPPORTED_VERSION := 0.3.17
XARGO_CURRENT_SUPPORTED_VERSION := 0.3.22
XARGO_OUTPUT=$(shell xargo --version 2>&1 | head -n 1 | grep -o 'xargo [0-9]*\.[0-9]*\.[0-9]*')

check_xargo:
Expand All @@ -68,7 +68,8 @@ ifneq (xargo ${XARGO_CURRENT_SUPPORTED_VERSION}, ${XARGO_OUTPUT})
@echo -e "To install the proper version of xargo, run the following commands:\n"
@echo -e " cargo uninstall xargo"
@echo -e ' rm -rf $$HOME/.xargo' ## use single quotes to escape dollar sign
@echo -e " cargo install --vers $(XARGO_CURRENT_SUPPORTED_VERSION) xargo"
@echo -e " rustup toolchain install stable"
@echo -e " cargo +stable install --vers $(XARGO_CURRENT_SUPPORTED_VERSION) xargo"
@echo -e " make clean\n"
@echo -e "Then you can retry building!\n"
@exit 1
Expand Down
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ Install the current Rust compiler and toolchain by following the [setup instruct
`curl https://sh.rustup.rs -sSf | sh`

We also need to install Xargo, a drop-in replacement wrapper for Cargo that makes cross-compiling easier:
`cargo install --vers 0.3.17 xargo`

`rustup toolchain install stable`
`cargo +stable install --vers 0.3.22 xargo`


## Building and Running
Expand Down Expand Up @@ -129,7 +129,7 @@ Try setting a breakpoint at the kernel's entry function using `b nano_core::nano


## Documentation
Theseus, like the Rust language itself, includes two forms of documentation: the main source-level documentation within the code itself, and a "book" for high-level overviews of design concepts. The latter is a work in progress but may still be useful, while the former is more useful for developing on Thesues.
Theseus, like the Rust language itself, includes two forms of documentation: the main source-level documentation within the code itself, and a "book" for high-level overviews of design concepts. The latter is a work in progress but may still be useful, while the former is more useful for developing on Theseus.

[Documentation is currently hosted online here](https://theseus-os.github.io/Theseus/), but may be out of date. It's best to build it yourself, as detailed below.

Expand All @@ -152,10 +152,11 @@ For VS Code, recommended plugins are:
* Better TOML, by bungcip
* x86 and x86_64 Assembly, by 13xforever

### Fixing RLS Problems
Sometimes RLS just doesn't want to behave, especially if the latest Rust nightly version had build errors. In that case, try the following steps to fix it:
### Fixing Rustup, Rust Toolchain, or RLS Problems
Sometimes things just don't want to behave, especially if there were issues with the currently-chosen Rust nightly version.
In that case, try the following steps to fix it:
* Set your default Rust toolchain to the one version in the `rust-toolchain` file, for example:
`rustup default nightly-2019-07-09`.
`rustup default $(cat rust-toolchain)`.
* With your newly-set default toolchain, add the necessary components:
`rustup component add rls rust-analysis rust-src`.
* In VS Code (or whatever IDE you're using), uninstall and reinstall the RLS extension, reloading the IDE each time.
Expand All @@ -170,7 +171,7 @@ Sometimes RLS just doesn't want to behave, especially if the latest Rust nightly
We have tested Theseus on a variety of real machines, including Intel NUC devices, various Thinkpad laptops, and Supermicro servers.
Currently, the only limiting factor is that the device support booting via USB or PXE using traditional BIOS rather than UEFI; support for UEFI is a work-in-progress.

To boot over USB, simply run `make boot usb=sdc`, in which `sdc` is the device node for the USB disk itself (*not a partition like sdc2*) to which you want to write the OS image.
To boot over USB, simply run `make boot usb=sdc`, in which `sdc` is the device node for the USB disk itself *(**not a partition** like sdc2)* to which you want to write the OS image.
On WSL or other host environments where `/dev` device nodes don't exist, you can simply run `make iso` and burn the `.iso` file in the `build/` directory to a USB, e.g., using [Rufus](https://rufus.ie/) on Windows.

To boot Theseus over PXE (network boot), see [this set of separate instructions](book/src/pxe.md).
Expand Down
2 changes: 1 addition & 1 deletion applications/app_io/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ build = "../../build.rs"
[dependencies]
spin = "0.4.10"
x86_64 = { path = "../../libs/x86_64" }
core_io = "0.1"
bare-io = { version = "0.2.1", features = [ "alloc" ] }

[dependencies.log]
version = "0.4.8"
Expand Down
4 changes: 2 additions & 2 deletions applications/app_io/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ extern crate spin;
extern crate keycodes_ascii;
extern crate libterm;
extern crate serial_port;
extern crate core_io;
extern crate bare_io;
extern crate window_manager;

use stdio::{StdioReader, StdioWriter, KeyEventReadGuard,
Expand Down Expand Up @@ -318,7 +318,7 @@ macro_rules! print {
}

use core::fmt;
use core_io::Write;
use bare_io::Write;
/// Converts the given `core::fmt::Arguments` to a `String` and enqueues the string into the correct
/// terminal print-producer
pub fn print_to_stdout_args(fmt_args: fmt::Arguments) {
Expand Down
2 changes: 1 addition & 1 deletion applications/cat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build = "../../build.rs"

[dependencies]
getopts = "0.2.21"
core_io = "0.1"
bare-io = { version = "0.2.1", features = [ "alloc" ] }


[dependencies.log]
Expand Down
4 changes: 2 additions & 2 deletions applications/cat/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ extern crate task;
extern crate getopts;
extern crate path;
extern crate fs_node;
extern crate core_io;
extern crate bare_io;

use core::str;
use alloc::{
Expand All @@ -18,7 +18,7 @@ use alloc::{
use getopts::Options;
use path::Path;
use fs_node::FileOrDir;
use core_io::{Read, Write};
use bare_io::{Read, Write};


pub fn main(args: Vec<String>) -> isize {
Expand Down
2 changes: 1 addition & 1 deletion applications/immediate_input_echo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Zhiyao Ma <[email protected]>"]
build = "../../build.rs"

[dependencies]
core_io = "0.1"
bare-io = { version = "0.2.1", features = [ "alloc" ] }

[dependencies.stdio]
path = "../../libs/stdio"
Expand Down
4 changes: 2 additions & 2 deletions applications/immediate_input_echo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
#![no_std]

#[macro_use] extern crate alloc;
extern crate core_io;
extern crate bare_io;
extern crate stdio;
extern crate app_io;
#[macro_use] extern crate log;

use alloc::vec::Vec;
use alloc::string::String;
use core_io::{Read, Write};
use bare_io::{Read, Write};

pub fn main(_args: Vec<String>) -> isize {
if let Err(e) = run() {
Expand Down
2 changes: 1 addition & 1 deletion applications/input_echo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Zhiyao Ma <[email protected]>"]
build = "../../build.rs"

[dependencies]
core_io = "0.1"
bare-io = { version = "0.2.1", features = [ "alloc" ] }

[dependencies.app_io]
path = "../app_io"
Expand Down
4 changes: 2 additions & 2 deletions applications/input_echo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
#![no_std]

#[macro_use] extern crate alloc;
extern crate core_io;
extern crate bare_io;
extern crate app_io;
#[macro_use] extern crate log;

use alloc::vec::Vec;
use alloc::string::String;
use core_io::Write;
use bare_io::Write;

pub fn main(_args: Vec<String>) -> isize {
if let Err(e) = run() {
Expand Down
2 changes: 1 addition & 1 deletion applications/keyboard_echo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Zhiyao Ma <[email protected]>"]
build = "../../build.rs"

[dependencies]
core_io = "0.1"
bare-io = { version = "0.2.1", features = [ "alloc" ] }

[dependencies.scheduler]
path = "../../kernel/scheduler"
Expand Down
4 changes: 2 additions & 2 deletions applications/keyboard_echo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
#![no_std]

#[macro_use] extern crate alloc;
extern crate core_io;
extern crate bare_io;
extern crate scheduler;
extern crate app_io;
extern crate keycodes_ascii;
#[macro_use] extern crate log;

use core_io::Write;
use bare_io::Write;
use alloc::vec::Vec;
use alloc::string::String;
use keycodes_ascii::Keycode;
Expand Down
2 changes: 1 addition & 1 deletion applications/less/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ build = "../../build.rs"
[dependencies]
getopts = "0.2.21"
spin = "0.4.10"
core_io = "0.1"
bare-io = { version = "0.2.1", features = [ "alloc" ] }

[dependencies.task]
path = "../../kernel/task"
Expand Down
4 changes: 2 additions & 2 deletions applications/less/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extern crate libterm;
extern crate spin;
extern crate app_io;
extern crate stdio;
extern crate core_io;
extern crate bare_io;
#[macro_use] extern crate log;

use keycodes_ascii::{Keycode, KeyAction};
Expand All @@ -29,7 +29,7 @@ use alloc::collections::BTreeMap;
use libterm::Terminal;
use spin::Mutex;
use stdio::{StdioWriter, KeyEventQueueReader};
use core_io::Write;
use bare_io::Write;

/// The metadata for each line in the file.
struct LineSlice {
Expand Down
2 changes: 1 addition & 1 deletion applications/shell/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ build = "../../build.rs"
[dependencies]
spin = "0.4.10"
x86_64 = { path = "../../libs/x86_64" }
core_io = "0.1"
bare-io = { version = "0.2.1", features = [ "alloc" ] }

[dependencies.log]
version = "0.4.8"
Expand Down
4 changes: 2 additions & 2 deletions applications/shell/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ extern crate path;
extern crate root;
extern crate scheduler;
extern crate stdio;
extern crate core_io;
extern crate bare_io;
extern crate app_io;
extern crate fs_node;
extern crate terminal_print;
Expand All @@ -43,7 +43,7 @@ use core::mem;
use alloc::collections::BTreeMap;
use stdio::{Stdio, KeyEventQueue, KeyEventQueueReader, KeyEventQueueWriter,
StdioReader, StdioWriter};
use core_io::Write;
use bare_io::Write;
use core::ops::Deref;
use app_io::{IoStreams, IoControlFlags};
use fs_node::FileOrDir;
Expand Down
1 change: 0 additions & 1 deletion applications/test_restartable/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
//! of graceful exit, panic and exceptions.
#![no_std]
#![feature(asm)]

#[macro_use] extern crate log;
#[macro_use] extern crate terminal_print;
Expand Down
4 changes: 2 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LABEL [email protected]


# These build args are required.
# RUSTC_VERSION is the Rust version and build date: "nightly-2019-10-17"
# RUSTC_VERSION is the Rust version and build date, e.g., "nightly-2019-10-17"
# USER is the current user's name: "kevin"
# UID is that same user's id: "1000"
# GID is that same user's group id: "1000"
Expand Down Expand Up @@ -65,4 +65,4 @@ ENV PATH="$HOME/.cargo/bin:${PATH}"
RUN rustup toolchain install ${RUSTC_VERSION} && rustup component add rust-src

# Install xargo (for cross compilation)
RUN cargo install --vers 0.3.17 xargo
RUN cargo install --vers 0.3.22 xargo
1 change: 0 additions & 1 deletion kernel/acpi/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Code to parse the ACPI tables, based off of Redox.
#![no_std]
#![feature(const_fn)]
#![feature(asm)]

#![allow(dead_code)] // to suppress warnings for unused functions/methods
#![allow(safe_packed_borrows)] // temporary, just to suppress unsafe packed borrows
Expand Down
1 change: 0 additions & 1 deletion kernel/ap_start/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
//!
#![no_std]
#![feature(asm)]

#[macro_use] extern crate alloc;
#[macro_use] extern crate log;
Expand Down
2 changes: 1 addition & 1 deletion kernel/block_allocator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ name = "block_allocator"
version = "0.1.0"

[dependencies.linked_list_allocator]
version = "0.6.3"
version = "0.8.6"
default-features = false
1 change: 1 addition & 0 deletions kernel/block_allocator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#![feature(const_fn)]
#![feature(const_in_array_repeat_expressions)]
#![feature(const_mut_refs)]
#![no_std]

extern crate alloc;
Expand Down
2 changes: 0 additions & 2 deletions kernel/captain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
//!
#![no_std]
#![feature(asm)]


extern crate alloc;
#[macro_use] extern crate log;
Expand Down
Loading

0 comments on commit 31937ac

Please sign in to comment.