cache_flush.S 883 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef CACHE_OP_DEFINED
  2. #define CACHE_OP_DEFINED 1
  3. .macro cache_op op addr
  4. .set mips3
  5. cache \op, \addr
  6. .set mips1
  7. .endm
  8. .macro sync_op
  9. .set mips3
  10. sync
  11. .set mips1
  12. .endm
  13. #endif
  14. move $t2, $a0
  15. addu $t3, $a0, $a1
  16. srl $t2, $t2, 5
  17. sll $t2, $t2, 5
  18. addu $t3, $t3, 0x1f
  19. srl $t3, $t3, 5
  20. sll $t3, $t3, 5
  21. move $t0, $t2
  22. subu $t1, $t3, $t2
  23. 1:
  24. cache_op 1, 0($t0)
  25. /* All four ways. */
  26. #ifdef GRUB_MACHINE_MIPS_LOONGSON
  27. cache_op 1, 1($t0)
  28. cache_op 1, 2($t0)
  29. cache_op 1, 3($t0)
  30. addiu $t1, $t1, -0x20
  31. bne $t1, $zero, 1b
  32. addiu $t0, $t0, 0x20
  33. #else
  34. addiu $t1, $t1, -0x4
  35. bne $t1, $zero, 1b
  36. addiu $t0, $t0, 0x4
  37. #endif
  38. sync_op
  39. move $t0, $t2
  40. subu $t1, $t3, $t2
  41. 2:
  42. cache_op 0, 0($t0)
  43. #ifdef GRUB_MACHINE_MIPS_LOONGSON
  44. addiu $t1, $t1, -0x20
  45. bne $t1, $zero, 2b
  46. addiu $t0, $t0, 0x20
  47. #else
  48. addiu $t1, $t1, -0x4
  49. bne $t1, $zero, 2b
  50. addiu $t0, $t0, 0x4
  51. #endif
  52. sync_op