minttbl.S 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /*++
  2. Copyright (c) 2016 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. minttbl.S
  9. Abstract:
  10. This module implements the monitor mode interrupt jump vector table for the
  11. RK3288 Veyron SoC.
  12. Author:
  13. Chris Stevens 8-Jun-2016
  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. .arch_extension virt
  29. //
  30. // .globl allows these labels to be visible to the linker.
  31. //
  32. .globl EfipRk32MonitorInterruptTable
  33. //
  34. // This address must be aligned to a 32 byte address so that it can be set in
  35. // the MVBAR register.
  36. //
  37. .balign 32
  38. EfipRk32MonitorInterruptTable:
  39. .word 0
  40. .word 0
  41. ldr %pc, EfipRk32SecureMonitorCallVector
  42. ldr %pc, EfipRk32PrefetchAbortVector
  43. ldr %pc, EfipRk32DataAbortVector
  44. .word 0
  45. ldr %pc, EfipRk32IrqInterruptVector
  46. ldr %pc, EfipRk32FiqInterruptVector
  47. EfipRk32SecureMonitorCallVector:
  48. .word EfipRk32SecureMonitorCallEntry
  49. EfipRk32PrefetchAbortVector:
  50. .word 0
  51. EfipRk32DataAbortVector:
  52. .word 0
  53. EfipRk32IrqInterruptVector:
  54. .word 0
  55. EfipRk32FiqInterruptVector:
  56. .word 0
  57. //
  58. // --------------------------------------------------------- Internal Functions
  59. //
  60. //
  61. // VOID
  62. // EfipRk32SecureMonitorCallEntry (
  63. // VOID
  64. // )
  65. //
  66. /*++
  67. Routine Description:
  68. This routine directly handles an exception generated by a secure monitor
  69. call.
  70. Arguments:
  71. None.
  72. Return Value:
  73. None.
  74. --*/
  75. FUNCTION EfipRk32SecureMonitorCallEntry
  76. //
  77. // The ARM Generic Timer's virtual offset can bet set in HYP mode and in
  78. // Monitor Mode when the SCR.NS bit is set to 1. Set the NS bit and zero
  79. // the offset.
  80. //
  81. mrc p15, 0, %r0, %c1, %c1, 0 @ Get the SCR
  82. orr %r0, %r0, #SCR_NON_SECURE
  83. mcr p15, 0, %r0, %c1, %c1, 0 @ Set the SCR
  84. mov %r2, #0
  85. mov %r3, #0
  86. mcrr p15, 4, %r2, %r3, %c14
  87. //
  88. // Clear the NS bit before returing from the exception to remain in secure
  89. // mode.
  90. //
  91. bic %r0, %r0, #SCR_NON_SECURE
  92. mcr p15, 0, %r0, %c1, %c1, 0 @ Set the SCR
  93. eret
  94. END_FUNCTION EfipRk32SecureMonitorCallEntry