[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] Arm32: correct string.h functions for "int" -> "unsigned char" conversion



commit cbb35e72802f3a285c382a995ef647b59e5caf2f
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Aug 24 14:33:06 2022 +0200
Commit:     Julien Grall <jgrall@xxxxxxxxxx>
CommitDate: Thu Aug 25 15:35:21 2022 +0100

    Arm32: correct string.h functions for "int" -> "unsigned char" conversion
    
    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@xxxxxxxx>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
---
 xen/arch/arm/arm32/lib/memchr.S  | 1 +
 xen/arch/arm/arm32/lib/memset.S  | 1 +
 xen/arch/arm/arm32/lib/strrchr.S | 1 +
 3 files changed, 3 insertions(+)

diff --git a/xen/arch/arm/arm32/lib/memchr.S b/xen/arch/arm/arm32/lib/memchr.S
index 7dae4ab6a6..f38374a43e 100644
--- a/xen/arch/arm/arm32/lib/memchr.S
+++ b/xen/arch/arm/arm32/lib/memchr.S
@@ -14,6 +14,7 @@
        .text
        .align  5
 ENTRY(memchr)
+       and     r1, r1, #0xff
 1:     subs    r2, r2, #1
        bmi     2f
        ldrb    r3, [r0], #1
diff --git a/xen/arch/arm/arm32/lib/memset.S b/xen/arch/arm/arm32/lib/memset.S
index 5a1dadf767..ce82c45910 100644
--- a/xen/arch/arm/arm32/lib/memset.S
+++ b/xen/arch/arm/arm32/lib/memset.S
@@ -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
diff --git a/xen/arch/arm/arm32/lib/strrchr.S b/xen/arch/arm/arm32/lib/strrchr.S
index ec4d40de5e..374ce3e59d 100644
--- a/xen/arch/arm/arm32/lib/strrchr.S
+++ b/xen/arch/arm/arm32/lib/strrchr.S
@@ -14,6 +14,7 @@
                .text
                .align  5
 ENTRY(strrchr)
+               and     r1, r1, #0xff
                mov     r3, #0
 1:             ldrb    r2, [r0], #1
                teq     r2, r1
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.