Cleanup PML4 entries, pass correct cpu ID to trampoline

This commit is contained in:
Jeremy Soller 2016-09-12 13:06:00 -06:00
parent 1298e38ed8
commit 11eddfecd1
6 changed files with 42 additions and 74 deletions

View file

@ -66,12 +66,14 @@ pub fn init_sdt(sdt: &'static Sdt, active_table: &mut ActivePageTable) {
let stack_end = allocate_frame().expect("no more frames in acpi stack_end").start_address().get() + 4096;
let ap_ready = TRAMPOLINE as *mut u64;
let ap_stack_start = unsafe { ap_ready.offset(1) };
let ap_stack_end = unsafe { ap_ready.offset(2) };
let ap_code = unsafe { ap_ready.offset(3) };
let ap_cpu_id = unsafe { ap_ready.offset(1) };
let ap_stack_start = unsafe { ap_ready.offset(2) };
let ap_stack_end = unsafe { ap_ready.offset(3) };
let ap_code = unsafe { ap_ready.offset(4) };
// 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_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) };