psr_defs.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. * Linux 2.6.32 and later Kernel module for VMware MVP Hypervisor Support
  3. *
  4. * Copyright (C) 2010-2013 VMware, Inc. All rights reserved.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License version 2 as published by
  8. * the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. * more details.
  14. *
  15. * You should have received a copy of the GNU General Public License along with
  16. * this program; see the file COPYING. If not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. */
  19. #line 5
  20. /**
  21. * @file
  22. *
  23. * @brief Constant definitions for ARM CPSR/SPSR registers. See A2.5
  24. * ARM DDI 0100I.
  25. */
  26. #ifndef _PSR_DEFS_H_
  27. #define _PSR_DEFS_H_
  28. #define INCLUDE_ALLOW_MVPD
  29. #define INCLUDE_ALLOW_VMX
  30. #define INCLUDE_ALLOW_MODULE
  31. #define INCLUDE_ALLOW_MONITOR
  32. #define INCLUDE_ALLOW_PV
  33. #define INCLUDE_ALLOW_GPL
  34. #include "include_check.h"
  35. #define ARM_PSR_MODE_USER 0x10
  36. #define ARM_PSR_MODE_FIQ 0x11
  37. #define ARM_PSR_MODE_IRQ 0x12
  38. #define ARM_PSR_MODE_SUPERVISOR 0x13
  39. #define ARM_PSR_MODE_ABORT 0x17
  40. #define ARM_PSR_MODE_HVC 0x1a
  41. #define ARM_PSR_MODE_UNDEFINED 0x1b
  42. #define ARM_PSR_MODE_SYSTEM 0x1f
  43. /* Bit 31: N */
  44. #define ARM_PSR_N (1 << 31)
  45. /* Bit 30: Z */
  46. #define ARM_PSR_Z (1 << 30)
  47. /* Bit 29: C */
  48. #define ARM_PSR_C (1 << 29)
  49. /* Bit 28: V */
  50. #define ARM_PSR_V (1 << 28)
  51. /* Bit 27: Q */
  52. #define ARM_PSR_Q (1 << 27)
  53. #define ARM_PSR_COND_FLAGS \
  54. (ARM_PSR_N | ARM_PSR_Z | ARM_PSR_C | ARM_PSR_V | ARM_PSR_Q)
  55. /* Bits 26..25: ITSTATE<1..0> */
  56. #define ARM_PSR_ITSTATE_LOW MVP_MASK(25, 2)
  57. /* Bit 24: J */
  58. #define ARM_PSR_J (1 << 24)
  59. /* Bits 23..20 are reserved as of ARMv7 */
  60. #define ARM_PSR_RESERVED MVP_MASK(20, 4)
  61. /* Bits 19..16: GE<3..0> */
  62. #define ARM_PSR_GE MVP_MASK(16, 4)
  63. /* Bits 15..10: ITSTATE<7..2> */
  64. #define ARM_PSR_ITSTATE_HIGH MVP_MASK(10, 6)
  65. #define ARM_PSR_ITSTATE (ARM_PSR_ITSTATE_LOW | ARM_PSR_ITSTATE_HIGH)
  66. /* Bit 9: E */
  67. #define ARM_PSR_E_POS (9)
  68. #define ARM_PSR_E (1 << ARM_PSR_E_POS)
  69. /* Bit 8: A */
  70. #define ARM_PSR_A_POS (8)
  71. #define ARM_PSR_A (1 << ARM_PSR_A_POS)
  72. /* Bit 7: I */
  73. #define ARM_PSR_I_POS (7)
  74. #define ARM_PSR_I (1 << ARM_PSR_I_POS)
  75. /* Bit 6: F */
  76. #define ARM_PSR_F_POS (6)
  77. #define ARM_PSR_F (1 << ARM_PSR_F_POS)
  78. /* Bit 5: T */
  79. #define ARM_PSR_T_POS (5)
  80. #define ARM_PSR_T (1 << ARM_PSR_T_POS)
  81. /* Bits 4..0: Mode */
  82. #define ARM_PSR_MODE_MASK 0x1f
  83. #define ARM_PSR_MODE(cpsr) ((cpsr) & ARM_PSR_MODE_MASK)
  84. #define ARM_PSR_USER_MODE(cpsr) (ARM_PSR_MODE(cpsr) == ARM_PSR_MODE_USER)
  85. /*
  86. * We shadow the 10 LSBs in the CPSR, with the exception of the T bit, as they
  87. * are managed by the VMM on behalf of the guest and are potentially different
  88. * than the physical CPSR during DE.
  89. */
  90. #define ARM_PSR_MONITOR_BITS 10
  91. #define ARM_PSR_MONITOR_MASK (((1 << ARM_PSR_MONITOR_BITS) - 1) & ~ARM_PSR_T)
  92. #endif /* ifndef _PSR_DEFS_H_ */