archsup.S 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*++
  2. Copyright (c) 2014 Minoca Corp.
  3. This file is licensed under the terms of the GNU General Public License
  4. version 3. Alternative licensing terms are available. Contact
  5. info@minocacorp.com for details. See the LICENSE file at the root of this
  6. project for complete licensing information.
  7. Module Name:
  8. archsup.S
  9. Abstract:
  10. This module implements assembly-based architecture support routines for the
  11. ARMv6 platform.
  12. Author:
  13. Chris Stevens 20-Mar-2014
  14. Environment:
  15. Firmware
  16. --*/
  17. //
  18. // ------------------------------------------------------------------- Includes
  19. //
  20. #include <minoca/kernel/arm.inc>
  21. //
  22. // ---------------------------------------------------------------- Definitions
  23. //
  24. //
  25. // ---------------------------------------------------------------------- Code
  26. //
  27. ASSEMBLY_FILE_HEADER
  28. //
  29. // VOID
  30. // EfiMemoryBarrier (
  31. // VOID
  32. // )
  33. //
  34. /*++
  35. Routine Description:
  36. This routine provides a full memory barrier, ensuring that all memory
  37. accesses occurring before this function complete before any memory accesses
  38. after this function start.
  39. Arguments:
  40. None.
  41. Return Value:
  42. None.
  43. --*/
  44. FUNCTION EfiMemoryBarrier
  45. mcr p15, 0, %r0, %cr7, %cr10, 5
  46. bx %lr
  47. END_FUNCTION EfiMemoryBarrier
  48. //
  49. // VOID
  50. // EfipCleanEntireCache (
  51. // VOID
  52. // )
  53. //
  54. /*++
  55. Routine Description:
  56. This routine cleans the entire data cache.
  57. Arguments:
  58. None.
  59. Return Value:
  60. None.
  61. --*/
  62. FUNCTION EfipCleanEntireCache
  63. mov %r1, #0
  64. mcr p15, 0, %r1, %cr7, %cr10, 0 @ Clean entire data cache.
  65. mcr p15, 0, %r1, %cr7, %cr10, 4 @ Data Synchronization barrier.
  66. bx %lr
  67. END_FUNCTION EfipCleanEntireCache
  68. //
  69. // VOID
  70. // EfipInvalidateInstructionCache (
  71. // VOID
  72. // )
  73. //
  74. /*++
  75. Routine Description:
  76. This routine invalidate the processor's instruction only cache, indicating
  77. that a page containing code has changed.
  78. Arguments:
  79. None.
  80. Return Value:
  81. None.
  82. --*/
  83. FUNCTION EfipInvalidateInstructionCache
  84. mov %r1, #0
  85. mcr p15, 0, %r1, %cr7, %cr10, 4 @ Data synchronization barrier.
  86. mcr p15, 0, %r1, %cr7, %cr5, 0 @ ICIALLU, Invalidate I-Cache.
  87. mcr p15, 0, %r1, %cr7, %cr10, 4 @ DSB, Make instructions finish.
  88. mcr p15, 0, %r1, %cr7, %cr5, 4 @ ISB, Prevent speculative fetching.
  89. bx %lr @ Return
  90. END_FUNCTION EfipInvalidateInstructionCache
  91. //
  92. // --------------------------------------------------------- Internal Functions
  93. //