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

Let's do dword-at-a-time memcpy() and memset() in userspace as well.

Also fix a dumb bug that showed up when I was memsetting something other
than zeroes.
This commit is contained in:
Andreas Kling 2019-01-15 08:14:08 +01:00
parent a8e42bacf4
commit 14712ad9c5
3 changed files with 55 additions and 17 deletions

View file

@ -41,8 +41,8 @@ void* memset(void* dest_ptr, byte c, dword n)
if (!(dest & 0x3) && n >= 12) {
size_t dwords = n / sizeof(dword);
dword expanded_c = c;
expanded_c <<= 8;
expanded_c <<= 16;
expanded_c |= expanded_c << 8;
expanded_c |= expanded_c << 16;
asm volatile(
"rep stosl\n"
: "=D"(dest)