archsup.S 2.2 KB

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