1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:18:12 +00:00

Don't use dword-by-dword memset/memcpy if the addresses are unaligned.

Also don't enable the large kmalloc catcher by default.
This commit is contained in:
Andreas Kling 2019-01-12 23:33:13 +01:00
parent 3ac977f50b
commit c43903eebd
2 changed files with 10 additions and 4 deletions

View file

@ -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;