From patchwork Thu Mar 20 15:45:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 26716 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 96CAD20143 for ; Thu, 20 Mar 2014 15:47:33 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id n16sf4165466oag.5 for ; Thu, 20 Mar 2014 08:47:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=9F0gb3LQ8Uiq41De4t8jcGmNtv+6nA/6+nZ+V1kwEoQ=; b=PiTFcA9xUc7D1/lxWMmxKSbdk9BThmNT1hHKoV+vCRWqZxIVHFlW7nz4HeiV0WjYm4 iZvWRUPiGd683kV+JGR5WUQZcwUFF2iczPzGqOe7HCdVtenPjsJzGKnO7jGN6YCKzwQE Xokkybz0PONagCYXgFwU4YMKn2uS+VztCIGjUNi7tAvYHaE3zxLbCsxVlzMfzNu/0/1t ivj1UZIbq7E0xUIvsHZgADiBXa0RUZrDRfP9cWRZMA6h7cLPh5GCu1jPwQNMzVTM1y8l KZlUvglctKoZR8u/LUHdobBtrPU8EuIIq8iq6G6FAOI4jWiyv3ezHxGXcifu6bzsS3jx HhTQ== X-Gm-Message-State: ALoCoQmaNacZHmsiyGVxmwDriR/sKAi/JKaYsLsUZl+MaVc8GMwjmNz1zhguUbSI9dfOFDQX96KE X-Received: by 10.182.200.162 with SMTP id jt2mr3751896obc.34.1395330453140; Thu, 20 Mar 2014 08:47:33 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.83.137 with SMTP id j9ls14497qgd.70.gmail; Thu, 20 Mar 2014 08:47:33 -0700 (PDT) X-Received: by 10.52.12.36 with SMTP id v4mr29835530vdb.20.1395330453053; Thu, 20 Mar 2014 08:47:33 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id kp12si506273veb.174.2014.03.20.08.47.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Mar 2014 08:47:33 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id if17so1168054vcb.36 for ; Thu, 20 Mar 2014 08:47:33 -0700 (PDT) X-Received: by 10.52.61.133 with SMTP id p5mr29078174vdr.4.1395330452828; Thu, 20 Mar 2014 08:47:32 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp398554vck; Thu, 20 Mar 2014 08:47:32 -0700 (PDT) X-Received: by 10.58.133.15 with SMTP id oy15mr33090836veb.19.1395330452483; Thu, 20 Mar 2014 08:47:32 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id uw4si516856vdc.181.2014.03.20.08.47.31 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 20 Mar 2014 08:47:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WQfAe-0004Dw-Ax; Thu, 20 Mar 2014 15:46:16 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WQfAc-0004Af-5z for xen-devel@lists.xen.org; Thu, 20 Mar 2014 15:46:14 +0000 Received: from [85.158.139.211:11117] by server-8.bemta-5.messagelabs.com id FD/61-11310-54D0B235; Thu, 20 Mar 2014 15:46:13 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-12.tower-206.messagelabs.com!1395330369!2348168!3 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.11.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 28385 invoked from network); 20 Mar 2014 15:46:12 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-12.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 20 Mar 2014 15:46:12 -0000 X-IronPort-AV: E=Sophos;i="4.97,695,1389744000"; d="scan'208";a="111935214" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 20 Mar 2014 15:46:10 +0000 Received: from norwich.cam.xci-test.com (10.80.248.129) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.2.342.4; Thu, 20 Mar 2014 11:46:06 -0400 Received: from drall.uk.xensource.com ([10.80.16.71] helo=drall.uk.xensource.com.) by norwich.cam.xci-test.com with esmtp (Exim 4.72) (envelope-from ) id 1WQfAU-0006O2-Bd; Thu, 20 Mar 2014 15:46:06 +0000 From: Ian Campbell To: Date: Thu, 20 Mar 2014 15:45:56 +0000 Message-ID: <1395330365-9901-8-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1395330336.3104.12.camel@kazak.uk.xensource.com> References: <1395330336.3104.12.camel@kazak.uk.xensource.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: julien.grall@linaro.org, tim@xen.org, Ian Campbell , stefano.stabellini@eu.citrix.com Subject: [Xen-devel] [PATCH 08/17] xen: arm32: add optimised strchr and strrchr routines X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ian.campbell@citrix.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: Taken from Linux v3.14-rc7. These aren't widely used enough to be critical, but we may as well have them. Signed-off-by: Ian Campbell Acked-by: Julien Grall --- xen/arch/arm/arm32/lib/Makefile | 1 + xen/arch/arm/arm32/lib/strchr.S | 29 +++++++++++++++++++++++++++++ xen/arch/arm/arm32/lib/strrchr.S | 28 ++++++++++++++++++++++++++++ xen/include/asm-arm/string.h | 12 ++++++++++++ 4 files changed, 70 insertions(+) create mode 100644 xen/arch/arm/arm32/lib/strchr.S create mode 100644 xen/arch/arm/arm32/lib/strrchr.S diff --git a/xen/arch/arm/arm32/lib/Makefile b/xen/arch/arm/arm32/lib/Makefile index fa4e241..e9fbc59 100644 --- a/xen/arch/arm/arm32/lib/Makefile +++ b/xen/arch/arm/arm32/lib/Makefile @@ -2,4 +2,5 @@ obj-y += memcpy.o memmove.o memset.o memchr.o memzero.o obj-y += findbit.o setbit.o obj-y += setbit.o clearbit.o changebit.o obj-y += testsetbit.o testclearbit.o testchangebit.o +obj-y += strchr.o strrchr.o obj-y += lib1funcs.o lshrdi3.o div64.o diff --git a/xen/arch/arm/arm32/lib/strchr.S b/xen/arch/arm/arm32/lib/strchr.S new file mode 100644 index 0000000..f01740e --- /dev/null +++ b/xen/arch/arm/arm32/lib/strchr.S @@ -0,0 +1,29 @@ +/* + * linux/arch/arm/lib/strchr.S + * + * Copyright (C) 1995-2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ASM optimised string functions + */ + +#include + +#include "assembler.h" + + .text + .align 5 +ENTRY(strchr) + and r1, r1, #0xff +1: ldrb r2, [r0], #1 + teq r2, r1 + teqne r2, #0 + bne 1b + teq r2, r1 + movne r0, #0 + subeq r0, r0, #1 + mov pc, lr +ENDPROC(strchr) diff --git a/xen/arch/arm/arm32/lib/strrchr.S b/xen/arch/arm/arm32/lib/strrchr.S new file mode 100644 index 0000000..88fc0de --- /dev/null +++ b/xen/arch/arm/arm32/lib/strrchr.S @@ -0,0 +1,28 @@ +/* + * linux/arch/arm/lib/strrchr.S + * + * Copyright (C) 1995-2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ASM optimised string functions + */ + +#include + +#include "assembler.h" + + .text + .align 5 +ENTRY(strrchr) + mov r3, #0 +1: ldrb r2, [r0], #1 + teq r2, r1 + subeq r3, r0, #1 + teq r2, #0 + bne 1b + mov r0, r3 + mov pc, lr +ENDPROC(strrchr) diff --git a/xen/include/asm-arm/string.h b/xen/include/asm-arm/string.h index 2c9f4f7..7d8b35a 100644 --- a/xen/include/asm-arm/string.h +++ b/xen/include/asm-arm/string.h @@ -4,6 +4,18 @@ #include #if defined(CONFIG_ARM_32) + +/* + * We don't do inline string functions, since the + * optimised inline asm versions are not small. + */ + +#define __HAVE_ARCH_STRRCHR +extern char * strrchr(const char * s, int c); + +#define __HAVE_ARCH_STRCHR +extern char * strchr(const char * s, int c); + #define __HAVE_ARCH_MEMCPY extern void * memcpy(void *, const void *, __kernel_size_t);