diff options
Diffstat (limited to 'arch/arm/include')
-rw-r--r-- | arch/arm/include/asm/assembler.h | 133 | ||||
-rw-r--r-- | arch/arm/include/asm/elf.h | 3 | ||||
-rw-r--r-- | arch/arm/include/asm/ftrace.h | 1 | ||||
-rw-r--r-- | arch/arm/include/asm/futex.h | 1 | ||||
-rw-r--r-- | arch/arm/include/asm/memory.h | 6 | ||||
-rw-r--r-- | arch/arm/include/asm/mmu_context.h | 2 | ||||
-rw-r--r-- | arch/arm/include/asm/page-nommu.h | 3 | ||||
-rw-r--r-- | arch/arm/include/asm/ptrace.h | 8 | ||||
-rw-r--r-- | arch/arm/include/asm/tlb.h | 4 | ||||
-rw-r--r-- | arch/arm/include/asm/uaccess.h | 7 | ||||
-rw-r--r-- | arch/arm/include/asm/unified.h | 126 |
11 files changed, 282 insertions, 12 deletions
diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h index 15f8a092b700..00f46d9ce299 100644 --- a/arch/arm/include/asm/assembler.h +++ b/arch/arm/include/asm/assembler.h | |||
@@ -74,23 +74,56 @@ | |||
74 | * Enable and disable interrupts | 74 | * Enable and disable interrupts |
75 | */ | 75 | */ |
76 | #if __LINUX_ARM_ARCH__ >= 6 | 76 | #if __LINUX_ARM_ARCH__ >= 6 |
77 | .macro disable_irq | 77 | .macro disable_irq_notrace |
78 | cpsid i | 78 | cpsid i |
79 | .endm | 79 | .endm |
80 | 80 | ||
81 | .macro enable_irq | 81 | .macro enable_irq_notrace |
82 | cpsie i | 82 | cpsie i |
83 | .endm | 83 | .endm |
84 | #else | 84 | #else |
85 | .macro disable_irq | 85 | .macro disable_irq_notrace |
86 | msr cpsr_c, #PSR_I_BIT | SVC_MODE | 86 | msr cpsr_c, #PSR_I_BIT | SVC_MODE |
87 | .endm | 87 | .endm |
88 | 88 | ||
89 | .macro enable_irq | 89 | .macro enable_irq_notrace |
90 | msr cpsr_c, #SVC_MODE | 90 | msr cpsr_c, #SVC_MODE |
91 | .endm | 91 | .endm |
92 | #endif | 92 | #endif |
93 | 93 | ||
94 | .macro asm_trace_hardirqs_off | ||
95 | #if defined(CONFIG_TRACE_IRQFLAGS) | ||
96 | stmdb sp!, {r0-r3, ip, lr} | ||
97 | bl trace_hardirqs_off | ||
98 | ldmia sp!, {r0-r3, ip, lr} | ||
99 | #endif | ||
100 | .endm | ||
101 | |||
102 | .macro asm_trace_hardirqs_on_cond, cond | ||
103 | #if defined(CONFIG_TRACE_IRQFLAGS) | ||
104 | /* | ||
105 | * actually the registers should be pushed and pop'd conditionally, but | ||
106 | * after bl the flags are certainly clobbered | ||
107 | */ | ||
108 | stmdb sp!, {r0-r3, ip, lr} | ||
109 | bl\cond trace_hardirqs_on | ||
110 | ldmia sp!, {r0-r3, ip, lr} | ||
111 | #endif | ||
112 | .endm | ||
113 | |||
114 | .macro asm_trace_hardirqs_on | ||
115 | asm_trace_hardirqs_on_cond al | ||
116 | .endm | ||
117 | |||
118 | .macro disable_irq | ||
119 | disable_irq_notrace | ||
120 | asm_trace_hardirqs_off | ||
121 | .endm | ||
122 | |||
123 | .macro enable_irq | ||
124 | asm_trace_hardirqs_on | ||
125 | enable_irq_notrace | ||
126 | .endm | ||
94 | /* | 127 | /* |
95 | * Save the current IRQ state and disable IRQs. Note that this macro | 128 | * Save the current IRQ state and disable IRQs. Note that this macro |
96 | * assumes FIQs are enabled, and that the processor is in SVC mode. | 129 | * assumes FIQs are enabled, and that the processor is in SVC mode. |
@@ -104,10 +137,16 @@ | |||
104 | * Restore interrupt state previously stored in a register. We don't | 137 | * Restore interrupt state previously stored in a register. We don't |
105 | * guarantee that this will preserve the flags. | 138 | * guarantee that this will preserve the flags. |
106 | */ | 139 | */ |
107 | .macro restore_irqs, oldcpsr | 140 | .macro restore_irqs_notrace, oldcpsr |
108 | msr cpsr_c, \oldcpsr | 141 | msr cpsr_c, \oldcpsr |
109 | .endm | 142 | .endm |
110 | 143 | ||
144 | .macro restore_irqs, oldcpsr | ||
145 | tst \oldcpsr, #PSR_I_BIT | ||
146 | asm_trace_hardirqs_on_cond eq | ||
147 | restore_irqs_notrace \oldcpsr | ||
148 | .endm | ||
149 | |||
111 | #define USER(x...) \ | 150 | #define USER(x...) \ |
112 | 9999: x; \ | 151 | 9999: x; \ |
113 | .section __ex_table,"a"; \ | 152 | .section __ex_table,"a"; \ |
@@ -127,3 +166,87 @@ | |||
127 | #endif | 166 | #endif |
128 | #endif | 167 | #endif |
129 | .endm | 168 | .endm |
169 | |||
170 | #ifdef CONFIG_THUMB2_KERNEL | ||
171 | .macro setmode, mode, reg | ||
172 | mov \reg, #\mode | ||
173 | msr cpsr_c, \reg | ||
174 | .endm | ||
175 | #else | ||
176 | .macro setmode, mode, reg | ||
177 | msr cpsr_c, #\mode | ||
178 | .endm | ||
179 | #endif | ||
180 | |||
181 | /* | ||
182 | * STRT/LDRT access macros with ARM and Thumb-2 variants | ||
183 | */ | ||
184 | #ifdef CONFIG_THUMB2_KERNEL | ||
185 | |||
186 | .macro usraccoff, instr, reg, ptr, inc, off, cond, abort | ||
187 | 9999: | ||
188 | .if \inc == 1 | ||
189 | \instr\cond\()bt \reg, [\ptr, #\off] | ||
190 | .elseif \inc == 4 | ||
191 | \instr\cond\()t \reg, [\ptr, #\off] | ||
192 | .else | ||
193 | .error "Unsupported inc macro argument" | ||
194 | .endif | ||
195 | |||
196 | .section __ex_table,"a" | ||
197 | .align 3 | ||
198 | .long 9999b, \abort | ||
199 | .previous | ||
200 | .endm | ||
201 | |||
202 | .macro usracc, instr, reg, ptr, inc, cond, rept, abort | ||
203 | @ explicit IT instruction needed because of the label | ||
204 | @ introduced by the USER macro | ||
205 | .ifnc \cond,al | ||
206 | .if \rept == 1 | ||
207 | itt \cond | ||
208 | .elseif \rept == 2 | ||
209 | ittt \cond | ||
210 | .else | ||
211 | .error "Unsupported rept macro argument" | ||
212 | .endif | ||
213 | .endif | ||
214 | |||
215 | @ Slightly optimised to avoid incrementing the pointer twice | ||
216 | usraccoff \instr, \reg, \ptr, \inc, 0, \cond, \abort | ||
217 | .if \rept == 2 | ||
218 | usraccoff \instr, \reg, \ptr, \inc, 4, \cond, \abort | ||
219 | .endif | ||
220 | |||
221 | add\cond \ptr, #\rept * \inc | ||
222 | .endm | ||
223 | |||
224 | #else /* !CONFIG_THUMB2_KERNEL */ | ||
225 | |||
226 | .macro usracc, instr, reg, ptr, inc, cond, rept, abort | ||
227 | .rept \rept | ||
228 | 9999: | ||
229 | .if \inc == 1 | ||
230 | \instr\cond\()bt \reg, [\ptr], #\inc | ||
231 | .elseif \inc == 4 | ||
232 | \instr\cond\()t \reg, [\ptr], #\inc | ||
233 | .else | ||
234 | .error "Unsupported inc macro argument" | ||
235 | .endif | ||
236 | |||
237 | .section __ex_table,"a" | ||
238 | .align 3 | ||
239 | .long 9999b, \abort | ||
240 | .previous | ||
241 | .endr | ||
242 | .endm | ||
243 | |||
244 | #endif /* CONFIG_THUMB2_KERNEL */ | ||
245 | |||
246 | .macro strusr, reg, ptr, inc, cond=al, rept=1, abort=9001f | ||
247 | usracc str, \reg, \ptr, \inc, \cond, \rept, \abort | ||
248 | .endm | ||
249 | |||
250 | .macro ldrusr, reg, ptr, inc, cond=al, rept=1, abort=9001f | ||
251 | usracc ldr, \reg, \ptr, \inc, \cond, \rept, \abort | ||
252 | .endm | ||
diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h index c207504de84d..c3b911ee9151 100644 --- a/arch/arm/include/asm/elf.h +++ b/arch/arm/include/asm/elf.h | |||
@@ -55,6 +55,9 @@ typedef struct user_fp elf_fpregset_t; | |||
55 | #define R_ARM_MOVW_ABS_NC 43 | 55 | #define R_ARM_MOVW_ABS_NC 43 |
56 | #define R_ARM_MOVT_ABS 44 | 56 | #define R_ARM_MOVT_ABS 44 |
57 | 57 | ||
58 | #define R_ARM_THM_CALL 10 | ||
59 | #define R_ARM_THM_JUMP24 30 | ||
60 | |||
58 | /* | 61 | /* |
59 | * These are used to set parameters in the core dumps. | 62 | * These are used to set parameters in the core dumps. |
60 | */ | 63 | */ |
diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h index d74265cffd86..103f7ee97313 100644 --- a/arch/arm/include/asm/ftrace.h +++ b/arch/arm/include/asm/ftrace.h | |||
@@ -7,6 +7,7 @@ | |||
7 | 7 | ||
8 | #ifndef __ASSEMBLY__ | 8 | #ifndef __ASSEMBLY__ |
9 | extern void mcount(void); | 9 | extern void mcount(void); |
10 | extern void __gnu_mcount_nc(void); | ||
10 | #endif | 11 | #endif |
11 | 12 | ||
12 | #endif | 13 | #endif |
diff --git a/arch/arm/include/asm/futex.h b/arch/arm/include/asm/futex.h index 9ee743b95de8..bfcc15929a7f 100644 --- a/arch/arm/include/asm/futex.h +++ b/arch/arm/include/asm/futex.h | |||
@@ -99,6 +99,7 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) | |||
99 | __asm__ __volatile__("@futex_atomic_cmpxchg_inatomic\n" | 99 | __asm__ __volatile__("@futex_atomic_cmpxchg_inatomic\n" |
100 | "1: ldrt %0, [%3]\n" | 100 | "1: ldrt %0, [%3]\n" |
101 | " teq %0, %1\n" | 101 | " teq %0, %1\n" |
102 | " it eq @ explicit IT needed for the 2b label\n" | ||
102 | "2: streqt %2, [%3]\n" | 103 | "2: streqt %2, [%3]\n" |
103 | "3:\n" | 104 | "3:\n" |
104 | " .section __ex_table,\"a\"\n" | 105 | " .section __ex_table,\"a\"\n" |
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index 85763db87449..376be1a62866 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h | |||
@@ -44,7 +44,13 @@ | |||
44 | * The module space lives between the addresses given by TASK_SIZE | 44 | * The module space lives between the addresses given by TASK_SIZE |
45 | * and PAGE_OFFSET - it must be within 32MB of the kernel text. | 45 | * and PAGE_OFFSET - it must be within 32MB of the kernel text. |
46 | */ | 46 | */ |
47 | #ifndef CONFIG_THUMB2_KERNEL | ||
47 | #define MODULES_VADDR (PAGE_OFFSET - 16*1024*1024) | 48 | #define MODULES_VADDR (PAGE_OFFSET - 16*1024*1024) |
49 | #else | ||
50 | /* smaller range for Thumb-2 symbols relocation (2^24)*/ | ||
51 | #define MODULES_VADDR (PAGE_OFFSET - 8*1024*1024) | ||
52 | #endif | ||
53 | |||
48 | #if TASK_SIZE > MODULES_VADDR | 54 | #if TASK_SIZE > MODULES_VADDR |
49 | #error Top of user space clashes with start of module space | 55 | #error Top of user space clashes with start of module space |
50 | #endif | 56 | #endif |
diff --git a/arch/arm/include/asm/mmu_context.h b/arch/arm/include/asm/mmu_context.h index 263fed05ea33..bcdb9291ef0c 100644 --- a/arch/arm/include/asm/mmu_context.h +++ b/arch/arm/include/asm/mmu_context.h | |||
@@ -62,8 +62,10 @@ static inline void check_context(struct mm_struct *mm) | |||
62 | 62 | ||
63 | static inline void check_context(struct mm_struct *mm) | 63 | static inline void check_context(struct mm_struct *mm) |
64 | { | 64 | { |
65 | #ifdef CONFIG_MMU | ||
65 | if (unlikely(mm->context.kvm_seq != init_mm.context.kvm_seq)) | 66 | if (unlikely(mm->context.kvm_seq != init_mm.context.kvm_seq)) |
66 | __check_kvm_seq(mm); | 67 | __check_kvm_seq(mm); |
68 | #endif | ||
67 | } | 69 | } |
68 | 70 | ||
69 | #define init_new_context(tsk,mm) 0 | 71 | #define init_new_context(tsk,mm) 0 |
diff --git a/arch/arm/include/asm/page-nommu.h b/arch/arm/include/asm/page-nommu.h index 3574c0deb37f..d1b162a18dcb 100644 --- a/arch/arm/include/asm/page-nommu.h +++ b/arch/arm/include/asm/page-nommu.h | |||
@@ -43,7 +43,4 @@ typedef unsigned long pgprot_t; | |||
43 | #define __pmd(x) (x) | 43 | #define __pmd(x) (x) |
44 | #define __pgprot(x) (x) | 44 | #define __pgprot(x) (x) |
45 | 45 | ||
46 | extern unsigned long memory_start; | ||
47 | extern unsigned long memory_end; | ||
48 | |||
49 | #endif | 46 | #endif |
diff --git a/arch/arm/include/asm/ptrace.h b/arch/arm/include/asm/ptrace.h index 67b833c9b6b9..bbecccda76d0 100644 --- a/arch/arm/include/asm/ptrace.h +++ b/arch/arm/include/asm/ptrace.h | |||
@@ -82,6 +82,14 @@ | |||
82 | #define PSR_ENDSTATE 0 | 82 | #define PSR_ENDSTATE 0 |
83 | #endif | 83 | #endif |
84 | 84 | ||
85 | /* | ||
86 | * These are 'magic' values for PTRACE_PEEKUSR that return info about where a | ||
87 | * process is located in memory. | ||
88 | */ | ||
89 | #define PT_TEXT_ADDR 0x10000 | ||
90 | #define PT_DATA_ADDR 0x10004 | ||
91 | #define PT_TEXT_END_ADDR 0x10008 | ||
92 | |||
85 | #ifndef __ASSEMBLY__ | 93 | #ifndef __ASSEMBLY__ |
86 | 94 | ||
87 | /* | 95 | /* |
diff --git a/arch/arm/include/asm/tlb.h b/arch/arm/include/asm/tlb.h index 321c83e43a1e..f41a6f57cd12 100644 --- a/arch/arm/include/asm/tlb.h +++ b/arch/arm/include/asm/tlb.h | |||
@@ -102,8 +102,8 @@ tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vma) | |||
102 | } | 102 | } |
103 | 103 | ||
104 | #define tlb_remove_page(tlb,page) free_page_and_swap_cache(page) | 104 | #define tlb_remove_page(tlb,page) free_page_and_swap_cache(page) |
105 | #define pte_free_tlb(tlb, ptep) pte_free((tlb)->mm, ptep) | 105 | #define pte_free_tlb(tlb, ptep, addr) pte_free((tlb)->mm, ptep) |
106 | #define pmd_free_tlb(tlb, pmdp) pmd_free((tlb)->mm, pmdp) | 106 | #define pmd_free_tlb(tlb, pmdp, addr) pmd_free((tlb)->mm, pmdp) |
107 | 107 | ||
108 | #define tlb_migrate_finish(mm) do { } while (0) | 108 | #define tlb_migrate_finish(mm) do { } while (0) |
109 | 109 | ||
diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h index 0da9bc9b3b1d..1d6bd40a4322 100644 --- a/arch/arm/include/asm/uaccess.h +++ b/arch/arm/include/asm/uaccess.h | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <asm/memory.h> | 17 | #include <asm/memory.h> |
18 | #include <asm/domain.h> | 18 | #include <asm/domain.h> |
19 | #include <asm/system.h> | 19 | #include <asm/system.h> |
20 | #include <asm/unified.h> | ||
20 | 21 | ||
21 | #define VERIFY_READ 0 | 22 | #define VERIFY_READ 0 |
22 | #define VERIFY_WRITE 1 | 23 | #define VERIFY_WRITE 1 |
@@ -365,8 +366,10 @@ do { \ | |||
365 | 366 | ||
366 | #define __put_user_asm_dword(x,__pu_addr,err) \ | 367 | #define __put_user_asm_dword(x,__pu_addr,err) \ |
367 | __asm__ __volatile__( \ | 368 | __asm__ __volatile__( \ |
368 | "1: strt " __reg_oper1 ", [%1], #4\n" \ | 369 | ARM( "1: strt " __reg_oper1 ", [%1], #4\n" ) \ |
369 | "2: strt " __reg_oper0 ", [%1]\n" \ | 370 | ARM( "2: strt " __reg_oper0 ", [%1]\n" ) \ |
371 | THUMB( "1: strt " __reg_oper1 ", [%1]\n" ) \ | ||
372 | THUMB( "2: strt " __reg_oper0 ", [%1, #4]\n" ) \ | ||
370 | "3:\n" \ | 373 | "3:\n" \ |
371 | " .section .fixup,\"ax\"\n" \ | 374 | " .section .fixup,\"ax\"\n" \ |
372 | " .align 2\n" \ | 375 | " .align 2\n" \ |
diff --git a/arch/arm/include/asm/unified.h b/arch/arm/include/asm/unified.h new file mode 100644 index 000000000000..073e85b9b961 --- /dev/null +++ b/arch/arm/include/asm/unified.h | |||
@@ -0,0 +1,126 @@ | |||
1 | /* | ||
2 | * include/asm-arm/unified.h - Unified Assembler Syntax helper macros | ||
3 | * | ||
4 | * Copyright (C) 2008 ARM Limited | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #ifndef __ASM_UNIFIED_H | ||
21 | #define __ASM_UNIFIED_H | ||
22 | |||
23 | #if defined(__ASSEMBLY__) && defined(CONFIG_ARM_ASM_UNIFIED) | ||
24 | .syntax unified | ||
25 | #endif | ||
26 | |||
27 | #ifdef CONFIG_THUMB2_KERNEL | ||
28 | |||
29 | #if __GNUC__ < 4 | ||
30 | #error Thumb-2 kernel requires gcc >= 4 | ||
31 | #endif | ||
32 | |||
33 | /* The CPSR bit describing the instruction set (Thumb) */ | ||
34 | #define PSR_ISETSTATE PSR_T_BIT | ||
35 | |||
36 | #define ARM(x...) | ||
37 | #define THUMB(x...) x | ||
38 | #define W(instr) instr.w | ||
39 | #define BSYM(sym) sym + 1 | ||
40 | |||
41 | #else /* !CONFIG_THUMB2_KERNEL */ | ||
42 | |||
43 | /* The CPSR bit describing the instruction set (ARM) */ | ||
44 | #define PSR_ISETSTATE 0 | ||
45 | |||
46 | #define ARM(x...) x | ||
47 | #define THUMB(x...) | ||
48 | #define W(instr) instr | ||
49 | #define BSYM(sym) sym | ||
50 | |||
51 | #endif /* CONFIG_THUMB2_KERNEL */ | ||
52 | |||
53 | #ifndef CONFIG_ARM_ASM_UNIFIED | ||
54 | |||
55 | /* | ||
56 | * If the unified assembly syntax isn't used (in ARM mode), these | ||
57 | * macros expand to an empty string | ||
58 | */ | ||
59 | #ifdef __ASSEMBLY__ | ||
60 | .macro it, cond | ||
61 | .endm | ||
62 | .macro itt, cond | ||
63 | .endm | ||
64 | .macro ite, cond | ||
65 | .endm | ||
66 | .macro ittt, cond | ||
67 | .endm | ||
68 | .macro itte, cond | ||
69 | .endm | ||
70 | .macro itet, cond | ||
71 | .endm | ||
72 | .macro itee, cond | ||
73 | .endm | ||
74 | .macro itttt, cond | ||
75 | .endm | ||
76 | .macro ittte, cond | ||
77 | .endm | ||
78 | .macro ittet, cond | ||
79 | .endm | ||
80 | .macro ittee, cond | ||
81 | .endm | ||
82 | .macro itett, cond | ||
83 | .endm | ||
84 | .macro itete, cond | ||
85 | .endm | ||
86 | .macro iteet, cond | ||
87 | .endm | ||
88 | .macro iteee, cond | ||
89 | .endm | ||
90 | #else /* !__ASSEMBLY__ */ | ||
91 | __asm__( | ||
92 | " .macro it, cond\n" | ||
93 | " .endm\n" | ||
94 | " .macro itt, cond\n" | ||
95 | " .endm\n" | ||
96 | " .macro ite, cond\n" | ||
97 | " .endm\n" | ||
98 | " .macro ittt, cond\n" | ||
99 | " .endm\n" | ||
100 | " .macro itte, cond\n" | ||
101 | " .endm\n" | ||
102 | " .macro itet, cond\n" | ||
103 | " .endm\n" | ||
104 | " .macro itee, cond\n" | ||
105 | " .endm\n" | ||
106 | " .macro itttt, cond\n" | ||
107 | " .endm\n" | ||
108 | " .macro ittte, cond\n" | ||
109 | " .endm\n" | ||
110 | " .macro ittet, cond\n" | ||
111 | " .endm\n" | ||
112 | " .macro ittee, cond\n" | ||
113 | " .endm\n" | ||
114 | " .macro itett, cond\n" | ||
115 | " .endm\n" | ||
116 | " .macro itete, cond\n" | ||
117 | " .endm\n" | ||
118 | " .macro iteet, cond\n" | ||
119 | " .endm\n" | ||
120 | " .macro iteee, cond\n" | ||
121 | " .endm\n"); | ||
122 | #endif /* __ASSEMBLY__ */ | ||
123 | |||
124 | #endif /* CONFIG_ARM_ASM_UNIFIED */ | ||
125 | |||
126 | #endif /* !__ASM_UNIFIED_H */ | ||