Allocate AP stack linearly

This commit is contained in:
Jeremy Soller 2016-09-28 08:59:14 -06:00
parent 96ffbe38e8
commit 4331195693

View file

@ -5,7 +5,7 @@ use core::intrinsics::{atomic_load, atomic_store};
use core::sync::atomic::Ordering;
use interrupt;
use memory::{allocate_frame, Frame};
use memory::{allocate_frames, Frame};
use paging::{entry, ActivePageTable, Page, PhysicalAddress, VirtualAddress};
use start::{kstart_ap, AP_READY};
@ -59,11 +59,8 @@ pub fn init_sdt(sdt: &'static Sdt, active_table: &mut ActivePageTable) {
if ap_local_apic.flags & 1 == 1 {
// Allocate a stack
// TODO: Allocate contiguous
let stack_start = allocate_frame().expect("no more frames in acpi stack_start").start_address().get() + ::KERNEL_OFFSET;
for _i in 0..62 {
allocate_frame().expect("no more frames in acpi stack");
}
let stack_end = allocate_frame().expect("no more frames in acpi stack_end").start_address().get() + 4096 + ::KERNEL_OFFSET;
let stack_start = allocate_frames(64).expect("no more frames in acpi stack_start").start_address().get() + ::KERNEL_OFFSET;
let stack_end = stack_start + 64 * 4096;
let ap_ready = TRAMPOLINE as *mut u64;
let ap_cpu_id = unsafe { ap_ready.offset(1) };