From patchwork Wed Mar 26 13:38:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 27120 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f70.google.com (mail-qa0-f70.google.com [209.85.216.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A980620062 for ; Wed, 26 Mar 2014 13:40:01 +0000 (UTC) Received: by mail-qa0-f70.google.com with SMTP id hw13sf3999824qab.1 for ; Wed, 26 Mar 2014 06:40:01 -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=ufusM7sEQtVUVHMQjIjhRBnO1pWu/GZacbErlr0refE=; b=c7oBHstx5nBhk+7JCRosHMlfmtfcZoSegzOu7zr3dm0j3a7y+kShdcI17s5h0LL96w ifDs3oz+gq+/UhbKnB5BttoZyrlEHxABiQ8vmu3o4+zr0hOY80kK8cSsjt2r6AETQHw3 FQWx3GLxTcbeQcKJoRd86MEETiwgRz6p2ZCJq/Knp6i9GX6jMKm+dvF2pdoRvpjc4yGA envj3ZyYvrAW3Zuxy4TLTG/IFY6RYTBU7bL0M9kHd9hHcwQ8oupRgOiwAjKcJ+jybCBW Gx5i99R84aHqmZmrkiTYV0unGXOU7drHHzBfqyySA/TVpbv0Fx26kSnd+Cl/wgW8N8bc uDjA== X-Gm-Message-State: ALoCoQlJVUE9f0IAegIF73jgHllNm8j3wppdTMsH0RK3lMHD2rAVJZUgoeTUIdjQBosjKMmFHRWa X-Received: by 10.224.20.133 with SMTP id f5mr30910930qab.8.1395841201552; Wed, 26 Mar 2014 06:40:01 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.105.100 with SMTP id b91ls612145qgf.26.gmail; Wed, 26 Mar 2014 06:40:01 -0700 (PDT) X-Received: by 10.52.250.4 with SMTP id yy4mr72618vdc.56.1395841201460; Wed, 26 Mar 2014 06:40:01 -0700 (PDT) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id wd2si241789veb.167.2014.03.26.06.40.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Mar 2014 06:40:01 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.173; Received: by mail-ve0-f173.google.com with SMTP id oy12so2292686veb.4 for ; Wed, 26 Mar 2014 06:40:01 -0700 (PDT) X-Received: by 10.220.114.135 with SMTP id e7mr11652630vcq.23.1395841201286; Wed, 26 Mar 2014 06:40:01 -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 i9csp47051vck; Wed, 26 Mar 2014 06:40:00 -0700 (PDT) X-Received: by 10.224.151.130 with SMTP id c2mr87681746qaw.67.1395841200649; Wed, 26 Mar 2014 06:40:00 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id k4si7651505qgk.110.2014.03.26.06.40.00 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 26 Mar 2014 06:40:00 -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 1WSo2q-0004Uy-VR; Wed, 26 Mar 2014 13:39:04 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WSo2k-0004Mf-9j for xen-devel@lists.xen.org; Wed, 26 Mar 2014 13:38:58 +0000 Received: from [85.158.137.68:15116] by server-13.bemta-3.messagelabs.com id DE/9D-18692-178D2335; Wed, 26 Mar 2014 13:38:57 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-2.tower-31.messagelabs.com!1395841128!1838933!5 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 22723 invoked from network); 26 Mar 2014 13:38:56 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-2.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 26 Mar 2014 13:38:56 -0000 X-IronPort-AV: E=Sophos;i="4.97,735,1389744000"; d="scan'208";a="113732839" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 26 Mar 2014 13:38:54 +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; Wed, 26 Mar 2014 09:38:53 -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 1WSo2f-00074X-Lr; Wed, 26 Mar 2014 13:38:53 +0000 From: Ian Campbell To: Date: Wed, 26 Mar 2014 13:38:43 +0000 Message-ID: <1395841133-2223-8-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1395841009.12547.11.camel@kazak.uk.xensource.com> References: <1395841009.12547.11.camel@kazak.uk.xensource.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: julien.grall@linaro.org, tim@xen.org, Ian Campbell , stefano.stabellini@eu.citrix.com Subject: [Xen-devel] [PATCH v2 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.128.173 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);