summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-04-22 17:13:18 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-04-22 17:13:18 +0200
commit6693cfb26acf9d5b53d090be309956456f546239 (patch)
tree5cd3fbfa38bf14d20d0f7ed6bd5329e59d27b00c /AK
parent1d02c7b6f171884c3ec971ff5e56a9d19fa29a24 (diff)
downloadserenity-6693cfb26acf9d5b53d090be309956456f546239.zip
Kernel: Don't use MMX memcpy() in the kernel.
I just discovered the hard way that clobbering FPU/MMX/SSE registers in the kernel makes things very confusing for userspace (and other kernel threads.) Let's banish all of those things from the kernel to keep things simple.
Diffstat (limited to 'AK')
-rw-r--r--AK/StdLibExtras.cpp2
-rw-r--r--AK/StdLibExtras.h4
2 files changed, 6 insertions, 0 deletions
diff --git a/AK/StdLibExtras.cpp b/AK/StdLibExtras.cpp
index b807d5ebb9..ee8aa862d9 100644
--- a/AK/StdLibExtras.cpp
+++ b/AK/StdLibExtras.cpp
@@ -5,6 +5,7 @@
extern "C" {
+#ifndef KERNEL
void* mmx_memcpy(void* dest, const void* src, size_t len)
{
ASSERT(len >= 1024);
@@ -51,6 +52,7 @@ void* mmx_memcpy(void* dest, const void* src, size_t len)
memcpy(dest_ptr, src_ptr, len);
return dest;
}
+#endif
#ifdef KERNEL
diff --git a/AK/StdLibExtras.h b/AK/StdLibExtras.h
index 04c9ce72d0..6a282b98ab 100644
--- a/AK/StdLibExtras.h
+++ b/AK/StdLibExtras.h
@@ -11,14 +11,18 @@
#include <AK/Types.h>
+#ifndef KERNEL
extern "C" void* mmx_memcpy(void* to, const void* from, size_t);
+#endif
[[gnu::always_inline]] inline void fast_dword_copy(dword* dest, const dword* src, size_t count)
{
+#ifndef KERNEL
if (count >= 256) {
mmx_memcpy(dest, src, count * sizeof(count));
return;
}
+#endif
asm volatile(
"rep movsl\n"
: "=S"(src), "=D"(dest), "=c"(count)