mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:37:44 +00:00
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.
This commit is contained in:
parent
1d02c7b6f1
commit
6693cfb26a
3 changed files with 9 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue