Merge pull request #245 from gwilymk/upgrade-agbabi

Upgrade agbabi
This commit is contained in:
Gwilym Kuiper 2022-06-24 21:29:33 +01:00 committed by GitHub
commit 6779f41a1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 7 deletions

View file

@ -15,17 +15,13 @@
*/ */
.arm .arm
.align 4 .align 2
.section .iwram.__aeabi_memcpy, "ax", %progbits .section .iwram.__aeabi_memcpy, "ax", %progbits
.global __agbabi_memcpy .global __agbabi_memcpy
__agbabi_memcpy: __agbabi_memcpy:
.global __aeabi_memcpy .global __aeabi_memcpy
__aeabi_memcpy: __aeabi_memcpy:
// Handle <= 2 byte copies byte-by-byte
cmp r2, #2
ble .Lcopy1
// Check pointer alignment // Check pointer alignment
eor r3, r1, r0 eor r3, r1, r0
// JoaoBapt carry & sign bit test // JoaoBapt carry & sign bit test
@ -34,9 +30,13 @@ __aeabi_memcpy:
bcs .Lcopy2 bcs .Lcopy2
.Lcopy4: .Lcopy4:
// Handle <= 2 byte copies byte-by-byte
cmp r2, #2
ble .Lcopy1
// Copy half and byte head // Copy half and byte head
rsb r3, r0, #4 rsb r3, r0, #4
// JoaoBapt carry & sign bit test
movs r3, r3, lsl #31 movs r3, r3, lsl #31
ldrmib r3, [r1], #1 ldrmib r3, [r1], #1
strmib r3, [r0], #1 strmib r3, [r0], #1
@ -73,6 +73,7 @@ __aeabi_memcpy4:
bhs .LcopyWords bhs .LcopyWords
// Copy half and byte tail // Copy half and byte tail
// JoaoBapt carry & sign bit test
movs r3, r2, lsl #31 movs r3, r2, lsl #31
ldrcsh r3, [r1], #2 ldrcsh r3, [r1], #2
strcsh r3, [r0], #2 strcsh r3, [r0], #2
@ -83,6 +84,7 @@ __aeabi_memcpy4:
.Lcopy2: .Lcopy2:
// Copy byte head // Copy byte head
tst r0, #1 tst r0, #1
cmpne r2, #0
ldrneb r3, [r1], #1 ldrneb r3, [r1], #1
strneb r3, [r0], #1 strneb r3, [r0], #1
subne r2, r2, #1 subne r2, r2, #1

View file

@ -16,7 +16,7 @@
*/ */
.arm .arm
.balign 4 .align 2
.section .iwram.__aeabi_memset, "ax", %progbits .section .iwram.__aeabi_memset, "ax", %progbits
.global __aeabi_memclr .global __aeabi_memclr
@ -37,6 +37,7 @@ __aeabi_memset:
// Handle <= 2 byte set byte-by-byte // Handle <= 2 byte set byte-by-byte
cmp r1, #2 cmp r1, #2
bgt .LskipShortHead bgt .LskipShortHead
// JoaoBapt carry & sign bit test
movs r1, r1, lsl #31 movs r1, r1, lsl #31
// Set byte and half // Set byte and half
strmib r2, [r0], #1 strmib r2, [r0], #1
@ -45,8 +46,8 @@ __aeabi_memset:
bx lr bx lr
.LskipShortHead: .LskipShortHead:
// JoaoBapt carry & sign bit test
rsb r3, r0, #4 rsb r3, r0, #4
// JoaoBapt carry & sign bit test
movs r3, r3, lsl #31 movs r3, r3, lsl #31
// Set half and byte head // Set half and byte head
strmib r2, [r0], #1 strmib r2, [r0], #1
@ -101,6 +102,7 @@ __agbabi_wordset4:
bhs .LsetWords bhs .LsetWords
// Set half and byte tail // Set half and byte tail
// JoaoBapt carry & sign bit test
movs r3, r1, lsl #31 movs r3, r1, lsl #31
strcsh r2, [r0], #2 strcsh r2, [r0], #2
strmib r2, [r0] strmib r2, [r0]