diff options
Diffstat (limited to 'stage3')
-rw-r--r-- | stage3/init.c | 12 | ||||
-rw-r--r-- | stage3/main.c | 12 |
2 files changed, 12 insertions, 12 deletions
diff --git a/stage3/init.c b/stage3/init.c index e913fee..2e26e19 100644 --- a/stage3/init.c +++ b/stage3/init.c @@ -1,6 +1,18 @@ +#include "def.h" void kmain(); void init() { + // enable SSE. long mode demands it is present + u64 cr0; + asm volatile("mov %%cr0, %0 \n":"=r"(cr0)); + asm volatile("mov %0, %%cr0"::"r"((cr0 & ~(1 << 2)) | (1 << 1))); + + u64 cr4; + asm volatile("mov %%cr4, %0":"=r"(cr4)); + asm volatile("mov %0, %%cr4"::"r"(cr4 | (1 << 9) | (1 << 10))); + + u16 fpu_cw = 0x37a; + asm volatile("fldcw %0"::"m"(fpu_cw)); kmain(); } diff --git a/stage3/main.c b/stage3/main.c index a7212b9..a03dc5d 100644 --- a/stage3/main.c +++ b/stage3/main.c @@ -125,18 +125,6 @@ void kmain() print_num_pad(features, 2, 32, '0'); print(S("\n")); - // enable SSE. long mode demands it is present - u64 cr0; - asm volatile("mov %%cr0, %0 \n":"=r"(cr0)); - asm volatile("mov %0, %%cr0"::"r"((cr0 & ~(1 << 2)) | (1 << 1))); - - u64 cr4; - asm volatile("mov %%cr4, %0":"=r"(cr4)); - asm volatile("mov %0, %%cr4"::"r"(cr4 | (1 << 9) | (1 << 10))); - - u16 fpu_cw = 0x37a; - asm volatile("fldcw %0"::"m"(fpu_cw)); - interrupts_init(); pic_init(); thread_init(); |