Преглед на файлове

change(smp): use FDT.harts() in riscv64 bootstrap_smp

greatbridf преди 7 месеца
родител
ревизия
66f509c5d6
променени са 1 файла, в които са добавени 2 реда и са изтрити 10 реда
  1. 2 10
      crates/eonix_hal/src/arch/riscv64/bootstrap.rs

+ 2 - 10
crates/eonix_hal/src/arch/riscv64/bootstrap.rs

@@ -253,13 +253,9 @@ fn get_ap_start_addr() -> usize {
 
 fn bootstrap_smp(alloc: impl Allocator, page_alloc: &RefCell<BasicPageAlloc>) {
     let local_hart_id = CPU::local().cpuid();
-    let hart_count = FDT.hart_count();
     let mut ap_count = 0;
 
-    for current_hart_id in 0..hart_count {
-        if current_hart_id == local_hart_id {
-            continue;
-        }
+    for hart_id in FDT.harts().filter(|&id| id != local_hart_id) {
         let stack_range = {
             let page_alloc = BasicPageAllocRef::new(&page_alloc);
             let ap_stack = Page::alloc_order_in(4, page_alloc);
@@ -284,11 +280,7 @@ fn bootstrap_smp(alloc: impl Allocator, page_alloc: &RefCell<BasicPageAlloc>) {
         }
 
         unsafe {
-            hart_start(
-                current_hart_id,
-                PhysicalAddress::new(get_ap_start_addr()),
-                0,
-            );
+            hart_start(hart_id, PhysicalAddress::new(get_ap_start_addr()), 0);
         }
 
         while AP_COUNT.load(Ordering::Acquire) == ap_count {