Module Name: src Committed By: matt Date: Mon Aug 19 03:44:18 UTC 2013
Modified Files: src/common/lib/libc/arch/arm/gen: byte_swap_2.S Log Message: Use STRONG_ALIAS Add thumb variation To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/common/lib/libc/arch/arm/gen/byte_swap_2.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/common/lib/libc/arch/arm/gen/byte_swap_2.S diff -u src/common/lib/libc/arch/arm/gen/byte_swap_2.S:1.5 src/common/lib/libc/arch/arm/gen/byte_swap_2.S:1.6 --- src/common/lib/libc/arch/arm/gen/byte_swap_2.S:1.5 Tue Nov 27 23:57:07 2012 +++ src/common/lib/libc/arch/arm/gen/byte_swap_2.S Mon Aug 19 03:44:18 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: byte_swap_2.S,v 1.5 2012/11/27 23:57:07 matt Exp $ */ +/* $NetBSD: byte_swap_2.S,v 1.6 2013/08/19 03:44:18 matt Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -32,20 +32,30 @@ #include <machine/asm.h> #if defined(_KERNEL) || defined(_STANDALONE) -_ENTRY(_C_LABEL(bswap16)) +#define FUNC _C_LABEL(bswap16) #else -_ENTRY(_C_LABEL(__bswap16)) +#define FUNC _C_LABEL(__bswap16) #endif -#if BYTE_ORDER == LITTLE_ENDIAN -_ENTRY(_C_LABEL(ntohs)) -_ENTRY(_C_LABEL(htons)) -#endif -_PROF_PROLOGUE + +ENTRY(FUNC) #ifdef _ARM_ARCH_6 rev16 r0, r0 -#else +#elif !defined(__thumb__) and r1, r0, #0xff mov r0, r0, lsr #8 orr r0, r0, r1, lsl #8 +#else + movs r2, #0xff + movs r1, r0 + ands r1, r1, r2 + lsls r1, r1, #8 + lsrs r0, r0, #8 + ands r0, r0, r2 + orrs r0, r0, r1 #endif RET +END(FUNC) +#if BYTE_ORDER == LITTLE_ENDIAN +STRONG_ALIAS(_C_LABEL(ntohs), FUNC) +STRONG_ALIAS(_C_LABEL(htons), FUNC) +#endif