Commit 60390263 authored by 4lDO2's avatar 4lDO2 🖖
Browse files

Merge branch 'update_toolchain' into 'master'

Update toolchain

See merge request !179
parents d3cf4db4 ecfcedb9
......@@ -3,3 +3,7 @@ rustflags = [
# Kernel should preserve floating-point registers
"-Csoft-float",
]
[unstable]
build-std = ["core", "alloc", "compiler_builtins"]
build-std-features = ["panic-unwind"]
......@@ -26,9 +26,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "cc"
version = "1.0.67"
version = "1.0.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd"
checksum = "4a72c244c1ff497a746a7e1fb3d14bd08420ecda70c8f25c7112f2781652d787"
[[package]]
name = "cfg-if"
......@@ -64,7 +64,7 @@ dependencies = [
"cc",
"fdt",
"goblin",
"linked_list_allocator 0.8.11",
"linked_list_allocator 0.9.0",
"log",
"paste",
"raw-cpuid 8.1.2",
......@@ -73,7 +73,7 @@ dependencies = [
"rustc-cfg",
"rustc-demangle",
"slab_allocator",
"spin 0.5.2",
"spin 0.9.0",
"x86",
]
......@@ -88,18 +88,18 @@ dependencies = [
[[package]]
name = "linked_list_allocator"
version = "0.8.11"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "822add9edb1860698b79522510da17bef885171f75aa395cff099d770c609c24"
checksum = "d0b725207570aa16096962d0b20c79f8a543df2280bd3c903022b9b0b4d7ea68"
dependencies = [
"spinning_top",
]
[[package]]
name = "lock_api"
version = "0.3.4"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75"
checksum = "0382880606dff6d15c9476c416d18690b72742aa7b605bb6dd6ec9030fbf07eb"
dependencies = [
"scopeguard",
]
......@@ -115,22 +115,9 @@ dependencies = [
[[package]]
name = "paste"
version = "0.1.18"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880"
dependencies = [
"paste-impl",
"proc-macro-hack",
]
[[package]]
name = "paste-impl"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6"
dependencies = [
"proc-macro-hack",
]
checksum = "acbf547ad0c65e31259204bd90935776d1c693cec2f4ff7abb7a1bbbd40dfe58"
[[package]]
name = "plain"
......@@ -138,12 +125,6 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6"
[[package]]
name = "proc-macro-hack"
version = "0.5.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
[[package]]
name = "raw-cpuid"
version = "7.0.4"
......@@ -168,7 +149,7 @@ dependencies = [
[[package]]
name = "redox_syscall"
version = "0.2.8"
version = "0.2.9"
dependencies = [
"bitflags",
]
......@@ -245,11 +226,20 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
[[package]]
name = "spin"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b87bbf98cb81332a56c1ee8929845836f85e8ddd693157c30d76660196014478"
dependencies = [
"lock_api",
]
[[package]]
name = "spinning_top"
version = "0.1.1"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "047031d6df5f5ae0092c97aa4f6bb04cfc9c081b4cd4cb9cdb38657994279a00"
checksum = "75adad84ee84b521fb2cca2d4fd0f1dab1d8d026bda3c5bea4ca63b5f9f9293c"
dependencies = [
"lock_api",
]
......
......@@ -14,14 +14,14 @@ cc = "1.0.3"
rustc-cfg = "0.3.0"
[dependencies]
bitfield = "0.13.1"
bitflags = "1.2.1"
linked_list_allocator = "0.8.4"
bitfield = "0.13.2"
linked_list_allocator = "0.9.0"
log = { version = "0.4" }
redox_syscall = { path = "syscall" }
slab_allocator = { path = "slab_allocator", optional = true }
spin = "0.5.2"
paste = "0.1.18"
spin = "0.9"
paste = "1"
rmm = { path = "rmm", default-features = false }
[dependencies.goblin]
......@@ -59,8 +59,5 @@ slab = ["slab_allocator"]
# Kernel doesn't yet work great with debug mode :(
opt-level = 3
# LTO fixes some duplicate symbols of memcpy/memmove/etc
lto = true
[profile.release]
lto = true
Subproject commit c81c4de223583b23d2f91f0978e378ef1dc3676f
Subproject commit c66956ca2ac1b4df3904afbafe53321a4b6c50af
......@@ -202,9 +202,7 @@ impl InterruptErrorStack {
macro_rules! intel_asm {
($($strings:expr,)+) => {
global_asm!(concat!(
".intel_syntax noprefix\n",
$($strings),+,
".att_syntax prefix\n",
));
};
}
......@@ -215,6 +213,8 @@ macro_rules! function {
".global ", stringify!($name), "\n",
".type ", stringify!($name), ", @function\n",
".section .text.", stringify!($name), ", \"ax\", @progbits\n",
// Align the function to a 16-byte boundary, padding with multi-byte NOPs.
".p2align 4,,15\n",
stringify!($name), ":\n",
$($body),+,
".size ", stringify!($name), ", . - ", stringify!($name), "\n",
......@@ -325,15 +325,15 @@ macro_rules! interrupt_stack {
($name:ident, super_atomic: $is_super_atomic:ident!, |$stack:ident| $code:block) => {
paste::item! {
#[no_mangle]
unsafe extern "C" fn [<__interrupt_ $name>](stack: *mut $crate::arch::x86_64::interrupt::InterruptStack) {
// This inner function is needed because macros are buggy:
// https://github.com/dtolnay/paste/issues/7
#[inline(always)]
unsafe fn inner($stack: &mut $crate::arch::x86_64::interrupt::InterruptStack) {
unsafe extern "C" fn [<__interrupt_ $name>]($stack: &mut $crate::arch::x86_64::interrupt::InterruptStack) {
let _guard = $crate::ptrace::set_process_regs($stack);
// TODO: Force the declarations to specify unsafe?
#[allow(unused_unsafe)]
unsafe {
$code
}
let _guard = $crate::ptrace::set_process_regs(stack);
inner(&mut *stack);
}
function!($name => {
......@@ -404,15 +404,13 @@ macro_rules! interrupt_error {
($name:ident, |$stack:ident| $code:block) => {
paste::item! {
#[no_mangle]
unsafe extern "C" fn [<__interrupt_ $name>](stack: *mut $crate::arch::x86_64::interrupt::handler::InterruptErrorStack) {
// This inner function is needed because macros are buggy:
// https://github.com/dtolnay/paste/issues/7
#[inline(always)]
unsafe fn inner($stack: &mut $crate::arch::x86_64::interrupt::handler::InterruptErrorStack) {
unsafe extern "C" fn [<__interrupt_ $name>]($stack: &mut $crate::arch::x86_64::interrupt::handler::InterruptErrorStack) {
let _guard = $crate::ptrace::set_process_regs(&mut $stack.inner);
#[allow(unused_unsafe)]
unsafe {
$code
}
let _guard = $crate::ptrace::set_process_regs(&mut (*stack).inner);
inner(&mut *stack);
}
function!($name => {
......
......@@ -73,10 +73,6 @@ macro_rules! int_like {
$new_type_name::from(self.container.swap(val.into(), order))
}
#[allow(dead_code)]
pub fn compare_and_swap(&self, current: $new_type_name, new: $new_type_name, order: ::core::sync::atomic::Ordering) -> $new_type_name {
$new_type_name::from(self.container.compare_and_swap(current.into(), new.into(), order))
}
#[allow(dead_code)]
pub fn compare_exchange(&self, current: $new_type_name, new: $new_type_name, success: ::core::sync::atomic::Ordering, failure: ::core::sync::atomic::Ordering) -> ::core::result::Result<$new_type_name, $new_type_name> {
match self.container.compare_exchange(current.into(), new.into(), success, failure) {
Ok(result) => Ok($new_type_name::from(result)),
......
......@@ -216,12 +216,14 @@ pub unsafe extern "C" fn switch_to(_prev: &mut Context, _next: &mut Context) {
// the calling function, `context::switch`. Thus, we have to execute this Rust hook by
// ourselves, which will unlock the contexts before the later switch.
call {switch_hook}
// Note that switch_finish_hook will be responsible for executing `ret`.
jmp {switch_hook}
",
true = const(AbiCompatBool::True as u8),
switch_hook = sym crate::context::switch_finish_hook,
options(noreturn),
);
}
......@@ -275,8 +277,10 @@ unsafe extern fn signal_handler_wrapper() {
pop rcx
pop rax
add rsp, 16
ret
",
inner = sym inner,
options(noreturn),
);
}
......@@ -78,7 +78,8 @@ pub unsafe extern "C" fn switch_finish_hook() {
prev_lock.force_write_unlock();
next_lock.force_write_unlock();
} else {
panic!("SWITCH_RESULT was not set");
// TODO: unreachable_unchecked()?
core::intrinsics::abort();
}
arch::CONTEXT_SWITCH_LOCK.store(false, Ordering::SeqCst);
}
......@@ -97,11 +98,12 @@ unsafe fn runnable(context: &Context, cpu_id: usize) -> bool {
///
/// Do not call this while holding locks!
pub unsafe fn switch() -> bool {
// TODO: Better memory orderings?
//set PIT Interrupt counter to 0, giving each process same amount of PIT ticks
let ticks = PIT_TICKS.swap(0, Ordering::SeqCst);
// Set the global lock to avoid the unsafe operations below from causing issues
while arch::CONTEXT_SWITCH_LOCK.compare_and_swap(false, true, Ordering::SeqCst) {
while arch::CONTEXT_SWITCH_LOCK.compare_exchange_weak(false, true, Ordering::SeqCst, Ordering::Relaxed).is_err() {
interrupt::pause();
}
......
......@@ -47,7 +47,6 @@
#![cfg_attr(target_arch = "aarch64", feature(llvm_asm))] // TODO: Rewrite using asm!
#![feature(concat_idents)]
#![feature(const_btree_new)]
#![feature(const_fn)]
#![feature(core_intrinsics)]
#![feature(global_asm)]
#![feature(integer_atomics)]
......
......@@ -54,7 +54,7 @@ pub fn register_kstop() -> bool {
*KSTOP_FLAG.lock() = true;
let mut waiters_awoken = KSTOP_WAITCOND.notify();
if let Some(&acpi_scheme) = SCHEME_ID.r#try() {
if let Some(&acpi_scheme) = SCHEME_ID.get() {
let handles = HANDLES.read();
for (&fd, _) in handles.iter().filter(|(_, handle)| handle.kind == HandleKind::ShutdownPipe) {
......@@ -88,7 +88,7 @@ impl AcpiScheme {
data_init = true;
let rsdt_or_xsdt = RXSDT_ENUM
.r#try()
.get()
.expect("expected RXSDT_ENUM to be initialized before AcpiScheme");
let table = match rsdt_or_xsdt {
......@@ -168,7 +168,7 @@ impl Scheme for AcpiScheme {
match handle.kind {
HandleKind::Rxsdt => {
let data = DATA.r#try().ok_or(Error::new(EBADFD))?;
let data = DATA.get().ok_or(Error::new(EBADFD))?;
stat.st_mode = MODE_FILE;
stat.st_size = data.len().try_into().unwrap_or(u64::max_value());
......@@ -194,7 +194,7 @@ impl Scheme for AcpiScheme {
}
let file_len = match handle.kind {
HandleKind::Rxsdt => DATA.r#try().ok_or(Error::new(EBADFD))?.len(),
HandleKind::Rxsdt => DATA.get().ok_or(Error::new(EBADFD))?.len(),
HandleKind::ShutdownPipe => 1,
HandleKind::TopLevel => TOPLEVEL_CONTENTS.len(),
};
......@@ -251,7 +251,7 @@ impl Scheme for AcpiScheme {
handle.offset = 1;
return Ok(1);
}
HandleKind::Rxsdt => DATA.r#try().ok_or(Error::new(EBADFD))?,
HandleKind::Rxsdt => DATA.get().ok_or(Error::new(EBADFD))?,
HandleKind::TopLevel => TOPLEVEL_CONTENTS,
};
......
Subproject commit 0b51bddd288dac97c9c7fc04bca9f16ad3b93bd2
Subproject commit 52fcd238db87354b6556eac9b05bb8ab2658426a
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment