diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-01-12 23:33:13 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-01-12 23:36:08 +0100 |
commit | c43903eebd23496083ec18a3b03cb1768aa1fbd0 (patch) | |
tree | 33d5b034ba0280ad9ee011c48fa328326b18d8fa /Kernel/StdLib.cpp | |
parent | 3ac977f50bfd8dc9be2fe6e92211c67d7958a5ef (diff) | |
download | serenity-c43903eebd23496083ec18a3b03cb1768aa1fbd0.zip |
Don't use dword-by-dword memset/memcpy if the addresses are unaligned.
Also don't enable the large kmalloc catcher by default.
Diffstat (limited to 'Kernel/StdLib.cpp')
-rw-r--r-- | Kernel/StdLib.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Kernel/StdLib.cpp b/Kernel/StdLib.cpp index 655fab3c6a..023f8e6ce5 100644 --- a/Kernel/StdLib.cpp +++ b/Kernel/StdLib.cpp @@ -9,7 +9,8 @@ void memcpy(void *dest_ptr, const void *src_ptr, dword n) { dword dest = (dword)dest_ptr; dword src = (dword)src_ptr; - if (n >= 12) { + // FIXME: Support starting at an unaligned address. + if (!(dest & 0x3) && !(src & 0x3) && n >= 12) { size_t dwords = n / sizeof(dword); asm volatile( "rep movsl\n" @@ -36,7 +37,8 @@ void strcpy(char* dest, const char *src) void* memset(void* dest_ptr, byte c, dword n) { dword dest = (dword)dest_ptr; - if (n >= 12) { + // FIXME: Support starting at an unaligned address. + if (!(dest & 0x3) && n >= 12) { size_t dwords = n / sizeof(dword); dword expanded_c = c; expanded_c <<= 8; |