linux/arch/h8300/lib/memcpy.S

85 lines
1.1 KiB
ArmAsm
Raw Normal View History

;;; memcpy.S
#include <asm/linkage.h>
#if defined(__H8300H__)
.h8300h
#endif
#if defined(__H8300S__)
.h8300s
#endif
.text
h8300: Hardcode symbol prefixes in asm sources Commit e1b5bb6d1236d4ad2084c53aa83dde7cdf6f8eea ("consolidate cond_syscall and SYSCALL_ALIAS declarations") broke the h8300 build because it removed the duplicate SYMBOL_NAME() macro from arch/h8300/include/asm/linkage.h, and all the h8300 asm files include <asm/linkage.h> instead of <linux/linkage.h>: arch/h8300/kernel/entry.S: Assembler messages: arch/h8300/kernel/entry.S:158: Error: junk at end of line, first unrecognized character is `(' ... arch/h8300/kernel/syscalls.S: Assembler messages: arch/h8300/kernel/syscalls.S:6: Error: junk at end of line, first unrecognized character is `(' ... arch/h8300/lib/abs.S: Assembler messages: arch/h8300/lib/abs.S:12: Error: junk at end of line, first unrecognized character is `(' ... arch/h8300/lib/memcpy.S: Assembler messages: arch/h8300/lib/memcpy.S:13: Error: junk at end of line, first unrecognized character is `(' ... arch/h8300/lib/memset.S: Assembler messages: arch/h8300/lib/memset.S:13: Error: junk at end of line, first unrecognized character is `(' ... Commit 126de6b20bfb82cc19012d5048f11f339ae5a021 ("linkage.h: fix build breakage due to symbol prefix handling") broke it even more, by removing SYMBOL_NAME() and replacing it by __SYMBOL_NAME(). Commit f8ce1faf55955de62e0a12e330c6d9a526071f65 ("Merge tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linuxkernel/git/rusty/linux") also removed __SYMBOL_NAME(), hidden in a merge conflict resolution. Hence, replace the use of SYMBOL_NAME() and SYMBOL_NAME_LABEL() in h8300 assembler sources by hardcoding the underscore symbol prefix, like other architectures (blackfin/metag) do. This allows to kill SYMBOL_NAME_LABEL(). Now <asm/linkage.h> becomes empty, and h8300 can be switched to asm-generic/linkage.h. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2013-05-06 21:32:46 +02:00
.global _memcpy
;;; void *memcpy(void *to, void *from, size_t n)
h8300: Hardcode symbol prefixes in asm sources Commit e1b5bb6d1236d4ad2084c53aa83dde7cdf6f8eea ("consolidate cond_syscall and SYSCALL_ALIAS declarations") broke the h8300 build because it removed the duplicate SYMBOL_NAME() macro from arch/h8300/include/asm/linkage.h, and all the h8300 asm files include <asm/linkage.h> instead of <linux/linkage.h>: arch/h8300/kernel/entry.S: Assembler messages: arch/h8300/kernel/entry.S:158: Error: junk at end of line, first unrecognized character is `(' ... arch/h8300/kernel/syscalls.S: Assembler messages: arch/h8300/kernel/syscalls.S:6: Error: junk at end of line, first unrecognized character is `(' ... arch/h8300/lib/abs.S: Assembler messages: arch/h8300/lib/abs.S:12: Error: junk at end of line, first unrecognized character is `(' ... arch/h8300/lib/memcpy.S: Assembler messages: arch/h8300/lib/memcpy.S:13: Error: junk at end of line, first unrecognized character is `(' ... arch/h8300/lib/memset.S: Assembler messages: arch/h8300/lib/memset.S:13: Error: junk at end of line, first unrecognized character is `(' ... Commit 126de6b20bfb82cc19012d5048f11f339ae5a021 ("linkage.h: fix build breakage due to symbol prefix handling") broke it even more, by removing SYMBOL_NAME() and replacing it by __SYMBOL_NAME(). Commit f8ce1faf55955de62e0a12e330c6d9a526071f65 ("Merge tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linuxkernel/git/rusty/linux") also removed __SYMBOL_NAME(), hidden in a merge conflict resolution. Hence, replace the use of SYMBOL_NAME() and SYMBOL_NAME_LABEL() in h8300 assembler sources by hardcoding the underscore symbol prefix, like other architectures (blackfin/metag) do. This allows to kill SYMBOL_NAME_LABEL(). Now <asm/linkage.h> becomes empty, and h8300 can be switched to asm-generic/linkage.h. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2013-05-06 21:32:46 +02:00
_memcpy:
mov.l er2,er2
bne 1f
rts
1:
;; address check
bld #0,r0l
bxor #0,r1l
bcs 4f
mov.l er4,@-sp
mov.l er0,@-sp
btst #0,r0l
beq 1f
;; (aligned even) odd address
mov.b @er1,r3l
mov.b r3l,@er0
adds #1,er1
adds #1,er0
dec.l #1,er2
beq 3f
1:
;; n < sizeof(unsigned long) check
sub.l er4,er4
adds #4,er4 ; loop count check value
cmp.l er4,er2
blo 2f
;; unsigned long copy
1:
mov.l @er1,er3
mov.l er3,@er0
adds #4,er0
adds #4,er1
subs #4,er2
cmp.l er4,er2
bcc 1b
;; rest
2:
mov.l er2,er2
beq 3f
1:
mov.b @er1,r3l
mov.b r3l,@er0
adds #1,er1
adds #1,er0
dec.l #1,er2
bne 1b
3:
mov.l @sp+,er0
mov.l @sp+,er4
rts
;; odd <- even / even <- odd
4:
mov.l er4,er3
mov.l er2,er4
mov.l er5,er2
mov.l er1,er5
mov.l er6,er1
mov.l er0,er6
1:
eepmov.w
mov.w r4,r4
bne 1b
dec.w #1,e4
bpl 1b
mov.l er1,er6
mov.l er2,er5
mov.l er3,er4
rts