1
0

cache_gcc.S 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * File : cache_init.S
  3. * Change Logs:
  4. * Date Author Notes
  5. * 2010-05-17 swkyer first version
  6. */
  7. #include "../common/mips.inc"
  8. #include "../common/mipsregs.h"
  9. #include "../common/stackframe.h"
  10. .text
  11. .set noreorder
  12. .globl cache_init
  13. .ent cache_init
  14. cache_init:
  15. .set noreorder
  16. mtc0 zero, CP0_TAGLO
  17. move t0, a0 // cache total size
  18. move t1, a1 // cache line size
  19. li t2, 0x80000000
  20. addu t3, t0, t2
  21. _cache_init_loop:
  22. cache 8, 0(t2) // icache_index_store_tag
  23. cache 9, 0(t2) // dcache_index_store_tag
  24. addu t2, t1
  25. bne t2, t3, _cache_init_loop
  26. nop
  27. mfc0 t0, CP0_CONFIG
  28. li t1, 0x7
  29. not t1
  30. and t0, t0, t1
  31. or t0, 0x3 // cacheable, noncoherent, write-back, write allocate
  32. mtc0 t0, CP0_CONFIG
  33. jr ra
  34. nop
  35. .set reorder
  36. .end cache_init