Fix kernel stack sizes, other arches.
This commit is contained in:
+3
-3
@@ -2,7 +2,7 @@ use core::mem;
|
||||
|
||||
use crate::{
|
||||
memory::{allocate_p2frame, Frame},
|
||||
paging::{KernelMapper, Page, PageFlags, PhysicalAddress, RmmA, RmmArch, VirtualAddress},
|
||||
paging::{KernelMapper, Page, PageFlags, PhysicalAddress, RmmA, RmmArch, VirtualAddress, PAGE_SIZE},
|
||||
};
|
||||
|
||||
use super::{find_sdt, sdt::Sdt};
|
||||
@@ -92,12 +92,12 @@ impl Madt {
|
||||
CPU_COUNT.fetch_add(1, Ordering::SeqCst);
|
||||
|
||||
// Allocate a stack
|
||||
let stack_start = allocate_p2frame(6)
|
||||
let stack_start = allocate_p2frame(4)
|
||||
.expect("no more frames in acpi stack_start")
|
||||
.start_address()
|
||||
.data()
|
||||
+ crate::PHYS_OFFSET;
|
||||
let stack_end = stack_start + 64 * 4096;
|
||||
let stack_end = stack_start + (PAGE_SIZE << 4);
|
||||
|
||||
let ap_ready = (TRAMPOLINE + 8) as *mut u64;
|
||||
let ap_cpu_id = unsafe { ap_ready.add(1) };
|
||||
|
||||
@@ -15,7 +15,7 @@ impl PercpuBlock {
|
||||
|
||||
#[cold]
|
||||
pub unsafe fn init(cpu_id: LogicalCpuId) {
|
||||
let frame = crate::memory::allocate_frames(1).expect("failed to allocate percpu memory");
|
||||
let frame = crate::memory::allocate_frame().expect("failed to allocate percpu memory");
|
||||
let virt = RmmA::phys_to_virt(frame.start_address()).data() as *mut PercpuBlock;
|
||||
|
||||
virt.write(PercpuBlock::init(cpu_id));
|
||||
|
||||
+2
-1
@@ -181,7 +181,8 @@ pub unsafe fn init() {
|
||||
|
||||
/// Initialize GDT and configure percpu.
|
||||
pub unsafe fn init_paging(stack_offset: usize, cpu_id: LogicalCpuId) {
|
||||
let pcr_frame = crate::memory::allocate_frames(mem::size_of::<ProcessorControlRegion>().div_ceil(PAGE_SIZE)).expect("failed to allocate PCR frame");
|
||||
let alloc_order = mem::size_of::<ProcessorControlRegion>().div_ceil(PAGE_SIZE).next_power_of_two().trailing_zeros();
|
||||
let pcr_frame = crate::memory::allocate_p2frame(alloc_order).expect("failed to allocate PCR frame");
|
||||
let pcr =
|
||||
&mut *(RmmA::phys_to_virt(pcr_frame.start_address()).data() as *mut ProcessorControlRegion);
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ use x86::{
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
use crate::interrupt::irq::{__generic_interrupts_end, __generic_interrupts_start};
|
||||
use crate::{interrupt::*, ipi::IpiKind, cpu_set::LogicalCpuId};
|
||||
use crate::{cpu_set::LogicalCpuId, interrupt::*, ipi::IpiKind, paging::PAGE_SIZE};
|
||||
|
||||
use spin::RwLock;
|
||||
|
||||
@@ -228,8 +228,8 @@ pub unsafe fn init_generic(cpu_id: LogicalCpuId, idt: &mut Idt) {
|
||||
let index = 1_u8;
|
||||
|
||||
// Allocate 64 KiB of stack space for the backup stack.
|
||||
const BACKUP_STACK_SIZE: usize = 4096 << 6;
|
||||
let frames = crate::memory::allocate_p2frame(6)
|
||||
const BACKUP_STACK_SIZE: usize = PAGE_SIZE << 4;
|
||||
let frames = crate::memory::allocate_p2frame(4)
|
||||
.expect("failed to allocate pages for backup interrupt stack");
|
||||
|
||||
use crate::paging::{RmmA, RmmArch};
|
||||
|
||||
Reference in New Issue
Block a user