aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc
diff options
context:
space:
mode:
authorSam Ravnborg <sam@ravnborg.org>2012-05-25 17:20:16 -0400
committerDavid S. Miller <davem@davemloft.net>2012-05-28 02:52:49 -0400
commit1ec8cf62338b950fdbf76bbdfa3064bc1c0b7a81 (patch)
tree38209aea44a013707f2530802cefd233afcf0f81 /arch/sparc
parent080f88837b489ff53c9ca62bc3adefdf74eb61e8 (diff)
sparc32: introduce support for run-time patching for all shared assembler code
All users of MMUREGS ASI in kernel/ now uses run-time patching. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Daniel Hellstrom <daniel@gaisler.com> Cc: Konrad Eisele <konrad@gaisler.com>
Diffstat (limited to 'arch/sparc')
-rw-r--r--arch/sparc/kernel/entry.S7
-rw-r--r--arch/sparc/kernel/etrap_32.S18
-rw-r--r--arch/sparc/kernel/rtrap_32.S18
-rw-r--r--arch/sparc/kernel/wof.S18
-rw-r--r--arch/sparc/kernel/wuf.S27
5 files changed, 59 insertions, 29 deletions
diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S
index 8550f10af453..dcaa1cf0de40 100644
--- a/arch/sparc/kernel/entry.S
+++ b/arch/sparc/kernel/entry.S
@@ -767,8 +767,11 @@ srmmu_fault:
767 mov 0x400, %l5 767 mov 0x400, %l5
768 mov 0x300, %l4 768 mov 0x300, %l4
769 769
770 lda [%l5] ASI_M_MMUREGS, %l6 ! read sfar first 770LEON_PI(lda [%l5] ASI_LEON_MMUREGS, %l6) ! read sfar first
771 lda [%l4] ASI_M_MMUREGS, %l5 ! read sfsr last 771SUN_PI_(lda [%l5] ASI_M_MMUREGS, %l6) ! read sfar first
772
773LEON_PI(lda [%l4] ASI_LEON_MMUREGS, %l5) ! read sfsr last
774SUN_PI_(lda [%l4] ASI_M_MMUREGS, %l5) ! read sfsr last
772 775
773 andn %l6, 0xfff, %l6 776 andn %l6, 0xfff, %l6
774 srl %l5, 6, %l5 ! and encode all info into l7 777 srl %l5, 6, %l5 ! and encode all info into l7
diff --git a/arch/sparc/kernel/etrap_32.S b/arch/sparc/kernel/etrap_32.S
index 84b5f0d2afde..e3e80d65e39a 100644
--- a/arch/sparc/kernel/etrap_32.S
+++ b/arch/sparc/kernel/etrap_32.S
@@ -234,7 +234,8 @@ tsetup_srmmu_stackchk:
234 234
235 cmp %glob_tmp, %sp 235 cmp %glob_tmp, %sp
236 bleu,a 1f 236 bleu,a 1f
237 lda [%g0] ASI_M_MMUREGS, %glob_tmp ! read MMU control 237LEON_PI( lda [%g0] ASI_LEON_MMUREGS, %glob_tmp) ! read MMU control
238SUN_PI_( lda [%g0] ASI_M_MMUREGS, %glob_tmp) ! read MMU control
238 239
239trap_setup_user_stack_is_bolixed: 240trap_setup_user_stack_is_bolixed:
240 /* From user/kernel into invalid window w/bad user 241 /* From user/kernel into invalid window w/bad user
@@ -249,18 +250,25 @@ trap_setup_user_stack_is_bolixed:
2491: 2501:
250 /* Clear the fault status and turn on the no_fault bit. */ 251 /* Clear the fault status and turn on the no_fault bit. */
251 or %glob_tmp, 0x2, %glob_tmp ! or in no_fault bit 252 or %glob_tmp, 0x2, %glob_tmp ! or in no_fault bit
252 sta %glob_tmp, [%g0] ASI_M_MMUREGS ! set it 253LEON_PI(sta %glob_tmp, [%g0] ASI_LEON_MMUREGS) ! set it
254SUN_PI_(sta %glob_tmp, [%g0] ASI_M_MMUREGS) ! set it
253 255
254 /* Dump the registers and cross fingers. */ 256 /* Dump the registers and cross fingers. */
255 STORE_WINDOW(sp) 257 STORE_WINDOW(sp)
256 258
257 /* Clear the no_fault bit and check the status. */ 259 /* Clear the no_fault bit and check the status. */
258 andn %glob_tmp, 0x2, %glob_tmp 260 andn %glob_tmp, 0x2, %glob_tmp
259 sta %glob_tmp, [%g0] ASI_M_MMUREGS 261LEON_PI(sta %glob_tmp, [%g0] ASI_LEON_MMUREGS)
262SUN_PI_(sta %glob_tmp, [%g0] ASI_M_MMUREGS)
263
260 mov AC_M_SFAR, %glob_tmp 264 mov AC_M_SFAR, %glob_tmp
261 lda [%glob_tmp] ASI_M_MMUREGS, %g0 265LEON_PI(lda [%glob_tmp] ASI_LEON_MMUREGS, %g0)
266SUN_PI_(lda [%glob_tmp] ASI_M_MMUREGS, %g0)
267
262 mov AC_M_SFSR, %glob_tmp 268 mov AC_M_SFSR, %glob_tmp
263 lda [%glob_tmp] ASI_M_MMUREGS, %glob_tmp ! save away status of winstore 269LEON_PI(lda [%glob_tmp] ASI_LEON_MMUREGS, %glob_tmp)! save away status of winstore
270SUN_PI_(lda [%glob_tmp] ASI_M_MMUREGS, %glob_tmp) ! save away status of winstore
271
264 andcc %glob_tmp, 0x2, %g0 ! did we fault? 272 andcc %glob_tmp, 0x2, %g0 ! did we fault?
265 bne trap_setup_user_stack_is_bolixed ! failure 273 bne trap_setup_user_stack_is_bolixed ! failure
266 nop 274 nop
diff --git a/arch/sparc/kernel/rtrap_32.S b/arch/sparc/kernel/rtrap_32.S
index 7abc24e2bf1a..6c34de0c2abd 100644
--- a/arch/sparc/kernel/rtrap_32.S
+++ b/arch/sparc/kernel/rtrap_32.S
@@ -231,11 +231,14 @@ srmmu_rett_stackchk:
231 cmp %g1, %fp 231 cmp %g1, %fp
232 bleu ret_trap_user_stack_is_bolixed 232 bleu ret_trap_user_stack_is_bolixed
233 mov AC_M_SFSR, %g1 233 mov AC_M_SFSR, %g1
234 lda [%g1] ASI_M_MMUREGS, %g0 234LEON_PI(lda [%g1] ASI_LEON_MMUREGS, %g0)
235SUN_PI_(lda [%g1] ASI_M_MMUREGS, %g0)
235 236
236 lda [%g0] ASI_M_MMUREGS, %g1 237LEON_PI(lda [%g0] ASI_LEON_MMUREGS, %g1)
238SUN_PI_(lda [%g0] ASI_M_MMUREGS, %g1)
237 or %g1, 0x2, %g1 239 or %g1, 0x2, %g1
238 sta %g1, [%g0] ASI_M_MMUREGS 240LEON_PI(sta %g1, [%g0] ASI_LEON_MMUREGS)
241SUN_PI_(sta %g1, [%g0] ASI_M_MMUREGS)
239 242
240 restore %g0, %g0, %g0 243 restore %g0, %g0, %g0
241 244
@@ -244,13 +247,16 @@ srmmu_rett_stackchk:
244 save %g0, %g0, %g0 247 save %g0, %g0, %g0
245 248
246 andn %g1, 0x2, %g1 249 andn %g1, 0x2, %g1
247 sta %g1, [%g0] ASI_M_MMUREGS 250LEON_PI(sta %g1, [%g0] ASI_LEON_MMUREGS)
251SUN_PI_(sta %g1, [%g0] ASI_M_MMUREGS)
248 252
249 mov AC_M_SFAR, %g2 253 mov AC_M_SFAR, %g2
250 lda [%g2] ASI_M_MMUREGS, %g2 254LEON_PI(lda [%g2] ASI_LEON_MMUREGS, %g2)
255SUN_PI_(lda [%g2] ASI_M_MMUREGS, %g2)
251 256
252 mov AC_M_SFSR, %g1 257 mov AC_M_SFSR, %g1
253 lda [%g1] ASI_M_MMUREGS, %g1 258LEON_PI(lda [%g1] ASI_LEON_MMUREGS, %g1)
259SUN_PI_(lda [%g1] ASI_M_MMUREGS, %g1)
254 andcc %g1, 0x2, %g0 260 andcc %g1, 0x2, %g0
255 be ret_trap_userwins_ok 261 be ret_trap_userwins_ok
256 nop 262 nop
diff --git a/arch/sparc/kernel/wof.S b/arch/sparc/kernel/wof.S
index 4c2de3cf309b..28a7bc69f82b 100644
--- a/arch/sparc/kernel/wof.S
+++ b/arch/sparc/kernel/wof.S
@@ -332,24 +332,30 @@ spwin_srmmu_stackchk:
332 mov AC_M_SFSR, %glob_tmp 332 mov AC_M_SFSR, %glob_tmp
333 333
334 /* Clear the fault status and turn on the no_fault bit. */ 334 /* Clear the fault status and turn on the no_fault bit. */
335 lda [%glob_tmp] ASI_M_MMUREGS, %g0 ! eat SFSR 335LEON_PI(lda [%glob_tmp] ASI_LEON_MMUREGS, %g0) ! eat SFSR
336SUN_PI_(lda [%glob_tmp] ASI_M_MMUREGS, %g0) ! eat SFSR
336 337
337 lda [%g0] ASI_M_MMUREGS, %glob_tmp ! read MMU control 338LEON_PI(lda [%g0] ASI_LEON_MMUREGS, %glob_tmp) ! read MMU control
339SUN_PI_(lda [%g0] ASI_M_MMUREGS, %glob_tmp) ! read MMU control
338 or %glob_tmp, 0x2, %glob_tmp ! or in no_fault bit 340 or %glob_tmp, 0x2, %glob_tmp ! or in no_fault bit
339 sta %glob_tmp, [%g0] ASI_M_MMUREGS ! set it 341LEON_PI(sta %glob_tmp, [%g0] ASI_LEON_MMUREGS) ! set it
342SUN_PI_(sta %glob_tmp, [%g0] ASI_M_MMUREGS) ! set it
340 343
341 /* Dump the registers and cross fingers. */ 344 /* Dump the registers and cross fingers. */
342 STORE_WINDOW(sp) 345 STORE_WINDOW(sp)
343 346
344 /* Clear the no_fault bit and check the status. */ 347 /* Clear the no_fault bit and check the status. */
345 andn %glob_tmp, 0x2, %glob_tmp 348 andn %glob_tmp, 0x2, %glob_tmp
346 sta %glob_tmp, [%g0] ASI_M_MMUREGS 349LEON_PI(sta %glob_tmp, [%g0] ASI_LEON_MMUREGS)
350SUN_PI_(sta %glob_tmp, [%g0] ASI_M_MMUREGS)
347 351
348 mov AC_M_SFAR, %glob_tmp 352 mov AC_M_SFAR, %glob_tmp
349 lda [%glob_tmp] ASI_M_MMUREGS, %g0 353LEON_PI(lda [%glob_tmp] ASI_LEON_MMUREGS, %g0)
354SUN_PI_(lda [%glob_tmp] ASI_M_MMUREGS, %g0)
350 355
351 mov AC_M_SFSR, %glob_tmp 356 mov AC_M_SFSR, %glob_tmp
352 lda [%glob_tmp] ASI_M_MMUREGS, %glob_tmp 357LEON_PI(lda [%glob_tmp] ASI_LEON_MMUREGS, %glob_tmp)
358SUN_PI_(lda [%glob_tmp] ASI_M_MMUREGS, %glob_tmp)
353 andcc %glob_tmp, 0x2, %g0 ! did we fault? 359 andcc %glob_tmp, 0x2, %g0 ! did we fault?
354 be,a spwin_finish_up + 0x4 ! cool beans, success 360 be,a spwin_finish_up + 0x4 ! cool beans, success
355 restore %g0, %g0, %g0 361 restore %g0, %g0, %g0
diff --git a/arch/sparc/kernel/wuf.S b/arch/sparc/kernel/wuf.S
index 9fde91a249e0..2c21cc59683e 100644
--- a/arch/sparc/kernel/wuf.S
+++ b/arch/sparc/kernel/wuf.S
@@ -254,16 +254,19 @@ srmmu_fwin_stackchk:
254 mov AC_M_SFSR, %l4 254 mov AC_M_SFSR, %l4
255 cmp %l5, %sp 255 cmp %l5, %sp
256 bleu fwin_user_stack_is_bolixed 256 bleu fwin_user_stack_is_bolixed
257 lda [%l4] ASI_M_MMUREGS, %g0 ! clear fault status 257LEON_PI( lda [%l4] ASI_LEON_MMUREGS, %g0) ! clear fault status
258SUN_PI_( lda [%l4] ASI_M_MMUREGS, %g0) ! clear fault status
258 259
259 /* The technique is, turn off faults on this processor, 260 /* The technique is, turn off faults on this processor,
260 * just let the load rip, then check the sfsr to see if 261 * just let the load rip, then check the sfsr to see if
261 * a fault did occur. Then we turn on fault traps again 262 * a fault did occur. Then we turn on fault traps again
262 * and branch conditionally based upon what happened. 263 * and branch conditionally based upon what happened.
263 */ 264 */
264 lda [%g0] ASI_M_MMUREGS, %l5 ! read mmu-ctrl reg 265LEON_PI(lda [%g0] ASI_LEON_MMUREGS, %l5) ! read mmu-ctrl reg
266SUN_PI_(lda [%g0] ASI_M_MMUREGS, %l5) ! read mmu-ctrl reg
265 or %l5, 0x2, %l5 ! turn on no-fault bit 267 or %l5, 0x2, %l5 ! turn on no-fault bit
266 sta %l5, [%g0] ASI_M_MMUREGS ! store it 268LEON_PI(sta %l5, [%g0] ASI_LEON_MMUREGS) ! store it
269SUN_PI_(sta %l5, [%g0] ASI_M_MMUREGS) ! store it
267 270
268 /* Cross fingers and go for it. */ 271 /* Cross fingers and go for it. */
269 LOAD_WINDOW(sp) 272 LOAD_WINDOW(sp)
@@ -275,18 +278,22 @@ srmmu_fwin_stackchk:
275 278
276 /* LOCATION: Window 'T' */ 279 /* LOCATION: Window 'T' */
277 280
278 lda [%g0] ASI_M_MMUREGS, %twin_tmp1 ! load mmu-ctrl again 281LEON_PI(lda [%g0] ASI_LEON_MMUREGS, %twin_tmp1) ! load mmu-ctrl again
279 andn %twin_tmp1, 0x2, %twin_tmp1 ! clear no-fault bit 282SUN_PI_(lda [%g0] ASI_M_MMUREGS, %twin_tmp1) ! load mmu-ctrl again
280 sta %twin_tmp1, [%g0] ASI_M_MMUREGS ! store it 283 andn %twin_tmp1, 0x2, %twin_tmp1 ! clear no-fault bit
284LEON_PI(sta %twin_tmp1, [%g0] ASI_LEON_MMUREGS) ! store it
285SUN_PI_(sta %twin_tmp1, [%g0] ASI_M_MMUREGS) ! store it
281 286
282 mov AC_M_SFAR, %twin_tmp2 287 mov AC_M_SFAR, %twin_tmp2
283 lda [%twin_tmp2] ASI_M_MMUREGS, %g0 ! read fault address 288LEON_PI(lda [%twin_tmp2] ASI_LEON_MMUREGS, %g0) ! read fault address
289SUN_PI_(lda [%twin_tmp2] ASI_M_MMUREGS, %g0) ! read fault address
284 290
285 mov AC_M_SFSR, %twin_tmp2 291 mov AC_M_SFSR, %twin_tmp2
286 lda [%twin_tmp2] ASI_M_MMUREGS, %twin_tmp2 ! read fault status 292LEON_PI(lda [%twin_tmp2] ASI_LEON_MMUREGS, %twin_tmp2) ! read fault status
287 andcc %twin_tmp2, 0x2, %g0 ! did fault occur? 293SUN_PI_(lda [%twin_tmp2] ASI_M_MMUREGS, %twin_tmp2) ! read fault status
294 andcc %twin_tmp2, 0x2, %g0 ! did fault occur?
288 295
289 bne 1f ! yep, cleanup 296 bne 1f ! yep, cleanup
290 nop 297 nop
291 298
292 wr %t_psr, 0x0, %psr 299 wr %t_psr, 0x0, %psr