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 +#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) diff --git a/Kernel/StdLib.cpp b/Kernel/StdLib.cpp index 41aa2c65df..af9eacaab7 100644 --- a/Kernel/StdLib.cpp +++ b/Kernel/StdLib.cpp @@ -8,9 +8,10 @@ extern "C" { void* memcpy(void* dest_ptr, const void* src_ptr, size_t n) { - if (n >= 1024) { +#ifndef KERNEL + if (n >= 1024) return mmx_memcpy(dest_ptr, src_ptr, n); - } +#endif size_t dest = (size_t)dest_ptr; size_t src = (size_t)src_ptr;