diff options
author | Chris Metcalf <cmetcalf@tilera.com> | 2012-03-29 13:30:31 -0400 |
---|---|---|
committer | Chris Metcalf <cmetcalf@tilera.com> | 2012-05-25 12:48:22 -0400 |
commit | 1efea40d4172a2a475ccb29b59d6221e9d0c174b (patch) | |
tree | 8152b61bb3fa83eb3403bca5cb05731c1063e999 /arch/tile/lib/memcpy_64.c | |
parent | 73636b1aacb1a07e6fbe0d25e560e69b024a8e25 (diff) | |
download | linux-3.10-1efea40d4172a2a475ccb29b59d6221e9d0c174b.tar.gz linux-3.10-1efea40d4172a2a475ccb29b59d6221e9d0c174b.tar.bz2 linux-3.10-1efea40d4172a2a475ccb29b59d6221e9d0c174b.zip |
arch/tile: support building big-endian kernel
The toolchain supports big-endian mode now, so add support for building
the kernel to run big-endian as well.
Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Diffstat (limited to 'arch/tile/lib/memcpy_64.c')
-rw-r--r-- | arch/tile/lib/memcpy_64.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/arch/tile/lib/memcpy_64.c b/arch/tile/lib/memcpy_64.c index 3fab9a6a2bb..c79b8e7c682 100644 --- a/arch/tile/lib/memcpy_64.c +++ b/arch/tile/lib/memcpy_64.c @@ -15,7 +15,6 @@ #include <linux/types.h> #include <linux/string.h> #include <linux/module.h> -#define __memcpy memcpy /* EXPORT_SYMBOL() is in arch/tile/lib/exports.c since this should be asm. */ /* Must be 8 bytes in size. */ @@ -188,6 +187,7 @@ int USERCOPY_FUNC(void *__restrict dstv, const void *__restrict srcv, size_t n) /* n != 0 if we get here. Write out any trailing bytes. */ dst1 = (char *)dst8; +#ifndef __BIG_ENDIAN__ if (n & 4) { ST4((uint32_t *)dst1, final); dst1 += 4; @@ -202,11 +202,30 @@ int USERCOPY_FUNC(void *__restrict dstv, const void *__restrict srcv, size_t n) } if (n) ST1((uint8_t *)dst1, final); +#else + if (n & 4) { + ST4((uint32_t *)dst1, final >> 32); + dst1 += 4; + } + else + { + final >>= 32; + } + if (n & 2) { + ST2((uint16_t *)dst1, final >> 16); + dst1 += 2; + } + else + { + final >>= 16; + } + if (n & 1) + ST1((uint8_t *)dst1, final >> 8); +#endif return RETVAL; } - #ifdef USERCOPY_FUNC #undef ST1 #undef ST2 |