cache_gcc.S 1.0 KB

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