aboutsummaryrefslogtreecommitdiffstats
path: root/arch/h8300/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/h8300/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/h8300/lib/memset.S')
-rw-r--r--arch/h8300/lib/memset.S61
1 files changed, 61 insertions, 0 deletions
diff --git a/arch/h8300/lib/memset.S b/arch/h8300/lib/memset.S
new file mode 100644
index 000000000000..59abdf9485a5
--- /dev/null
+++ b/arch/h8300/lib/memset.S
@@ -0,0 +1,61 @@
1/* memset.S */
2
3#include <asm/linkage.h>
4
5#if defined(__H8300H__)
6 .h8300h
7#endif
8#if defined(__H8300S__)
9 .h8300s
10#endif
11 .text
12
13.global SYMBOL_NAME(memset)
14
15;;void *memset(*ptr, int c, size_t count)
16;; ptr = er0
17;; c = er1(r1l)
18;; count = er2
19SYMBOL_NAME_LABEL(memset)
20 btst #0,r0l
21 beq 2f
22
23 ;; odd address
241:
25 mov.b r1l,@er0
26 adds #1,er0
27 dec.l #1,er2
28 beq 6f
29
30 ;; even address
312:
32 mov.l er2,er3
33 cmp.l #4,er2
34 blo 4f
35 ;; count>=4 -> count/4
36#if defined(__H8300H__)
37 shlr.l er2
38 shlr.l er2
39#endif
40#if defined(__H8300S__)
41 shlr.l #2,er2
42#endif
43 ;; byte -> long
44 mov.b r1l,r1h
45 mov.w r1,e1
463:
47 mov.l er1,@er0
48 adds #4,er0
49 dec.l #1,er2
50 bne 3b
514:
52 ;; count % 4
53 and.b #3,r3l
54 beq 6f
555:
56 mov.b r1l,@er0
57 adds #1,er0
58 dec.b r3l
59 bne 5b
606:
61 rts