]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
Arm32: correct string.h functions for "int" -> "unsigned char" conversion
authorJan Beulich <jbeulich@suse.com>
Wed, 24 Aug 2022 12:33:06 +0000 (14:33 +0200)
committerJulien Grall <jgrall@amazon.com>
Thu, 25 Aug 2022 14:35:21 +0000 (15:35 +0100)
While Arm64 does so uniformly, for Arm32 only strchr() currently handles
this properly. Add the necessary conversion also to strrchr(), memchr(),
and memset().

As to the placement in memset(): Putting the new insn at the beginning
of the function is apparently deemed more "obvious". It could be placed
later, as the code reachable without ever making it to the "1" label
only ever does byte stores.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
xen/arch/arm/arm32/lib/memchr.S
xen/arch/arm/arm32/lib/memset.S
xen/arch/arm/arm32/lib/strrchr.S

index 7dae4ab6a6f82f62f334b377b8d8f373106719aa..f38374a43eed41a31c3abae2ef7061240bebe9f6 100644 (file)
@@ -14,6 +14,7 @@
        .text
        .align  5
 ENTRY(memchr)
+       and     r1, r1, #0xff
 1:     subs    r2, r2, #1
        bmi     2f
        ldrb    r3, [r0], #1
index 5a1dadf767d71ad05e8a936bed0fa4daef4d66fa..ce82c45910ea1f02317769c3c4dd2592183d7c46 100644 (file)
@@ -15,6 +15,7 @@
        .align  5
 
 ENTRY(memset)
+       and     r1, r1, #0xff
        ands    r3, r0, #3              @ 1 unaligned?
        mov     ip, r0                  @ preserve r0 as return value
        bne     6f                      @ 1
index ec4d40de5e5ad0e9095c0319d654768f9fea65b5..374ce3e59d2ca6a93453a625f85e1b15f130f9e9 100644 (file)
@@ -14,6 +14,7 @@
                .text
                .align  5
 ENTRY(strrchr)
+               and     r1, r1, #0xff
                mov     r3, #0
 1:             ldrb    r2, [r0], #1
                teq     r2, r1