Last change
on this file since 585 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.2 KB
|
Rev | Line | |
---|
[520] | 1 | /* |
---|
| 2 | * Check that lc also updates the local L1 cache. |
---|
| 3 | */ |
---|
| 4 | #include <registers.h> |
---|
| 5 | #include <misc.h> |
---|
| 6 | #include <vcache.h> |
---|
| 7 | .text |
---|
| 8 | .globl _start |
---|
| 9 | _start: |
---|
| 10 | .set noreorder |
---|
| 11 | la k0, TTY_BASE |
---|
| 12 | la k1, EXIT_BASE |
---|
| 13 | |
---|
| 14 | /* reset cop0 status (keep BEV) */ |
---|
| 15 | lui a0, 0x0040; |
---|
| 16 | mtc0 a0, COP0_STATUS |
---|
| 17 | |
---|
| 18 | /* enable caches */ |
---|
| 19 | li a0, VC_TLB_EN_ICACHE | VC_TLB_EN_DCACHE |
---|
| 20 | mtc2 a0, VC_TLB_EN |
---|
| 21 | |
---|
| 22 | /* fetch data in cache */ |
---|
| 23 | la s0, myvar |
---|
| 24 | lw a0, 0(s0) |
---|
| 25 | /* write magic value */ |
---|
| 26 | li a0, MAGIC1 |
---|
| 27 | sw a0, 0(s0) |
---|
| 28 | /* ll/sc another value on the same address */ |
---|
| 29 | 2: |
---|
| 30 | ll a0, 0(s0) |
---|
| 31 | PRINTX |
---|
| 32 | PUTCHAR(' ') |
---|
| 33 | li a0, MAGIC2 |
---|
| 34 | sc a0, 0(s0) |
---|
| 35 | beqz a0, 2b |
---|
| 36 | /* now check that we got the right value in cache */ |
---|
| 37 | lw a0, 0(s0) |
---|
| 38 | PRINTX |
---|
| 39 | PUTCHAR('\n') |
---|
| 40 | EXIT(0) |
---|
| 41 | |
---|
| 42 | .globl excep |
---|
| 43 | excep: |
---|
| 44 | .set noreorder |
---|
| 45 | PRINT(statusstr) |
---|
| 46 | mfc0 a0, COP0_STATUS |
---|
| 47 | PRINTX |
---|
| 48 | |
---|
| 49 | PRINT(causestr) |
---|
| 50 | mfc0 a0, COP0_CAUSE |
---|
| 51 | PRINTX |
---|
| 52 | |
---|
| 53 | PRINT(pcstr) |
---|
| 54 | mfc0 a0, COP0_EXPC |
---|
| 55 | PRINTX |
---|
| 56 | |
---|
| 57 | PRINT(badvastr) |
---|
| 58 | mfc0 a0, COP_0_BADVADDR |
---|
| 59 | PRINTX |
---|
| 60 | |
---|
| 61 | PUTCHAR('\n') |
---|
| 62 | /* we should not get there */ |
---|
| 63 | EXIT(1) |
---|
| 64 | |
---|
| 65 | .rodata: |
---|
| 66 | statusstr: .ascii "status \0" |
---|
| 67 | causestr: .ascii " cause \0" |
---|
| 68 | pcstr: .ascii " pc \0" |
---|
| 69 | badvastr: .ascii " badva \0" |
---|
| 70 | value: .word 0x1234abcd |
---|
| 71 | string: .ascii "hello world \0" |
---|
| 72 | |
---|
| 73 | .org EXCEP_ADDRESS - BOOT_ADDRESS |
---|
| 74 | .globl evect |
---|
| 75 | evect: |
---|
| 76 | j excep |
---|
| 77 | nop |
---|
| 78 | |
---|
| 79 | .data |
---|
| 80 | myvar: .word 0 |
---|
Note: See
TracBrowser
for help on using the repository browser.