Get the APs into rust code, set stack and page table in trampoline

This commit is contained in:
Jeremy Soller 2016-08-16 21:25:48 -06:00
parent a8948fb246
commit 27d5996abf
5 changed files with 82 additions and 42 deletions

View file

@ -9,7 +9,7 @@ use externs::memset;
use gdt;
use idt;
use memory;
use paging::{self, Page, VirtualAddress};
use paging::{self, entry, Page, VirtualAddress};
/// Test of zero values in BSS.
static BSS_TEST_ZERO: usize = 0;
@ -21,6 +21,7 @@ extern {
fn kmain() -> !;
}
/// The entry to Rust, all things must be initialized
#[no_mangle]
pub unsafe extern fn kstart() -> ! {
{
@ -62,7 +63,7 @@ pub unsafe extern fn kstart() -> ! {
let heap_end_page = Page::containing_address(VirtualAddress::new(HEAP_START + HEAP_SIZE-1));
for page in Page::range_inclusive(heap_start_page, heap_end_page) {
active_table.map(page, paging::entry::WRITABLE, &mut allocator);
active_table.map(page, entry::WRITABLE | entry::NO_EXECUTE, &mut allocator);
}
// Read ACPI tables
@ -78,3 +79,10 @@ pub unsafe extern fn kstart() -> ! {
asm!("xchg bx, bx" : : : : "intel", "volatile");
kmain();
}
/// Entry to rust for an AP
pub unsafe extern fn kstart_ap() -> ! {
loop {
asm!("hlt");
}
}