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

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


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 24 Aug 2022 14:33:06 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YjiSw0+oR37MnXYpyF2iC1Q6ey9w7qhXBSA03B3hZe0=; b=DOaRJet8uaj5sFVuxX799DFfeK63r8VcmbQQ8TU6hdt5LhU2xZy9QkVLJmA8Xteoz7pb96qUX+0KKzXvb4GebzlHTYPNXSHypBdyiAHWV0tYJj79R/ep3G+nY784Lxsc88wwH2qM3TkRozpbnqHFbhgFLZDbK76IGeNOl4ZEgeZhq9PCAI0u4dl79BYv7I2viCkR1Tr4npYoG/jqODb3nZzGBTnBIZXNx8djqWOglWwumFkozDWVB6/a1BZAiWjYxWx0qICta1q7apPMhW76WGlEHh4UWPzBevy+qxFe92HkYHOlkmiPXApKuplSu2/GJOBDxC+Ia/p8NaRqvci+lQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DK7OsHg7XeVqS303vF+WcYzgYVEN1+OW8X7I64+XE4X+6EfsvNPOmt8BFe3TRnPcac8rsYnDRdjDA1ON3+Hr/GX41CEXdzbYaauBXOpcQA3Bu2c266/QzmA+njKVm1O9nKwcFdHIHHHFzjp+wzMEDZifTCUL31++KjJw2njGeSQ6Bch/Joc0V7hBTZhjuwjOr7ud3v9wk/gLSEK/Of9ylVKWjhFQ9fSEOPN1JJLuFGr/oaXPYjioBbTUPW7/V5nzuQdYaWaBp4ocoSlDH3TiSOPMrxXaBNc5L6SsryYubub6aO0QopL+qLyWmdNA8zvoDq3lN9WG9Id49l9UnSCZhQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>
  • Delivery-date: Wed, 24 Aug 2022 12:47:03 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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>
---
v2: For memset() use the "more obvious" adjustment.

--- 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
--- 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
--- 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



 


Rackspace

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