Fix loading entryother. Now CPU1 can print OK.

master
WangRunji 7 years ago
parent 8a8aff8917
commit 1e293763bc

@ -27,11 +27,6 @@
%define STA_R 0x2 ; Readable (executable segments)
%define STA_A 0x1 ; Accessed
global entryother_start
global entryother_end
entryother_start:
section .text
bits 16
start:
@ -60,6 +55,10 @@ start32:
mov fs, ax
mov gs, ax
; debug
mov dword [0xb8000], 0x2f4b2f4f
hlt
; defer paging until we switch to 64bit mode
; set ebx=1 so shared boot code knows we're booting a secondary core
mov ebx, 1
@ -91,6 +90,4 @@ gdt:
db 0, (0x90 | STA_W), 0xcf, 0
.desc:
dw ($ - gdt - 1)
dq gdt
entryother_end:
dq gdt

@ -29,14 +29,15 @@ SECTIONS {
/* bootloader for other processors */
real = .; /* backup va */
entryother_start = .; /* backup va */
. = OTHER_OFFSET;
.text.other : AT(real)
.text.other : AT(entryother_start)
{
KEEP(*/entryother.o (.text))
. = ALIGN(4K);
}
. = . - OTHER_OFFSET + real; /* recover va */
entryother_end = . - OTHER_OFFSET + entryother_start;
. = entryother_end; /* recover va */
. += KERNEL_OFFSET;

@ -2,7 +2,7 @@ use arch::driver::{acpi::ACPI_Result, apic::start_ap};
use memory::{MemoryController, PhysicalAddress};
extern {
fn entryother_start();
fn entryother_start(); // physical addr of entryother
fn entryother_end();
}
@ -11,6 +11,7 @@ const ENTRYOTHER_ADDR: u32 = 0x7000;
pub fn start_other_cores(acpi: &ACPI_Result, mc: &mut MemoryController) {
mc.map_page_identity(ENTRYOTHER_ADDR as usize - 1);
mc.map_page_identity(ENTRYOTHER_ADDR as usize);
mc.map_page_identity(entryother_start as usize);
mc.map_page_p2v(PhysicalAddress(0));
copy_entryother();
let args = unsafe{ &mut *(ENTRYOTHER_ADDR as *mut EntryArgs).offset(-1) };
@ -22,6 +23,7 @@ pub fn start_other_cores(acpi: &ACPI_Result, mc: &mut MemoryController) {
stack: 0x8000, // just enough stack to get us to entry64mp
};
start_ap(apic_id, ENTRYOTHER_ADDR);
loop{}
}
}

Loading…
Cancel
Save