2013-12-06 12:04:52 +01:00
|
|
|
/* $NetBSD: swab.S,v 1.10 2013/07/18 21:37:47 matt Exp $ */
|
2011-02-14 20:36:03 +01:00
|
|
|
|
|
|
|
#include <machine/asm.h>
|
|
|
|
|
|
|
|
ENTRY(swab)
|
2013-12-06 12:04:52 +01:00
|
|
|
movl 4(%sp),%a0 | source
|
|
|
|
movl 8(%sp),%a1 | destination
|
|
|
|
movl 12(%sp),%d0 | count
|
2011-02-14 20:36:03 +01:00
|
|
|
lsrl #1,%d0 | count is in bytes; we need words
|
|
|
|
jeq swdone
|
|
|
|
|
|
|
|
swloop:
|
2013-12-06 12:04:52 +01:00
|
|
|
#ifdef __mcoldfire__
|
|
|
|
movb (%a0)+,1(%a1)
|
|
|
|
movb (%a0)+,(%a1)
|
|
|
|
addql #2,%a1
|
|
|
|
#else
|
|
|
|
movw (%a0)+,%d1
|
2011-02-14 20:36:03 +01:00
|
|
|
rorw #8,%d1
|
2013-12-06 12:04:52 +01:00
|
|
|
movw %d1,(%a1)+
|
|
|
|
#endif
|
2011-02-14 20:36:03 +01:00
|
|
|
subql #1,%d0
|
|
|
|
jne swloop
|
|
|
|
|
|
|
|
swdone:
|
|
|
|
rts
|
2013-12-06 12:04:52 +01:00
|
|
|
END(swab)
|