| 9 | |
| 10 | /* clang-format off */ |
| 11 | asm void DCEnable() { |
| 12 | nofralloc |
| 13 | sync |
| 14 | mfspr r3, HID0 |
| 15 | ori r3, r3, 0x4000 |
| 16 | mtspr HID0, r3 |
| 17 | blr |
| 18 | } |
| 19 | |
| 20 | asm void DCInvalidateRange(register void* addr, register u32 nBytes) { |
| 21 | nofralloc |
| 22 | cmplwi nBytes, 0 |
| 23 | blelr |
| 24 | clrlwi r5, addr, 27 |
| 25 | add nBytes, nBytes, r5 |
| 26 | addi nBytes, nBytes, 31 |
| 27 | srwi nBytes, nBytes, 5 |
| 28 | mtctr nBytes |
| 29 | |
| 30 | @1 |
| 31 | dcbi r0, addr |
| 32 | addi addr, addr, 32 |
| 33 | bdnz @1 |
| 34 | blr |
| 35 | } |
| 36 | |
| 37 | |
| 38 | asm void DCFlushRange(register void* addr, register u32 nBytes) { |
| 39 | nofralloc |
| 40 | cmplwi nBytes, 0 |
| 41 | blelr |
| 42 | clrlwi r5, addr, 27 |
| 43 | add nBytes, nBytes, r5 |
| 44 | addi nBytes, nBytes, 31 |
| 45 | srwi nBytes, nBytes, 5 |
| 46 | mtctr nBytes |
| 47 | |
| 48 | @1 |
| 49 | dcbf r0, addr |
| 50 | addi addr, addr, 32 |
| 51 | bdnz @1 |
| 52 | sc |
| 53 | blr |
| 54 | } |
| 55 | |
| 56 | asm void DCStoreRange(register void* addr, register u32 nBytes) { |
| 57 | nofralloc |
| 58 | cmplwi nBytes, 0 |
| 59 | blelr |
| 60 | clrlwi r5, addr, 27 |
| 61 | add nBytes, nBytes, r5 |
| 62 | addi nBytes, nBytes, 31 |
| 63 | srwi nBytes, nBytes, 5 |
| 64 | mtctr nBytes |
| 65 | |
| 66 | @1 |
| 67 | dcbst r0, addr |
| 68 | addi addr, addr, 32 |
no test coverage detected