diff options
-rw-r--r-- | firmware/SOURCES | 2 | ||||
-rw-r--r-- | firmware/target/coldfire/strlen-coldfire.S | 40 |
2 files changed, 41 insertions, 1 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index 2b948e7df4..c642196d5c 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -250,13 +250,13 @@ target/sh/system-sh.c | |||
250 | 250 | ||
251 | #elif defined(CPU_COLDFIRE) | 251 | #elif defined(CPU_COLDFIRE) |
252 | 252 | ||
253 | common/strlen.c | ||
254 | #ifndef SIMULATOR | 253 | #ifndef SIMULATOR |
255 | target/coldfire/crt0.S | 254 | target/coldfire/crt0.S |
256 | target/coldfire/memcpy-coldfire.S | 255 | target/coldfire/memcpy-coldfire.S |
257 | target/coldfire/memmove-coldfire.S | 256 | target/coldfire/memmove-coldfire.S |
258 | target/coldfire/memset-coldfire.S | 257 | target/coldfire/memset-coldfire.S |
259 | target/coldfire/memswap128-coldfire.S | 258 | target/coldfire/memswap128-coldfire.S |
259 | target/coldfire/strlen-coldfire.S | ||
260 | #if defined(HAVE_LCD_COLOR) \ | 260 | #if defined(HAVE_LCD_COLOR) \ |
261 | || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED) | 261 | || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED) |
262 | target/coldfire/memset16-coldfire.S | 262 | target/coldfire/memset16-coldfire.S |
diff --git a/firmware/target/coldfire/strlen-coldfire.S b/firmware/target/coldfire/strlen-coldfire.S new file mode 100644 index 0000000000..9be42a5864 --- /dev/null +++ b/firmware/target/coldfire/strlen-coldfire.S | |||
@@ -0,0 +1,40 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id $ | ||
9 | * | ||
10 | * Copyright (C) 2007 Nils Wallménius | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | /* size_t strlen(const char *str) */ | ||
21 | |||
22 | .section .text,"ax",@progbits | ||
23 | .align 2 | ||
24 | .globl strlen | ||
25 | .type strlen, @function | ||
26 | |||
27 | strlen: | ||
28 | move.l 4(%sp),%a0 /* %a0 = *str */ | ||
29 | move.l %a0,%d0 /* %d0 = start address */ | ||
30 | |||
31 | 1: | ||
32 | tst.b (%a0)+ /* test if %a0 == 0 and increment */ | ||
33 | bne.b 1b /* if the test was false repeat */ | ||
34 | |||
35 | sub.l %d0,%a0 /* how many times did we repeat? */ | ||
36 | move.l %a0,%d0 | ||
37 | subq.l #1,%d0 /* %d0 is 1 too large due to the last increment */ | ||
38 | rts | ||
39 | .size strlen, .-strlen | ||
40 | |||