|
|
@ -14,12 +14,14 @@ pub fn start_other_cores(acpi: &ACPI_Result, mc: &mut MemoryController) {
|
|
|
|
mc.map_page_identity(entryother_start as usize);
|
|
|
|
mc.map_page_identity(entryother_start as usize);
|
|
|
|
mc.map_page_p2v(PhysicalAddress(0));
|
|
|
|
mc.map_page_p2v(PhysicalAddress(0));
|
|
|
|
copy_entryother();
|
|
|
|
copy_entryother();
|
|
|
|
|
|
|
|
|
|
|
|
let args = unsafe{ &mut *(ENTRYOTHER_ADDR as *mut EntryArgs).offset(-1) };
|
|
|
|
let args = unsafe{ &mut *(ENTRYOTHER_ADDR as *mut EntryArgs).offset(-1) };
|
|
|
|
|
|
|
|
let page_table = unsafe{ *(0xFFFF_FFFF_FFFF_FFF8 as *const u32) } & 0xFFFF_F000;
|
|
|
|
for i in 1 .. acpi.cpu_num {
|
|
|
|
for i in 1 .. acpi.cpu_num {
|
|
|
|
let apic_id = acpi.cpu_acpi_ids[i as usize];
|
|
|
|
let apic_id = acpi.cpu_acpi_ids[i as usize];
|
|
|
|
*args = EntryArgs {
|
|
|
|
*args = EntryArgs {
|
|
|
|
kstack: mc.alloc_stack(1).unwrap().top() as u64,
|
|
|
|
kstack: mc.alloc_stack(1).unwrap().top() as u64,
|
|
|
|
next_code: 0,
|
|
|
|
page_table: page_table,
|
|
|
|
stack: 0x8000, // just enough stack to get us to entry64mp
|
|
|
|
stack: 0x8000, // just enough stack to get us to entry64mp
|
|
|
|
};
|
|
|
|
};
|
|
|
|
start_ap(apic_id, ENTRYOTHER_ADDR);
|
|
|
|
start_ap(apic_id, ENTRYOTHER_ADDR);
|
|
|
@ -28,10 +30,6 @@ pub fn start_other_cores(acpi: &ACPI_Result, mc: &mut MemoryController) {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn hello_world() {
|
|
|
|
|
|
|
|
println!("Hello world!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn copy_entryother() {
|
|
|
|
fn copy_entryother() {
|
|
|
|
use rlibc::memmove;
|
|
|
|
use rlibc::memmove;
|
|
|
|
let entryother_start = entryother_start as usize;
|
|
|
|
let entryother_start = entryother_start as usize;
|
|
|
@ -44,6 +42,6 @@ fn copy_entryother() {
|
|
|
|
#[repr(C)]
|
|
|
|
#[repr(C)]
|
|
|
|
struct EntryArgs {
|
|
|
|
struct EntryArgs {
|
|
|
|
kstack: u64,
|
|
|
|
kstack: u64,
|
|
|
|
next_code: u32,
|
|
|
|
page_table: u32,
|
|
|
|
stack: u32,
|
|
|
|
stack: u32,
|
|
|
|
}
|
|
|
|
}
|