diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/h8300/lib/memcpy.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/memcpy.S')
-rw-r--r-- | arch/h8300/lib/memcpy.S | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/arch/h8300/lib/memcpy.S b/arch/h8300/lib/memcpy.S new file mode 100644 index 000000000000..fdcbc1ee673c --- /dev/null +++ b/arch/h8300/lib/memcpy.S | |||
@@ -0,0 +1,84 @@ | |||
1 | ;;; memcpy.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 | |||
12 | .text | ||
13 | .global SYMBOL_NAME(memcpy) | ||
14 | |||
15 | ;;; void *memcpy(void *to, void *from, size_t n) | ||
16 | SYMBOL_NAME_LABEL(memcpy) | ||
17 | mov.l er2,er2 | ||
18 | bne 1f | ||
19 | rts | ||
20 | 1: | ||
21 | ;; address check | ||
22 | bld #0,r0l | ||
23 | bxor #0,r1l | ||
24 | bcs 4f | ||
25 | mov.l er4,@-sp | ||
26 | mov.l er0,@-sp | ||
27 | btst #0,r0l | ||
28 | beq 1f | ||
29 | ;; (aligned even) odd address | ||
30 | mov.b @er1,r3l | ||
31 | mov.b r3l,@er0 | ||
32 | adds #1,er1 | ||
33 | adds #1,er0 | ||
34 | dec.l #1,er2 | ||
35 | beq 3f | ||
36 | 1: | ||
37 | ;; n < sizeof(unsigned long) check | ||
38 | sub.l er4,er4 | ||
39 | adds #4,er4 ; loop count check value | ||
40 | cmp.l er4,er2 | ||
41 | blo 2f | ||
42 | ;; unsigned long copy | ||
43 | 1: | ||
44 | mov.l @er1,er3 | ||
45 | mov.l er3,@er0 | ||
46 | adds #4,er0 | ||
47 | adds #4,er1 | ||
48 | subs #4,er2 | ||
49 | cmp.l er4,er2 | ||
50 | bcc 1b | ||
51 | ;; rest | ||
52 | 2: | ||
53 | mov.l er2,er2 | ||
54 | beq 3f | ||
55 | 1: | ||
56 | mov.b @er1,r3l | ||
57 | mov.b r3l,@er0 | ||
58 | adds #1,er1 | ||
59 | adds #1,er0 | ||
60 | dec.l #1,er2 | ||
61 | bne 1b | ||
62 | 3: | ||
63 | mov.l @sp+,er0 | ||
64 | mov.l @sp+,er4 | ||
65 | rts | ||
66 | |||
67 | ;; odd <- even / even <- odd | ||
68 | 4: | ||
69 | mov.l er4,er3 | ||
70 | mov.l er2,er4 | ||
71 | mov.l er5,er2 | ||
72 | mov.l er1,er5 | ||
73 | mov.l er6,er1 | ||
74 | mov.l er0,er6 | ||
75 | 1: | ||
76 | eepmov.w | ||
77 | mov.w r4,r4 | ||
78 | bne 1b | ||
79 | dec.w #1,e4 | ||
80 | bpl 1b | ||
81 | mov.l er1,er6 | ||
82 | mov.l er2,er5 | ||
83 | mov.l er3,er4 | ||
84 | rts | ||