Update for new Rust
This commit is contained in:
2
rmm
2
rmm
Submodule rmm updated: 81b03cc693...7aeb9f0ac8
@@ -6,7 +6,7 @@ use crate::paging::{KernelMapper, Page, PageFlags, PhysicalAddress, RmmA, RmmArc
|
||||
use super::sdt::Sdt;
|
||||
use super::find_sdt;
|
||||
|
||||
use core::intrinsics::{atomic_load, atomic_store};
|
||||
use core::intrinsics::{atomic_load_seqcst, atomic_store_seqcst};
|
||||
use core::sync::atomic::Ordering;
|
||||
|
||||
use crate::device::local_apic::LOCAL_APIC;
|
||||
@@ -73,7 +73,7 @@ impl Madt {
|
||||
// Write trampoline, make sure TRAMPOLINE page is free for use
|
||||
for i in 0..TRAMPOLINE_DATA.len() {
|
||||
unsafe {
|
||||
atomic_store((TRAMPOLINE as *mut u8).add(i), TRAMPOLINE_DATA[i]);
|
||||
atomic_store_seqcst((TRAMPOLINE as *mut u8).add(i), TRAMPOLINE_DATA[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,12 +99,12 @@ impl Madt {
|
||||
let ap_code = unsafe { ap_ready.offset(5) };
|
||||
|
||||
// Set the ap_ready to 0, volatile
|
||||
unsafe { atomic_store(ap_ready, 0) };
|
||||
unsafe { atomic_store(ap_cpu_id, ap_local_apic.id as u64) };
|
||||
unsafe { atomic_store(ap_page_table, page_table_physaddr as u64) };
|
||||
unsafe { atomic_store(ap_stack_start, stack_start as u64) };
|
||||
unsafe { atomic_store(ap_stack_end, stack_end as u64) };
|
||||
unsafe { atomic_store(ap_code, kstart_ap as u64) };
|
||||
unsafe { atomic_store_seqcst(ap_ready, 0) };
|
||||
unsafe { atomic_store_seqcst(ap_cpu_id, ap_local_apic.id as u64) };
|
||||
unsafe { atomic_store_seqcst(ap_page_table, page_table_physaddr as u64) };
|
||||
unsafe { atomic_store_seqcst(ap_stack_start, stack_start as u64) };
|
||||
unsafe { atomic_store_seqcst(ap_stack_end, stack_end as u64) };
|
||||
unsafe { atomic_store_seqcst(ap_code, kstart_ap as u64) };
|
||||
AP_READY.store(false, Ordering::SeqCst);
|
||||
|
||||
print!(" AP {}:", ap_local_apic.id);
|
||||
@@ -139,7 +139,7 @@ impl Madt {
|
||||
|
||||
// Wait for trampoline ready
|
||||
print!(" Wait...");
|
||||
while unsafe { atomic_load(ap_ready) } == 0 {
|
||||
while unsafe { atomic_load_seqcst(ap_ready) } == 0 {
|
||||
interrupt::pause();
|
||||
}
|
||||
print!(" Trampoline...");
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
// Ensure that all must_use results are used
|
||||
#![deny(unused_must_use)]
|
||||
|
||||
#![feature(alloc_error_handler)]
|
||||
#![feature(allocator_api)]
|
||||
#![feature(arbitrary_self_types)]
|
||||
#![feature(array_chunks)]
|
||||
|
||||
@@ -38,7 +38,7 @@ pub extern "C" fn rust_begin_unwind(info: &PanicInfo) -> ! {
|
||||
}
|
||||
}
|
||||
|
||||
#[lang = "oom"]
|
||||
#[alloc_error_handler]
|
||||
#[no_mangle]
|
||||
#[allow(improper_ctypes_definitions)] // Layout is not repr(C)
|
||||
pub extern fn rust_oom(_layout: Layout) -> ! {
|
||||
|
||||
@@ -90,13 +90,13 @@ pub fn futex(addr: usize, op: usize, val: usize, val2: usize, addr2: usize) -> R
|
||||
if addr % 4 != 0 {
|
||||
return Err(Error::new(EINVAL));
|
||||
}
|
||||
(u64::from(unsafe { intrinsics::atomic_load::<u32>(addr as *const u32) }), u64::from(val as u32))
|
||||
(u64::from(unsafe { intrinsics::atomic_load_seqcst::<u32>(addr as *const u32) }), u64::from(val as u32))
|
||||
} else {
|
||||
// op == FUTEX_WAIT64
|
||||
if addr % 8 != 0 {
|
||||
return Err(Error::new(EINVAL));
|
||||
}
|
||||
(unsafe { intrinsics::atomic_load::<u64>(addr as *const u64) }, val as u64)
|
||||
(unsafe { intrinsics::atomic_load_seqcst::<u64>(addr as *const u64) }, val as u64)
|
||||
};
|
||||
if fetched != expected {
|
||||
return Err(Error::new(EAGAIN));
|
||||
|
||||
Reference in New Issue
Block a user