[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/2] Arm32: correct string.h functions for "int" -> "unsigned char" conversion
- To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Fri, 19 Aug 2022 09:49:51 +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=A3RXVG+eaVf926YK1W8KCyqneq7P2OQCjFonkAYO/ek=; b=PdN3cI+DFcv5swa5LDbGUulF6aVcsrBunWFFvDAhaJajP8IIG7wTN+RM/fn2grfOyEWb5W4MPjCs/oKHmCcteq71UrShO4613T3ZPw46YLxKyvjJ/ft/I88nH7ZZGfr54WmBtLFA4KfVQMKOu/9gyV9Uzcvd4P4xyVkEDT+CzUMKlnCuW4nZ6ZFXcxWTJR7kKV1Lv2x1jMElrDFddYsDqrgmixGLw8TL5+ajZoGE6ID/Vpakp+0A37DKcPXJJiY3L5DNotvFoDHzptUtF3N5FORiH6NDJ2TBhvNFt+lqjg50+lC8yAd7qXyxeD4BkVQg6VXriSR6Bf9MAF5gqd5pqw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C9jU7UQEEEUBuISkTU24kuI6qDygnXYuE7GakadlFbfV0cz37IT2cS/0aWR+86ld7oHVuUwYS63h9DIbpG4/lhGDdeDfRLciVQNpuNBE40dO4XbPTF4555lFUCzdISQKoiQqBzD24nQPVb3DWalQQz+rXkx0OPBhvPLBJdaamr6coxDwaqFRUM/jvpcJyBUd8Z1TBg7BAb6dLUF6F9ou41D8s4nvzgQPJMG26tvfEBxwShetsKGNjprYFi8WuxMBP7tKD4+6l5hmgAM463ZeVbAVCySO4DPduPYickTpisuQmnT3QlXwm8YvTgAU7IpnEwVSoajgcAnHg6MWEBhtnQ==
- 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: Fri, 19 Aug 2022 07:49:58 +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 could perhaps be deemed more "obvious", but the code
reachable without ever making it to the "1" label only ever does byte
stores.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
--- 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
@@ -21,7 +21,8 @@ ENTRY(memset)
/*
* we know that the pointer in ip is aligned to a word boundary.
*/
-1: orr r1, r1, r1, lsl #8
+1: and r1, r1, #0xff
+ orr r1, r1, r1, lsl #8
orr r1, r1, r1, lsl #16
mov r3, r1
cmp r2, #16
--- 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
|