From 35ec905b7e798e379efdf117cff816e29690648e Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Mon, 18 Jul 2011 09:01:35 +0200 Subject: [PATCH] move processor initialization code into the function cpu_init --- arch/x86/kernel/entry.asm | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/arch/x86/kernel/entry.asm b/arch/x86/kernel/entry.asm index 80ab63b8..9f15bc05 100644 --- a/arch/x86/kernel/entry.asm +++ b/arch/x86/kernel/entry.asm @@ -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