diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-03-27 13:40:00 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-03-27 13:40:00 +0100 |
commit | 750d79dcafc618066c7a9e3ca704c989edc52249 (patch) | |
tree | db48fc7aec88c9303846f05ca7b5f2fda9125bd3 | |
parent | 580832255668fe50749b1d62db1208315b82c62d (diff) | |
download | serenity-750d79dcafc618066c7a9e3ca704c989edc52249.zip |
Kernel: Initialize the CPU to allow SSE on startup.
I still need to add support for SSE to the context switching code, but now
at least one process can use it.
-rw-r--r-- | Kernel/i386.cpp | 13 | ||||
-rw-r--r-- | Kernel/i386.h | 1 | ||||
-rw-r--r-- | Kernel/init.cpp | 2 |
3 files changed, 16 insertions, 0 deletions
diff --git a/Kernel/i386.cpp b/Kernel/i386.cpp index d049d3afe0..1879ba9206 100644 --- a/Kernel/i386.cpp +++ b/Kernel/i386.cpp @@ -493,3 +493,16 @@ void __assertion_failed(const char* msg, const char* file, unsigned line, const asm volatile("hlt"); for (;;); } + +void sse_init() +{ + asm volatile( + "mov %cr0, %eax\n" + "andl $0xfffffffb, %eax\n" + "orl $0x2, %eax\n" + "mov %eax, %cr0\n" + "mov %cr4, %eax\n" + "orl $0x600, %eax\n" + "mov %eax, %cr4\n" + ); +} diff --git a/Kernel/i386.h b/Kernel/i386.h index 9b2b3447d4..fcf70cf7cc 100644 --- a/Kernel/i386.h +++ b/Kernel/i386.h @@ -61,6 +61,7 @@ class IRQHandler; void gdt_init(); void idt_init(); +void sse_init(); void register_interrupt_handler(byte number, void (*f)()); void register_user_callable_interrupt_handler(byte number, void (*f)()); void register_irq_handler(byte number, IRQHandler&); diff --git a/Kernel/init.cpp b/Kernel/init.cpp index 09ae0b49b9..d9f4c77d57 100644 --- a/Kernel/init.cpp +++ b/Kernel/init.cpp @@ -140,6 +140,8 @@ VFS* vfs; { cli(); + sse_init(); + kmalloc_init(); init_ksyms(); |