From c9f1401ef3ab5e5c78b27016a8332691d05ca2af Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Sun, 19 Jun 2022 13:03:44 +0100 Subject: [PATCH] Fix issue with small, misaligned copies --- agb/src/agbabi/memcpy.s | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/agb/src/agbabi/memcpy.s b/agb/src/agbabi/memcpy.s index 0c7412b5..8f6b6018 100644 --- a/agb/src/agbabi/memcpy.s +++ b/agb/src/agbabi/memcpy.s @@ -29,6 +29,10 @@ __aeabi_memcpy: bmi .Lcopy1 bcs .Lcopy2 + // If the number of bytes to copy is less than 4, we should just copy one byte at a time + cmp r2, #4 + bmi .Lcopy1 + .Lcopy4: // Copy half and byte head rsb r3, r0, #4