xen: arm32: add optimised strchr and strrchr routines

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 <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Tim Deegan <tim@xen.org>
This commit is contained in:
Ian Campbell committed 2014-04-03 17:15:42 +01:00
1 parent ef359ad3d0
commit 3cdbc31bd7
4 files changed
+70

No files matched your search

+1
View File
@@ -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
+29
View File
@@ -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 <xen/config.h>
#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)
+28
View File
@@ -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 <xen/config.h>
#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)
+12
View File
@@ -4,6 +4,18 @@
#include <xen/config.h>
#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);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.