Last change
on this file since 1022 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.8 KB
|
Rev | Line | |
---|
[520] | 1 | /* |
---|
| 2 | * check that a sc without ll does fail |
---|
| 3 | */ |
---|
| 4 | #include <registers.h> |
---|
| 5 | #include <misc.h> |
---|
| 6 | #include <vcache.h> |
---|
| 7 | |
---|
| 8 | .text |
---|
| 9 | .globl _start |
---|
| 10 | _start: |
---|
| 11 | .set noreorder |
---|
| 12 | la k0, TTY_BASE |
---|
| 13 | la k1, EXIT_BASE |
---|
| 14 | |
---|
| 15 | /* reset cop0 status (keep BEV) */ |
---|
| 16 | lui a0, 0x0040; |
---|
| 17 | mtc0 a0, COP0_STATUS |
---|
| 18 | |
---|
| 19 | la a0, pte1 |
---|
| 20 | srl a0, a0, 13 |
---|
| 21 | mtc2 a0, VC_PTPR |
---|
| 22 | nop |
---|
| 23 | |
---|
| 24 | li a0, VC_TLB_EN_ITLB | VC_TLB_EN_DTLB | VC_TLB_EN_ICACHE | VC_TLB_EN_DCACHE |
---|
| 25 | mtc2 a0, VC_TLB_EN |
---|
| 26 | |
---|
| 27 | /* make sure myvar is in cache */ |
---|
| 28 | la s1, myvar |
---|
| 29 | lw a0, 0(s1) |
---|
| 30 | PRINTX |
---|
| 31 | PUTCHAR(' ') |
---|
| 32 | |
---|
| 33 | /* now write to myvar with sc, without ll first */ |
---|
| 34 | la s1, myvar |
---|
| 35 | 1: |
---|
| 36 | li a1, MAGIC2 |
---|
| 37 | sc a1, 0(s1) |
---|
| 38 | beqz a1, 2f |
---|
| 39 | nop |
---|
| 40 | |
---|
| 41 | move a0, a1 |
---|
| 42 | PRINTX |
---|
| 43 | /* we should not get there */ |
---|
| 44 | EXIT(1) |
---|
| 45 | |
---|
| 46 | 2: |
---|
| 47 | /* we jump here when the sc failed */ |
---|
| 48 | move a0, a1 |
---|
| 49 | PRINTX |
---|
| 50 | PUTCHAR('\n'); |
---|
| 51 | EXIT(0) |
---|
| 52 | |
---|
| 53 | .globl excep |
---|
| 54 | excep: |
---|
| 55 | .set noreorder |
---|
| 56 | PRINT(statusstr) |
---|
| 57 | mfc0 a0, COP0_STATUS |
---|
| 58 | PRINTX |
---|
| 59 | |
---|
| 60 | PRINT(causestr) |
---|
| 61 | mfc0 a0, COP0_CAUSE |
---|
| 62 | PRINTX |
---|
| 63 | |
---|
| 64 | PRINT(pcstr) |
---|
| 65 | mfc0 a0, COP0_EXPC |
---|
| 66 | PRINTX |
---|
| 67 | |
---|
| 68 | PRINT(badvastr) |
---|
| 69 | mfc0 a0, COP_0_BADVADDR |
---|
| 70 | PRINTX |
---|
| 71 | |
---|
| 72 | PUTCHAR('\n') |
---|
| 73 | /* we should not get there */ |
---|
| 74 | EXIT(1) |
---|
| 75 | |
---|
| 76 | .rodata: |
---|
| 77 | statusstr: .ascii "status \0" |
---|
| 78 | causestr: .ascii " cause \0" |
---|
| 79 | pcstr: .ascii " pc \0" |
---|
| 80 | badvastr: .ascii " badva \0" |
---|
| 81 | value: .word 0x1234abcd |
---|
| 82 | string: .ascii "hello world \0" |
---|
| 83 | |
---|
| 84 | .org EXCEP_ADDRESS - BOOT_ADDRESS |
---|
| 85 | .globl evect |
---|
| 86 | evect: |
---|
| 87 | j excep |
---|
| 88 | nop |
---|
| 89 | |
---|
| 90 | .data |
---|
| 91 | myvar: .word MAGIC1 |
---|
| 92 | .globl pte1 |
---|
| 93 | pte1: |
---|
| 94 | .align 13 |
---|
| 95 | .word PTE1_V | PTE1_W | 0x0 /* map PA 0 at VA 0 */ |
---|
| 96 | .org pte1 + (BOOT_ADDRESS >> 21) * 4 |
---|
| 97 | .word PTE1_V | PTE1_C | PTE1_X | (BOOT_ADDRESS >> 21) /* map PA 0xbfc00000 at VA 0xbfc00000 */ |
---|
| 98 | .org pte1 + (TTY_BASE >> 21) * 4 |
---|
| 99 | .word PTE1_V | PTE1_W | (TTY_BASE >> 21) /* map PA 0xd0200000 at VA 0xd0200000 */ |
---|
| 100 | .org pte1 + (EXIT_BASE >> 21) * 4 |
---|
| 101 | .word PTE1_V | PTE1_W | (EXIT_BASE >> 21) /* map PA 0xe0000000 at VA 0xe0000000 */ |
---|
| 102 | .org pte1 + 8192 |
---|
| 103 | .word 0 |
---|
| 104 | |
---|
Note: See
TracBrowser
for help on using the repository browser.