aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze
diff options
context:
space:
mode:
authorMichal Simek <monstr@monstr.eu>2010-03-19 07:44:40 -0400
committerMichal Simek <monstr@monstr.eu>2010-04-01 02:38:23 -0400
commitb175bcfe31cba846d8bfa35a3a4820667f7af383 (patch)
treeace22d6a9024a6a639143d365554487c89032565 /arch/microblaze
parent7a6bbdc9304b45cc759e03623cbe63d81aff7337 (diff)
microblaze: Change register usage for ESR and EAR
This change synchronize register usage in code. ESR = R4 EAR = R3 Signed-off-by: Michal Simek <monstr@monstr.eu>
Diffstat (limited to 'arch/microblaze')
-rw-r--r--arch/microblaze/kernel/hw_exception_handler.S70
1 files changed, 35 insertions, 35 deletions
diff --git a/arch/microblaze/kernel/hw_exception_handler.S b/arch/microblaze/kernel/hw_exception_handler.S
index ad6dbf029e6b..a652addb9321 100644
--- a/arch/microblaze/kernel/hw_exception_handler.S
+++ b/arch/microblaze/kernel/hw_exception_handler.S
@@ -313,13 +313,13 @@ _hw_exception_handler:
313 mfs r5, rmsr; 313 mfs r5, rmsr;
314 nop 314 nop
315 swi r5, r1, 0; 315 swi r5, r1, 0;
316 mfs r3, resr 316 mfs r4, resr
317 nop 317 nop
318 mfs r4, rear; 318 mfs r3, rear;
319 nop 319 nop
320 320
321#ifndef CONFIG_MMU 321#ifndef CONFIG_MMU
322 andi r5, r3, 0x1000; /* Check ESR[DS] */ 322 andi r5, r4, 0x1000; /* Check ESR[DS] */
323 beqi r5, not_in_delay_slot; /* Branch if ESR[DS] not set */ 323 beqi r5, not_in_delay_slot; /* Branch if ESR[DS] not set */
324 mfs r17, rbtr; /* ESR[DS] set - return address in BTR */ 324 mfs r17, rbtr; /* ESR[DS] set - return address in BTR */
325 nop 325 nop
@@ -327,7 +327,7 @@ not_in_delay_slot:
327 swi r17, r1, PT_R17 327 swi r17, r1, PT_R17
328#endif 328#endif
329 329
330 andi r5, r3, 0x1F; /* Extract ESR[EXC] */ 330 andi r5, r4, 0x1F; /* Extract ESR[EXC] */
331 331
332#ifdef CONFIG_MMU 332#ifdef CONFIG_MMU
333 /* Calculate exception vector offset = r5 << 2 */ 333 /* Calculate exception vector offset = r5 << 2 */
@@ -378,7 +378,7 @@ handle_other_ex: /* Handle Other exceptions here */
378 swi r18, r1, PT_R18 378 swi r18, r1, PT_R18
379 379
380 or r5, r1, r0 380 or r5, r1, r0
381 andi r6, r3, 0x1F; /* Load ESR[EC] */ 381 andi r6, r4, 0x1F; /* Load ESR[EC] */
382 lwi r7, r0, PER_CPU(KM) /* MS: saving current kernel mode to regs */ 382 lwi r7, r0, PER_CPU(KM) /* MS: saving current kernel mode to regs */
383 swi r7, r1, PT_MODE 383 swi r7, r1, PT_MODE
384 mfs r7, rfsr 384 mfs r7, rfsr
@@ -428,11 +428,11 @@ handle_other_ex: /* Handle Other exceptions here */
428 */ 428 */
429handle_unaligned_ex: 429handle_unaligned_ex:
430 /* Working registers already saved: R3, R4, R5, R6 430 /* Working registers already saved: R3, R4, R5, R6
431 * R3 = ESR 431 * R4 = ESR
432 * R4 = EAR 432 * R3 = EAR
433 */ 433 */
434#ifdef CONFIG_MMU 434#ifdef CONFIG_MMU
435 andi r6, r3, 0x1000 /* Check ESR[DS] */ 435 andi r6, r4, 0x1000 /* Check ESR[DS] */
436 beqi r6, _no_delayslot /* Branch if ESR[DS] not set */ 436 beqi r6, _no_delayslot /* Branch if ESR[DS] not set */
437 mfs r17, rbtr; /* ESR[DS] set - return address in BTR */ 437 mfs r17, rbtr; /* ESR[DS] set - return address in BTR */
438 nop 438 nop
@@ -441,7 +441,7 @@ _no_delayslot:
441 RESTORE_STATE; 441 RESTORE_STATE;
442 bri unaligned_data_trap 442 bri unaligned_data_trap
443#endif 443#endif
444 andi r6, r3, 0x3E0; /* Mask and extract the register operand */ 444 andi r6, r4, 0x3E0; /* Mask and extract the register operand */
445 srl r6, r6; /* r6 >> 5 */ 445 srl r6, r6; /* r6 >> 5 */
446 srl r6, r6; 446 srl r6, r6;
447 srl r6, r6; 447 srl r6, r6;
@@ -450,33 +450,33 @@ _no_delayslot:
450 /* Store the register operand in a temporary location */ 450 /* Store the register operand in a temporary location */
451 sbi r6, r0, TOPHYS(ex_reg_op); 451 sbi r6, r0, TOPHYS(ex_reg_op);
452 452
453 andi r6, r3, 0x400; /* Extract ESR[S] */ 453 andi r6, r4, 0x400; /* Extract ESR[S] */
454 bnei r6, ex_sw; 454 bnei r6, ex_sw;
455ex_lw: 455ex_lw:
456 andi r6, r3, 0x800; /* Extract ESR[W] */ 456 andi r6, r4, 0x800; /* Extract ESR[W] */
457 beqi r6, ex_lhw; 457 beqi r6, ex_lhw;
458 lbui r5, r4, 0; /* Exception address in r4 */ 458 lbui r5, r3, 0; /* Exception address in r3 */
459 /* Load a word, byte-by-byte from destination address 459 /* Load a word, byte-by-byte from destination address
460 and save it in tmp space */ 460 and save it in tmp space */
461 sbi r5, r0, TOPHYS(ex_tmp_data_loc_0); 461 sbi r5, r0, TOPHYS(ex_tmp_data_loc_0);
462 lbui r5, r4, 1; 462 lbui r5, r3, 1;
463 sbi r5, r0, TOPHYS(ex_tmp_data_loc_1); 463 sbi r5, r0, TOPHYS(ex_tmp_data_loc_1);
464 lbui r5, r4, 2; 464 lbui r5, r3, 2;
465 sbi r5, r0, TOPHYS(ex_tmp_data_loc_2); 465 sbi r5, r0, TOPHYS(ex_tmp_data_loc_2);
466 lbui r5, r4, 3; 466 lbui r5, r3, 3;
467 sbi r5, r0, TOPHYS(ex_tmp_data_loc_3); 467 sbi r5, r0, TOPHYS(ex_tmp_data_loc_3);
468 /* Get the destination register value into r3 */ 468 /* Get the destination register value into r4 */
469 lwi r3, r0, TOPHYS(ex_tmp_data_loc_0); 469 lwi r4, r0, TOPHYS(ex_tmp_data_loc_0);
470 bri ex_lw_tail; 470 bri ex_lw_tail;
471ex_lhw: 471ex_lhw:
472 lbui r5, r4, 0; /* Exception address in r4 */ 472 lbui r5, r3, 0; /* Exception address in r3 */
473 /* Load a half-word, byte-by-byte from destination 473 /* Load a half-word, byte-by-byte from destination
474 address and save it in tmp space */ 474 address and save it in tmp space */
475 sbi r5, r0, TOPHYS(ex_tmp_data_loc_0); 475 sbi r5, r0, TOPHYS(ex_tmp_data_loc_0);
476 lbui r5, r4, 1; 476 lbui r5, r3, 1;
477 sbi r5, r0, TOPHYS(ex_tmp_data_loc_1); 477 sbi r5, r0, TOPHYS(ex_tmp_data_loc_1);
478 /* Get the destination register value into r3 */ 478 /* Get the destination register value into r4 */
479 lhui r3, r0, TOPHYS(ex_tmp_data_loc_0); 479 lhui r4, r0, TOPHYS(ex_tmp_data_loc_0);
480ex_lw_tail: 480ex_lw_tail:
481 /* Get the destination register number into r5 */ 481 /* Get the destination register number into r5 */
482 lbui r5, r0, TOPHYS(ex_reg_op); 482 lbui r5, r0, TOPHYS(ex_reg_op);
@@ -504,25 +504,25 @@ ex_sw_tail:
504 andi r6, r6, 0x800; /* Extract ESR[W] */ 504 andi r6, r6, 0x800; /* Extract ESR[W] */
505 beqi r6, ex_shw; 505 beqi r6, ex_shw;
506 /* Get the word - delay slot */ 506 /* Get the word - delay slot */
507 swi r3, r0, TOPHYS(ex_tmp_data_loc_0); 507 swi r4, r0, TOPHYS(ex_tmp_data_loc_0);
508 /* Store the word, byte-by-byte into destination address */ 508 /* Store the word, byte-by-byte into destination address */
509 lbui r3, r0, TOPHYS(ex_tmp_data_loc_0); 509 lbui r4, r0, TOPHYS(ex_tmp_data_loc_0);
510 sbi r3, r4, 0; 510 sbi r4, r3, 0;
511 lbui r3, r0, TOPHYS(ex_tmp_data_loc_1); 511 lbui r4, r0, TOPHYS(ex_tmp_data_loc_1);
512 sbi r3, r4, 1; 512 sbi r4, r3, 1;
513 lbui r3, r0, TOPHYS(ex_tmp_data_loc_2); 513 lbui r4, r0, TOPHYS(ex_tmp_data_loc_2);
514 sbi r3, r4, 2; 514 sbi r4, r3, 2;
515 lbui r3, r0, TOPHYS(ex_tmp_data_loc_3); 515 lbui r4, r0, TOPHYS(ex_tmp_data_loc_3);
516 sbi r3, r4, 3; 516 sbi r4, r3, 3;
517 bri ex_handler_done; 517 bri ex_handler_done;
518 518
519ex_shw: 519ex_shw:
520 /* Store the lower half-word, byte-by-byte into destination address */ 520 /* Store the lower half-word, byte-by-byte into destination address */
521 swi r3, r0, TOPHYS(ex_tmp_data_loc_0); 521 swi r4, r0, TOPHYS(ex_tmp_data_loc_0);
522 lbui r3, r0, TOPHYS(ex_tmp_data_loc_2); 522 lbui r4, r0, TOPHYS(ex_tmp_data_loc_2);
523 sbi r3, r4, 0; 523 sbi r4, r3, 0;
524 lbui r3, r0, TOPHYS(ex_tmp_data_loc_3); 524 lbui r4, r0, TOPHYS(ex_tmp_data_loc_3);
525 sbi r3, r4, 1; 525 sbi r4, r3, 1;
526ex_sw_end: /* Exception handling of store word, ends. */ 526ex_sw_end: /* Exception handling of store word, ends. */
527 527
528ex_handler_done: 528ex_handler_done: