implement _cu_memmove in ARMv7, fix CMake that it will generate all code in ARM or Thumb modes

This commit is contained in:
mykola2312 2022-05-21 07:00:00 +03:00
parent cae1f56d5e
commit 3cca1f83ce
2 changed files with 22 additions and 0 deletions

View file

@ -36,6 +36,7 @@ if ("${ARCHITECTURE}" MATCHES "ARM*")
else()
string(TOLOWER "${ARCHITECTURE}" COMPILE_ARCHITECTURE)
add_compile_options("-march=${COMPILE_ARCHITECTURE}-${ARM_PROFILE}")
add_compile_options("-marm")
endif()
endif()

View file

@ -53,6 +53,27 @@ _cu_memcpy:
bx lr
_cu_memmove:
// r0 - dst, r1 - src, r2 - size
cmp r0, r1
beq .move0
blt .less1
add r0, r0, r2
add r1, r1, r2
sub r0, r0, #1
sub r1, r1, #1
.greater1:
ldrb r3, [r1], #-1
strb r3, [r0], #-1
subs r2, r2, #1
bne .greater1
b .move0
.less1:
ldrb r3, [r1], #1
strb r3, [r0], #1
subs r2, r2, #1
bne .less1
.move0:
bx lr
_cu_memcmp: