aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arc/kernel/unaligned.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-09-09 12:05:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-09 12:05:33 -0400
commit89c5a9461d02613c829cf9beffdc3d3c6c3df401 (patch)
treee0c6ada024a32da3cd6bb4b4f0469d66e5df45c9 /arch/arc/kernel/unaligned.c
parent833ae40b517a99e05fc4aea399e71f633f3348d2 (diff)
parent07b9b65147d1d7cc03b9ff1e1f3b1c163ba4d067 (diff)
Merge tag 'arc-v3.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc
Pull ARC changes from Vineet Gupta: - ARC MM changes: - preparation for MMUv4 (accomodate new PTE bits, new cmds) - Rework the ASID allocation algorithm to remove asid-mm reverse map - Boilerplate code consolidation in Exception Handlers - Disable FRAME_POINTER for ARC - Unaligned Access Emulation for Big-Endian from Noam - Bunch of fixes (udelay, missing accessors) from Mischa * tag 'arc-v3.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc: ARC: fix new Section mismatches in build (post __cpuinit cleanup) Kconfig.debug: Add FRAME_POINTER anti-dependency for ARC ARC: Fix __udelay calculation ARC: remove console_verbose() from setup_arch() ARC: Add read*_relaxed to asm/io.h ARC: Handle un-aligned user space access in BE. ARC: [ASID] Track ASID allocation cycles/generations ARC: [ASID] activate_mm() == switch_mm() ARC: [ASID] get_new_mmu_context() to conditionally allocate new ASID ARC: [ASID] Refactor the TLB paranoid debug code ARC: [ASID] Remove legacy/unused debug code ARC: No need to flush the TLB in early boot ARC: MMUv4 preps/3 - Abstract out TLB Insert/Delete ARC: MMUv4 preps/2 - Reshuffle PTE bits ARC: MMUv4 preps/1 - Fold PTE K/U access flags ARC: Code cosmetics (Nothing semantical) ARC: Entry Handler tweaks: Optimize away redundant IRQ_DISABLE_SAVE ARC: Exception Handlers Code consolidation ARC: Add some .gitignore entries
Diffstat (limited to 'arch/arc/kernel/unaligned.c')
-rw-r--r--arch/arc/kernel/unaligned.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/arch/arc/kernel/unaligned.c b/arch/arc/kernel/unaligned.c
index c0f832f595d3..28d170060747 100644
--- a/arch/arc/kernel/unaligned.c
+++ b/arch/arc/kernel/unaligned.c
@@ -16,6 +16,16 @@
16#include <linux/uaccess.h> 16#include <linux/uaccess.h>
17#include <asm/disasm.h> 17#include <asm/disasm.h>
18 18
19#ifdef CONFIG_CPU_BIG_ENDIAN
20#define BE 1
21#define FIRST_BYTE_16 "swap %1, %1\n swape %1, %1\n"
22#define FIRST_BYTE_32 "swape %1, %1\n"
23#else
24#define BE 0
25#define FIRST_BYTE_16
26#define FIRST_BYTE_32
27#endif
28
19#define __get8_unaligned_check(val, addr, err) \ 29#define __get8_unaligned_check(val, addr, err) \
20 __asm__( \ 30 __asm__( \
21 "1: ldb.ab %1, [%2, 1]\n" \ 31 "1: ldb.ab %1, [%2, 1]\n" \
@@ -36,9 +46,9 @@
36 do { \ 46 do { \
37 unsigned int err = 0, v, a = addr; \ 47 unsigned int err = 0, v, a = addr; \
38 __get8_unaligned_check(v, a, err); \ 48 __get8_unaligned_check(v, a, err); \
39 val = v ; \ 49 val = v << ((BE) ? 8 : 0); \
40 __get8_unaligned_check(v, a, err); \ 50 __get8_unaligned_check(v, a, err); \
41 val |= v << 8; \ 51 val |= v << ((BE) ? 0 : 8); \
42 if (err) \ 52 if (err) \
43 goto fault; \ 53 goto fault; \
44 } while (0) 54 } while (0)
@@ -47,13 +57,13 @@
47 do { \ 57 do { \
48 unsigned int err = 0, v, a = addr; \ 58 unsigned int err = 0, v, a = addr; \
49 __get8_unaligned_check(v, a, err); \ 59 __get8_unaligned_check(v, a, err); \
50 val = v << 0; \ 60 val = v << ((BE) ? 24 : 0); \
51 __get8_unaligned_check(v, a, err); \ 61 __get8_unaligned_check(v, a, err); \
52 val |= v << 8; \ 62 val |= v << ((BE) ? 16 : 8); \
53 __get8_unaligned_check(v, a, err); \ 63 __get8_unaligned_check(v, a, err); \
54 val |= v << 16; \ 64 val |= v << ((BE) ? 8 : 16); \
55 __get8_unaligned_check(v, a, err); \ 65 __get8_unaligned_check(v, a, err); \
56 val |= v << 24; \ 66 val |= v << ((BE) ? 0 : 24); \
57 if (err) \ 67 if (err) \
58 goto fault; \ 68 goto fault; \
59 } while (0) 69 } while (0)
@@ -63,6 +73,7 @@
63 unsigned int err = 0, v = val, a = addr;\ 73 unsigned int err = 0, v = val, a = addr;\
64 \ 74 \
65 __asm__( \ 75 __asm__( \
76 FIRST_BYTE_16 \
66 "1: stb.ab %1, [%2, 1]\n" \ 77 "1: stb.ab %1, [%2, 1]\n" \
67 " lsr %1, %1, 8\n" \ 78 " lsr %1, %1, 8\n" \
68 "2: stb %1, [%2]\n" \ 79 "2: stb %1, [%2]\n" \
@@ -87,8 +98,9 @@
87#define put32_unaligned_check(val, addr) \ 98#define put32_unaligned_check(val, addr) \
88 do { \ 99 do { \
89 unsigned int err = 0, v = val, a = addr;\ 100 unsigned int err = 0, v = val, a = addr;\
90 __asm__( \
91 \ 101 \
102 __asm__( \
103 FIRST_BYTE_32 \
92 "1: stb.ab %1, [%2, 1]\n" \ 104 "1: stb.ab %1, [%2, 1]\n" \
93 " lsr %1, %1, 8\n" \ 105 " lsr %1, %1, 8\n" \
94 "2: stb.ab %1, [%2, 1]\n" \ 106 "2: stb.ab %1, [%2, 1]\n" \