dcache.S 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * (C) Copyright 2007 Michal Simek
  3. *
  4. * Michal SIMEK <monstr@monstr.eu>
  5. *
  6. * See file CREDITS for list of people who contributed to this
  7. * project.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of
  12. * the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  22. * MA 02111-1307 USA
  23. */
  24. .text
  25. .globl dcache_enable
  26. .ent dcache_enable
  27. .align 2
  28. dcache_enable:
  29. /* Make space on stack for a temporary */
  30. addi r1, r1, -4
  31. /* Save register r12 */
  32. swi r12, r1, 0
  33. /* Read the MSR register */
  34. mfs r12, rmsr
  35. /* Set the instruction enable bit */
  36. ori r12, r12, 0x80
  37. /* Save the MSR register */
  38. mts rmsr, r12
  39. /* Load register r12 */
  40. lwi r12, r1, 0
  41. /* Return */
  42. rtsd r15, 8
  43. /* Update stack in the delay slot */
  44. addi r1, r1, 4
  45. .end dcache_enable
  46. .text
  47. .globl dcache_disable
  48. .ent dcache_disable
  49. .align 2
  50. dcache_disable:
  51. /* Make space on stack for a temporary */
  52. addi r1, r1, -4
  53. /* Save register r12 */
  54. swi r12, r1, 0
  55. /* Read the MSR register */
  56. mfs r12, rmsr
  57. /* Clear the data cache enable bit */
  58. andi r12, r12, ~0x80
  59. /* Save the MSR register */
  60. mts rmsr, r12
  61. /* Load register r12 */
  62. lwi r12, r1, 0
  63. /* Return */
  64. rtsd r15, 8
  65. /* Update stack in the delay slot */
  66. addi r1, r1, 4
  67. .end dcache_disable