minttbl.S 2.3 KB

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