summaryrefslogtreecommitdiff
path: root/Kernel/StdLib.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-01-12 23:33:13 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-01-12 23:36:08 +0100
commitc43903eebd23496083ec18a3b03cb1768aa1fbd0 (patch)
tree33d5b034ba0280ad9ee011c48fa328326b18d8fa /Kernel/StdLib.cpp
parent3ac977f50bfd8dc9be2fe6e92211c67d7958a5ef (diff)
downloadserenity-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.cpp6
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;