diff options
author | Sam Ravnborg <sam@ravnborg.org> | 2012-05-11 07:35:13 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-11 22:27:52 -0400 |
commit | ef136bc91e3a98d34f32d85ab0c79de67b4f6f87 (patch) | |
tree | 6455e0125f740e5afdb18d3c11daf2b9c2c44729 /arch/sparc | |
parent | e098ff92f65048ce327927c0ce3daed0ef34988f (diff) |
sparc32: drop sun4c user stack checking routine
With this we no longer do any run-time patchings of traps.
So drop the function + macro to support this.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc')
-rw-r--r-- | arch/sparc/include/asm/traps.h | 7 | ||||
-rw-r--r-- | arch/sparc/kernel/rtrap_32.S | 76 | ||||
-rw-r--r-- | arch/sparc/mm/srmmu.c | 14 |
3 files changed, 6 insertions, 91 deletions
diff --git a/arch/sparc/include/asm/traps.h b/arch/sparc/include/asm/traps.h index 3aa62dde343f..5fac90f18da3 100644 --- a/arch/sparc/include/asm/traps.h +++ b/arch/sparc/include/asm/traps.h | |||
@@ -31,13 +31,6 @@ extern struct tt_entry *sparc_ttable; | |||
31 | 31 | ||
32 | #define SPARC_MOV_CONST_L3(const) (0xa6102000 | (const&0xfff)) | 32 | #define SPARC_MOV_CONST_L3(const) (0xa6102000 | (const&0xfff)) |
33 | 33 | ||
34 | /* The following assumes that the branch lies before the place we | ||
35 | * are branching to. This is the case for a trap vector... | ||
36 | * You have been warned. | ||
37 | */ | ||
38 | #define SPARC_BRANCH(dest_addr, inst_addr) \ | ||
39 | (0x10800000 | (((dest_addr-inst_addr)>>2)&0x3fffff)) | ||
40 | |||
41 | #define SPARC_RD_PSR_L0 (0xa1480000) | 34 | #define SPARC_RD_PSR_L0 (0xa1480000) |
42 | #define SPARC_RD_WIM_L3 (0xa7500000) | 35 | #define SPARC_RD_WIM_L3 (0xa7500000) |
43 | #define SPARC_NOP (0x01000000) | 36 | #define SPARC_NOP (0x01000000) |
diff --git a/arch/sparc/kernel/rtrap_32.S b/arch/sparc/kernel/rtrap_32.S index 5f5f74c2c2ca..7abc24e2bf1a 100644 --- a/arch/sparc/kernel/rtrap_32.S +++ b/arch/sparc/kernel/rtrap_32.S | |||
@@ -128,13 +128,12 @@ rtrap_patch2: and %glob_tmp, 0xff, %glob_tmp | |||
128 | 128 | ||
129 | wr %glob_tmp, 0x0, %wim | 129 | wr %glob_tmp, 0x0, %wim |
130 | 130 | ||
131 | /* Here comes the architecture specific | 131 | /* Here comes the architecture specific |
132 | * branch to the user stack checking routine | 132 | * branch to the user stack checking routine |
133 | * for return from traps. | 133 | * for return from traps. |
134 | */ | 134 | */ |
135 | .globl rtrap_mmu_patchme | 135 | b srmmu_rett_stackchk |
136 | rtrap_mmu_patchme: b sun4c_rett_stackchk | 136 | andcc %fp, 0x7, %g0 |
137 | andcc %fp, 0x7, %g0 | ||
138 | 137 | ||
139 | ret_trap_userwins_ok: | 138 | ret_trap_userwins_ok: |
140 | LOAD_PT_PRIV(sp, t_psr, t_pc, t_npc) | 139 | LOAD_PT_PRIV(sp, t_psr, t_pc, t_npc) |
@@ -225,69 +224,6 @@ ret_trap_user_stack_is_bolixed: | |||
225 | b signal_p | 224 | b signal_p |
226 | ld [%curptr + TI_FLAGS], %g2 | 225 | ld [%curptr + TI_FLAGS], %g2 |
227 | 226 | ||
228 | sun4c_rett_stackchk: | ||
229 | be 1f | ||
230 | and %fp, 0xfff, %g1 ! delay slot | ||
231 | |||
232 | b ret_trap_user_stack_is_bolixed + 0x4 | ||
233 | wr %t_wim, 0x0, %wim | ||
234 | |||
235 | /* See if we have to check the sanity of one page or two */ | ||
236 | 1: | ||
237 | add %g1, 0x38, %g1 | ||
238 | sra %fp, 29, %g2 | ||
239 | add %g2, 0x1, %g2 | ||
240 | andncc %g2, 0x1, %g0 | ||
241 | be 1f | ||
242 | andncc %g1, 0xff8, %g0 | ||
243 | |||
244 | /* %sp is in vma hole, yuck */ | ||
245 | b ret_trap_user_stack_is_bolixed + 0x4 | ||
246 | wr %t_wim, 0x0, %wim | ||
247 | |||
248 | 1: | ||
249 | be sun4c_rett_onepage /* Only one page to check */ | ||
250 | lda [%fp] ASI_PTE, %g2 | ||
251 | |||
252 | sun4c_rett_twopages: | ||
253 | add %fp, 0x38, %g1 | ||
254 | sra %g1, 29, %g2 | ||
255 | add %g2, 0x1, %g2 | ||
256 | andncc %g2, 0x1, %g0 | ||
257 | be 1f | ||
258 | lda [%g1] ASI_PTE, %g2 | ||
259 | |||
260 | /* Second page is in vma hole */ | ||
261 | b ret_trap_user_stack_is_bolixed + 0x4 | ||
262 | wr %t_wim, 0x0, %wim | ||
263 | |||
264 | 1: | ||
265 | srl %g2, 29, %g2 | ||
266 | andcc %g2, 0x4, %g0 | ||
267 | bne sun4c_rett_onepage | ||
268 | lda [%fp] ASI_PTE, %g2 | ||
269 | |||
270 | /* Second page has bad perms */ | ||
271 | b ret_trap_user_stack_is_bolixed + 0x4 | ||
272 | wr %t_wim, 0x0, %wim | ||
273 | |||
274 | sun4c_rett_onepage: | ||
275 | srl %g2, 29, %g2 | ||
276 | andcc %g2, 0x4, %g0 | ||
277 | bne,a 1f | ||
278 | restore %g0, %g0, %g0 | ||
279 | |||
280 | /* A page had bad page permissions, losing... */ | ||
281 | b ret_trap_user_stack_is_bolixed + 0x4 | ||
282 | wr %t_wim, 0x0, %wim | ||
283 | |||
284 | /* Whee, things are ok, load the window and continue. */ | ||
285 | 1: | ||
286 | LOAD_WINDOW(sp) | ||
287 | |||
288 | b ret_trap_userwins_ok | ||
289 | save %g0, %g0, %g0 | ||
290 | |||
291 | .globl srmmu_rett_stackchk | 227 | .globl srmmu_rett_stackchk |
292 | srmmu_rett_stackchk: | 228 | srmmu_rett_stackchk: |
293 | bne ret_trap_user_stack_is_bolixed | 229 | bne ret_trap_user_stack_is_bolixed |
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c index deb7dd8ea975..a948ee52e268 100644 --- a/arch/sparc/mm/srmmu.c +++ b/arch/sparc/mm/srmmu.c | |||
@@ -2134,19 +2134,6 @@ extern unsigned long spwin_mmu_patchme, fwin_mmu_patchme, | |||
2134 | extern unsigned long spwin_srmmu_stackchk, srmmu_fwin_stackchk, | 2134 | extern unsigned long spwin_srmmu_stackchk, srmmu_fwin_stackchk, |
2135 | tsetup_srmmu_stackchk, srmmu_rett_stackchk; | 2135 | tsetup_srmmu_stackchk, srmmu_rett_stackchk; |
2136 | 2136 | ||
2137 | #define PATCH_BRANCH(insn, dest) do { \ | ||
2138 | iaddr = &(insn); \ | ||
2139 | daddr = &(dest); \ | ||
2140 | *iaddr = SPARC_BRANCH((unsigned long) daddr, (unsigned long) iaddr); \ | ||
2141 | } while(0) | ||
2142 | |||
2143 | static void __init patch_window_trap_handlers(void) | ||
2144 | { | ||
2145 | unsigned long *iaddr, *daddr; | ||
2146 | |||
2147 | PATCH_BRANCH(rtrap_mmu_patchme, srmmu_rett_stackchk); | ||
2148 | } | ||
2149 | |||
2150 | #ifdef CONFIG_SMP | 2137 | #ifdef CONFIG_SMP |
2151 | /* Local cross-calls. */ | 2138 | /* Local cross-calls. */ |
2152 | static void smp_flush_page_for_dma(unsigned long page) | 2139 | static void smp_flush_page_for_dma(unsigned long page) |
@@ -2270,7 +2257,6 @@ void __init ld_mmu_srmmu(void) | |||
2270 | BTFIXUPSET_CALL(pgoff_to_pte, srmmu_pgoff_to_pte, BTFIXUPCALL_NORM); | 2257 | BTFIXUPSET_CALL(pgoff_to_pte, srmmu_pgoff_to_pte, BTFIXUPCALL_NORM); |
2271 | 2258 | ||
2272 | get_srmmu_type(); | 2259 | get_srmmu_type(); |
2273 | patch_window_trap_handlers(); | ||
2274 | 2260 | ||
2275 | #ifdef CONFIG_SMP | 2261 | #ifdef CONFIG_SMP |
2276 | /* El switcheroo... */ | 2262 | /* El switcheroo... */ |