Pass page table of BSP to AP
This commit is contained in:
parent
6560cc653b
commit
ea8b9189a3
|
@ -67,13 +67,15 @@ pub fn init_sdt(sdt: &'static Sdt, active_table: &mut ActivePageTable) {
|
||||||
|
|
||||||
let ap_ready = TRAMPOLINE as *mut u64;
|
let ap_ready = TRAMPOLINE as *mut u64;
|
||||||
let ap_cpu_id = unsafe { ap_ready.offset(1) };
|
let ap_cpu_id = unsafe { ap_ready.offset(1) };
|
||||||
let ap_stack_start = unsafe { ap_ready.offset(2) };
|
let ap_page_table = unsafe { ap_ready.offset(2) };
|
||||||
let ap_stack_end = unsafe { ap_ready.offset(3) };
|
let ap_stack_start = unsafe { ap_ready.offset(3) };
|
||||||
let ap_code = unsafe { ap_ready.offset(4) };
|
let ap_stack_end = unsafe { ap_ready.offset(4) };
|
||||||
|
let ap_code = unsafe { ap_ready.offset(5) };
|
||||||
|
|
||||||
// Set the ap_ready to 0, volatile
|
// Set the ap_ready to 0, volatile
|
||||||
unsafe { atomic_store(ap_ready, 0) };
|
unsafe { atomic_store(ap_ready, 0) };
|
||||||
unsafe { atomic_store(ap_cpu_id, ap_local_apic.id as u64) };
|
unsafe { atomic_store(ap_cpu_id, ap_local_apic.id as u64) };
|
||||||
|
unsafe { atomic_store(ap_page_table, active_table.address() as u64) };
|
||||||
unsafe { atomic_store(ap_stack_start, stack_start 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_stack_end, stack_end as u64) };
|
||||||
unsafe { atomic_store(ap_code, kstart_ap as u64) };
|
unsafe { atomic_store(ap_code, kstart_ap as u64) };
|
||||||
|
|
|
@ -134,7 +134,7 @@ pub unsafe extern fn kstart() -> ! {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Entry to rust for an AP
|
/// Entry to rust for an AP
|
||||||
pub unsafe extern fn kstart_ap(cpu_id: usize, stack_start: usize, stack_end: usize) -> ! {
|
pub unsafe extern fn kstart_ap(cpu_id: usize, page_table: usize, stack_start: usize, stack_end: usize) -> ! {
|
||||||
{
|
{
|
||||||
assert_eq!(BSS_TEST_ZERO, 0);
|
assert_eq!(BSS_TEST_ZERO, 0);
|
||||||
assert_eq!(DATA_TEST_NONZERO, 0xFFFFFFFFFFFFFFFF);
|
assert_eq!(DATA_TEST_NONZERO, 0xFFFFFFFFFFFFFFFF);
|
||||||
|
|
Loading…
Reference in a new issue