From 27df572381dbfb6c7098d6c4463833c054916a33 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 12 Feb 2019 12:39:04 +0100 Subject: [PATCH] AK: Fix bug in MMX memcpy() unaligned prologue handling. --- AK/StdLibExtras.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/AK/StdLibExtras.cpp b/AK/StdLibExtras.cpp index 5db3444ee84..95652e368b4 100644 --- a/AK/StdLibExtras.cpp +++ b/AK/StdLibExtras.cpp @@ -12,12 +12,13 @@ void* mmx_memcpy(void* dest, const void* src, size_t len) if ((dword)dest_ptr & 7) { dword prologue = 8 - ((dword)dest_ptr & 7); + len -= prologue; asm volatile( "rep movsb\n" - :: "S"(src_ptr), "D"(dest_ptr), "c"(prologue) + : "=S"(src_ptr), "=D"(dest_ptr), "=c"(prologue) + : "0"(src_ptr), "1"(dest_ptr), "2"(prologue) : "memory" ); - len -= prologue; } for (dword i = len / 64; i; --i) { asm volatile(