1/* $NetBSD: swab.S,v 1.10 2013/07/18 21:37:47 matt Exp $ */ 2 3#include <machine/asm.h> 4 5ENTRY(swab) 6 movl 4(%sp),%a0 | source 7 movl 8(%sp),%a1 | destination 8 movl 12(%sp),%d0 | count 9 lsrl #1,%d0 | count is in bytes; we need words 10 jeq swdone 11 12swloop: 13#ifdef __mcoldfire__ 14 movb (%a0)+,1(%a1) 15 movb (%a0)+,(%a1) 16 addql #2,%a1 17#else 18 movw (%a0)+,%d1 19 rorw #8,%d1 20 movw %d1,(%a1)+ 21#endif 22 subql #1,%d0 23 jne swloop 24 25swdone: 26 rts 27END(swab) 28