Allocate a very small 4K stack for the other CPUs, increase count to 4
This commit is contained in:
parent
979d80a8c7
commit
b0797a5d8a
4 changed files with 29 additions and 18 deletions
|
@ -3,6 +3,8 @@
|
|||
/// It must create the IDT with the correct entries, those entries are
|
||||
/// defined in other files inside of the `arch` module
|
||||
|
||||
use core::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering};
|
||||
|
||||
use acpi;
|
||||
use allocator::{HEAP_START, HEAP_SIZE};
|
||||
use externs::memset;
|
||||
|
@ -16,6 +18,8 @@ static BSS_TEST_ZERO: usize = 0;
|
|||
/// Test of non-zero values in BSS.
|
||||
static BSS_TEST_NONZERO: usize = 0xFFFFFFFFFFFFFFFF;
|
||||
|
||||
static BSP_READY: AtomicBool = ATOMIC_BOOL_INIT;
|
||||
|
||||
extern {
|
||||
/// Kernel main function
|
||||
fn kmain() -> !;
|
||||
|
@ -46,6 +50,8 @@ pub unsafe extern fn kstart() -> ! {
|
|||
debug_assert_eq!(BSS_TEST_NONZERO, 0xFFFFFFFFFFFFFFFF);
|
||||
}
|
||||
|
||||
BSP_READY.store(false, Ordering::SeqCst);
|
||||
|
||||
// Set up GDT
|
||||
gdt::init();
|
||||
|
||||
|
@ -72,6 +78,13 @@ pub unsafe extern fn kstart() -> ! {
|
|||
for page in Page::range_inclusive(heap_start_page, heap_end_page) {
|
||||
active_table.map(page, entry::WRITABLE | entry::NO_EXECUTE);
|
||||
}
|
||||
|
||||
BSP_READY.store(true, Ordering::SeqCst);
|
||||
}
|
||||
|
||||
|
||||
for _i in 0..10 {
|
||||
print!("BSP\n");
|
||||
}
|
||||
|
||||
kmain();
|
||||
|
@ -98,6 +111,14 @@ pub unsafe extern fn kstart_ap(stack_start: usize, stack_end: usize) -> ! {
|
|||
}
|
||||
}
|
||||
|
||||
while ! BSP_READY.load(Ordering::SeqCst) {
|
||||
asm!("pause" : : : : "intel", "volatile");
|
||||
}
|
||||
|
||||
for _i in 0..10 {
|
||||
print!("AP\n");
|
||||
}
|
||||
|
||||
loop {
|
||||
asm!("hlt");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue