Last change
on this file since 763 was
520,
checked in by bouyer, 11 years ago
|
Re-add the tests; reverting previous which was done at the wrong level (sorry)
|
File size:
1.5 KB
|
Rev | Line | |
---|
[520] | 1 | /* |
---|
| 2 | * Check that the interrupt mask in status is properly handled: |
---|
| 3 | * we generate a software-triggerted interrupt with interrupt enabled but |
---|
| 4 | * the software interrupt masked. Later we unmask it. |
---|
| 5 | */ |
---|
| 6 | #include <registers.h> |
---|
| 7 | #include <misc.h> |
---|
| 8 | |
---|
| 9 | |
---|
| 10 | .text |
---|
| 11 | .globl _start |
---|
| 12 | _start: |
---|
| 13 | .set noreorder |
---|
| 14 | la k0, TTY_BASE |
---|
| 15 | la k1, EXIT_BASE |
---|
| 16 | |
---|
| 17 | /* reset cop0 status (keep BEV), enbale interrupts but mask IM0 */ |
---|
| 18 | lui a0, 0x0040; |
---|
| 19 | ori a0, 0xfe01; |
---|
| 20 | mtc0 a0, COP0_STATUS |
---|
| 21 | |
---|
| 22 | /* reset cause, make sure IV is off */ |
---|
| 23 | mtc0 zero, COP0_CAUSE |
---|
| 24 | |
---|
| 25 | PRINT(startstr) |
---|
| 26 | |
---|
| 27 | /* generate an interrupt */ |
---|
| 28 | mfc0 a0, COP0_CAUSE |
---|
| 29 | nop |
---|
| 30 | ori a0, 0x0100 |
---|
| 31 | mtc0 a0, COP0_CAUSE |
---|
| 32 | li a0, MAGIC1 |
---|
| 33 | PRINTX |
---|
| 34 | PUTCHAR('\n') |
---|
| 35 | nop |
---|
| 36 | nop |
---|
| 37 | nop |
---|
| 38 | nop |
---|
| 39 | nop |
---|
| 40 | nop |
---|
| 41 | /* unmask the interrupt */ |
---|
| 42 | mfc0 a0, COP0_STATUS |
---|
| 43 | nop |
---|
| 44 | ori a0, 0x0100 |
---|
| 45 | mtc0 a0, COP0_STATUS |
---|
| 46 | /* we should end here after taking the exeption */ |
---|
| 47 | li a0, MAGIC2 |
---|
| 48 | PRINTX |
---|
| 49 | PUTCHAR('\n') |
---|
| 50 | EXIT(0) |
---|
| 51 | |
---|
| 52 | .globl excep |
---|
| 53 | excep: |
---|
| 54 | .set noreorder |
---|
| 55 | PRINT(statusstr) |
---|
| 56 | mfc0 a0, COP0_STATUS |
---|
| 57 | PRINTX |
---|
| 58 | |
---|
| 59 | PRINT(causestr) |
---|
| 60 | mfc0 a0, COP0_CAUSE |
---|
| 61 | PRINTX |
---|
| 62 | |
---|
| 63 | PRINT(pcstr) |
---|
| 64 | mfc0 a0, COP0_EXPC |
---|
| 65 | PRINTX |
---|
| 66 | |
---|
| 67 | PRINT(badvastr) |
---|
| 68 | mfc0 a0, COP_0_BADVADDR |
---|
| 69 | PRINTX |
---|
| 70 | |
---|
| 71 | PUTCHAR('\n') |
---|
| 72 | /* clear interrupt */ |
---|
| 73 | mfc0 a0, COP0_CAUSE |
---|
| 74 | xori a0, 0x100 |
---|
| 75 | mtc0 a0, COP0_CAUSE |
---|
| 76 | nop |
---|
| 77 | eret |
---|
| 78 | /* we should not end there */ |
---|
| 79 | EXIT(1) |
---|
| 80 | |
---|
| 81 | .rodata: |
---|
| 82 | statusstr: .ascii "status \0" |
---|
| 83 | causestr: .ascii " cause \0" |
---|
| 84 | pcstr: .ascii " pc \0" |
---|
| 85 | badvastr: .ascii " badva \0" |
---|
| 86 | startstr: .ascii "start\n\0" |
---|
| 87 | eretstr: .ascii "eret\n\0" |
---|
| 88 | |
---|
| 89 | .org EXCEP_ADDRESS - BOOT_ADDRESS |
---|
| 90 | .globl evect |
---|
| 91 | evect: |
---|
| 92 | j excep |
---|
| 93 | nop |
---|
| 94 | .data |
---|
| 95 | myvar: .word 0 |
---|
Note: See
TracBrowser
for help on using the repository browser.