mirror of
https://github.com/rcore-os/rCore.git
synced 2024-11-22 08:06:17 +04:00
Forcing hart BOOT_HART_ID to initialize everything.
This commit is contained in:
parent
95f0cd5b6c
commit
465d26a7c6
@ -36,8 +36,6 @@ fn start_all_harts() {
|
|||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn rust_main(hartid: usize, device_tree_paddr: usize) -> ! {
|
pub extern "C" fn rust_main(hartid: usize, device_tree_paddr: usize) -> ! {
|
||||||
let device_tree_vaddr = phys_to_virt(device_tree_paddr);
|
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
cpu::set_cpu_id(hartid);
|
cpu::set_cpu_id(hartid);
|
||||||
}
|
}
|
||||||
@ -46,15 +44,15 @@ pub extern "C" fn rust_main(hartid: usize, device_tree_paddr: usize) -> ! {
|
|||||||
.compare_exchange(false, true, Ordering::SeqCst, Ordering::SeqCst)
|
.compare_exchange(false, true, Ordering::SeqCst, Ordering::SeqCst)
|
||||||
.is_ok()
|
.is_ok()
|
||||||
{
|
{
|
||||||
LOTTERY_HART_ID.store(hartid, Ordering::SeqCst);
|
DEVICE_TREE_PADDR.store(device_tree_paddr, Ordering::SeqCst);
|
||||||
start_all_harts();
|
start_all_harts();
|
||||||
}
|
}
|
||||||
let main_hart = LOTTERY_HART_ID.load(Ordering::SeqCst);
|
|
||||||
if hartid != main_hart {
|
if hartid != BOOT_HART_ID {
|
||||||
while !AP_CAN_INIT.load(Ordering::Relaxed) {}
|
while !AP_CAN_INIT.load(Ordering::Relaxed) {}
|
||||||
others_main(hartid);
|
others_main(hartid);
|
||||||
}
|
}
|
||||||
|
let device_tree_vaddr = phys_to_virt(DEVICE_TREE_PADDR.load(Ordering::SeqCst));
|
||||||
unsafe {
|
unsafe {
|
||||||
memory::clear_bss();
|
memory::clear_bss();
|
||||||
}
|
}
|
||||||
@ -93,7 +91,7 @@ fn others_main(hartid: usize) -> ! {
|
|||||||
|
|
||||||
static AP_CAN_INIT: AtomicBool = AtomicBool::new(false);
|
static AP_CAN_INIT: AtomicBool = AtomicBool::new(false);
|
||||||
static FIRST_HART: AtomicBool = AtomicBool::new(false);
|
static FIRST_HART: AtomicBool = AtomicBool::new(false);
|
||||||
static LOTTERY_HART_ID: AtomicUsize = AtomicUsize::new(0);
|
static DEVICE_TREE_PADDR: AtomicUsize = AtomicUsize::new(0);
|
||||||
|
|
||||||
#[cfg(not(feature = "board_u540"))]
|
#[cfg(not(feature = "board_u540"))]
|
||||||
const BOOT_HART_ID: usize = 0;
|
const BOOT_HART_ID: usize = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user