fixed copy&paste bug and moved cpu initialization in cpu_init()

This commit is contained in:
Steffen Vogel 2013-10-16 17:42:59 +02:00
parent 9b47b3ef45
commit 403c529e8b
2 changed files with 16 additions and 35 deletions

View file

@ -387,12 +387,14 @@ void smp_start(uint32_t id)
kprintf("Application processor %d is entering its idle task\n", apic_cpu_id());
// initialize default cpu features
#ifdef CONFIG_X86_32
// initialization for x86_64 is done in smp_entry()
cpu_init();
#endif
// use the same gdt like the boot processors
gdt_flush();
// install IDT
idt_install();

View file

@ -99,18 +99,8 @@ ALIGN 8
%if MAX_CORES > 1
global smp_entry
smp_entry:
; enable caching, disable paging and fpu emulation
and eax, 0x1ffffffb
; ...and turn on FPU exceptions
or eax, 0x22
mov cr0, eax
; clears the current pgd entry
xor eax, eax
mov cr3, eax
; at this stage, we disable the SSE support
mov eax, cr4
and eax, 0xfffbf9ff
mov cr4, eax
; initialize cpu features
call cpu_init
; initialize page table
mov edi, boot_pml4
@ -169,10 +159,7 @@ L3:
pop ebp
ret
ALIGN 4
stublet:
mov esp, startup_stack-4
push ebx ; save pointer to the multiboot structure
cpu_init:
mov eax, cr0
; enable caching, disable paging and fpu emulation
and eax, 0x1ffffffb
@ -186,6 +173,15 @@ stublet:
mov eax, cr4
and eax, 0xfffbf9ff
mov cr4, eax
ret
ALIGN 4
stublet:
mov esp, startup_stack
; save pointer to the multiboot structure
push ebx
; initialize cpu features
call cpu_init
; do we have the instruction cpuid?
pushfd
pop eax
@ -389,23 +385,6 @@ smp_start64:
jmp $
%endif
global cpu_init
cpu_init:
; mov eax, cr0
; enable caching, disable paging and fpu emulation
; and eax, 0x1ffffffb
; ...and turn on FPU exceptions
; or eax, 0x22
; mov cr0, eax
; clears the current pgd entry
; xor eax, eax
; mov cr3, eax
; at this stage, we disable the SSE support
; mov eax, cr4
; and eax, 0xfffbf9ff
; mov cr4, eax
; ret
; This will set up our new segment registers and is declared in
; C as 'extern void gdt_flush();'
global gdt_flush