move processor initialization code into the function cpu_init

This commit is contained in:
Stefan Lankes 2011-07-18 09:01:35 +02:00
parent e7c0f53562
commit 35ec905b7e

View file

@ -64,6 +64,21 @@ ALIGN 4
stublet:
; initialize stack pointer.
mov esp, default_stack_pointer
; initialize cpu features
call cpu_init
; interpret multiboot information
extern multiboot_init
push ebx
call multiboot_init
add esp, 4
; jump to the boot processors's C code
extern main
call main
jmp $
global cpu_init
cpu_init:
mov eax, cr0
; enable caching, disable paging and fpu emulation
and eax, 0x1ffffffb
@ -77,16 +92,7 @@ stublet:
mov eax, cr4
and eax, 0xfffbf9ff
mov cr4, eax
; interpret multiboot information
extern multiboot_init
push ebx
call multiboot_init
add esp, 4
; jump to the boot processors's C code
extern main
call main
jmp $
ret
; This will set up our new segment registers. We need to do
; something special in order to set CS. We do what is called a