diff --git a/rust-toolchain b/rust-toolchain deleted file mode 100644 index 9eed51006fc6a182f0c8aa1eb88acfad9f5e869a..0000000000000000000000000000000000000000 --- a/rust-toolchain +++ /dev/null @@ -1 +0,0 @@ -nightly-2022-03-18 diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000000000000000000000000000000000000..87f6fe713d75640775c9eb10ffb4dfa7ecd01752 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "nightly-2023-01-21" +components = ["rust-src"] diff --git a/src/lib.rs b/src/lib.rs index f03ce4c08b43a95c415a8a37dff6bbc048388a78..e545fd69734a782f954a230783737590b16b720c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,6 +2,7 @@ #![allow(non_camel_case_types)] #![allow(non_upper_case_globals)] #![allow(unused_variables)] +#![feature(alloc_error_handler)] #![feature(allocator_api)] #![feature(array_chunks)] #![feature(asm_const)] @@ -19,6 +20,8 @@ #![allow(clippy::derive_hash_xor_eq)] #![allow(clippy::eval_order_dependence)] #![allow(clippy::mut_from_ref)] +// TODO: fix these +#![warn(unaligned_references)] #[macro_use] extern crate alloc; @@ -87,7 +90,7 @@ pub extern "C" fn rust_begin_unwind(pi: &::core::panic::PanicInfo) -> ! { pub extern "C" fn rust_eh_personality() {} #[cfg(not(test))] -#[lang = "oom"] +#[alloc_error_handler] #[linkage = "weak"] #[no_mangle] pub extern "C" fn rust_oom(layout: ::core::alloc::Layout) -> ! { diff --git a/src/platform/pte.rs b/src/platform/pte.rs index 7519150c61f460dde5cd1bc74fad9499a97a08d4..13bf4bbd48959433d9c52cebc89eddeb9ef9459e 100644 --- a/src/platform/pte.rs +++ b/src/platform/pte.rs @@ -384,7 +384,7 @@ pub unsafe extern "C" fn pte_osSemaphoreCancellablePend( #[no_mangle] pub unsafe extern "C" fn pte_osAtomicExchange(ptarg: *mut c_int, val: c_int) -> c_int { - intrinsics::atomic_xchg(ptarg, val) + intrinsics::atomic_xchg_seqcst(ptarg, val) } #[no_mangle] @@ -393,22 +393,22 @@ pub unsafe extern "C" fn pte_osAtomicCompareExchange( exchange: c_int, comp: c_int, ) -> c_int { - intrinsics::atomic_cxchg(pdest, comp, exchange).0 + intrinsics::atomic_cxchg_seqcst_seqcst(pdest, comp, exchange).0 } #[no_mangle] pub unsafe extern "C" fn pte_osAtomicExchangeAdd(pAppend: *mut c_int, value: c_int) -> c_int { - intrinsics::atomic_xadd(pAppend, value) + intrinsics::atomic_xadd_seqcst(pAppend, value) } #[no_mangle] pub unsafe extern "C" fn pte_osAtomicDecrement(pdest: *mut c_int) -> c_int { - intrinsics::atomic_xadd(pdest, -1) - 1 + intrinsics::atomic_xadd_seqcst(pdest, -1) - 1 } #[no_mangle] pub unsafe extern "C" fn pte_osAtomicIncrement(pdest: *mut c_int) -> c_int { - intrinsics::atomic_xadd(pdest, 1) + 1 + intrinsics::atomic_xadd_seqcst(pdest, 1) + 1 } #[no_mangle]