aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/lib/memset.S
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/sh/lib/memset.S
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/sh/lib/memset.S')
-rw-r--r--arch/sh/lib/memset.S57
1 files changed, 57 insertions, 0 deletions
diff --git a/arch/sh/lib/memset.S b/arch/sh/lib/memset.S
new file mode 100644
index 000000000000..95670090680e
--- /dev/null
+++ b/arch/sh/lib/memset.S
@@ -0,0 +1,57 @@
1/* $Id: memset.S,v 1.1 2000/04/14 16:49:01 mjd Exp $
2 *
3 * "memset" implementation of SuperH
4 *
5 * Copyright (C) 1999 Niibe Yutaka
6 *
7 */
8
9/*
10 * void *memset(void *s, int c, size_t n);
11 */
12
13#include <linux/linkage.h>
14
15ENTRY(memset)
16 tst r6,r6
17 bt/s 5f ! if n=0, do nothing
18 add r6,r4
19 mov #12,r0
20 cmp/gt r6,r0
21 bt/s 4f ! if it's too small, set a byte at once
22 mov r4,r0
23 and #3,r0
24 cmp/eq #0,r0
25 bt/s 2f ! It's aligned
26 sub r0,r6
271:
28 dt r0
29 bf/s 1b
30 mov.b r5,@-r4
312: ! make VVVV
32 swap.b r5,r0 ! V0
33 or r0,r5 ! VV
34 swap.w r5,r0 ! VV00
35 or r0,r5 ! VVVV
36 !
37 mov r6,r0
38 shlr2 r0
39 shlr r0 ! r0 = r6 >> 3
403:
41 dt r0
42 mov.l r5,@-r4 ! set 8-byte at once
43 bf/s 3b
44 mov.l r5,@-r4
45 !
46 mov #7,r0
47 and r0,r6
48 tst r6,r6
49 bt 5f
50 ! fill bytes
514:
52 dt r6
53 bf/s 4b
54 mov.b r5,@-r4
555:
56 rts
57 mov r4,r0