Subversion Repositories HelenOS

Rev

Rev 911 | Rev 919 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Copyright (C) 2005 Jakub Jermar
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  *
  9.  * - Redistributions of source code must retain the above copyright
  10.  *   notice, this list of conditions and the following disclaimer.
  11.  * - Redistributions in binary form must reproduce the above copyright
  12.  *   notice, this list of conditions and the following disclaimer in the
  13.  *   documentation and/or other materials provided with the distribution.
  14.  * - The name of the author may not be used to endorse or promote products
  15.  *   derived from this software without specific prior written permission.
  16.  *
  17.  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  18.  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  19.  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  20.  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  21.  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  22.  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  23.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  24.  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  26.  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27.  */
  28.  
  29. #ifndef __ia64_REGISTER_H__
  30. #define __ia64_REGISTER_H__
  31.  
  32. #ifndef __ASM__
  33. #include <arch/types.h>
  34. #endif
  35.  
  36. #define CR_IVR_MASK 0xf
  37. #define PSR_IC_MASK 0x2000
  38. #define PSR_I_MASK  0x4000
  39. #define PSR_PK_MASK 0x8000
  40.  
  41. #define PSR_DT_MASK (1<<17)
  42. #define PSR_RT_MASK (1<<27)
  43. #define PSR_IT_MASK 0x0000001000000000
  44.  
  45. #define PSR_CPL_SHIFT       32
  46. #define PSR_CPL_MASK_SHIFTED    3
  47.  
  48. /** Application registers. */
  49. #define AR_KR0      0
  50. #define AR_KR1      1
  51. #define AR_KR2      2
  52. #define AR_KR3      3
  53. #define AR_KR4      4
  54. #define AR_KR5      5
  55. #define AR_KR6      6
  56. #define AR_KR7      7
  57. /* AR 8-15 reserved */
  58. #define AR_RSC      16
  59. #define AR_BSP      17
  60. #define AR_BSPSTORE 18
  61. #define AR_RNAT     19
  62. /* AR 20 reserved */
  63. #define AR_FCR      21
  64. /* AR 22-23 reserved */
  65. #define AR_EFLAG    24
  66. #define AR_CSD      25
  67. #define AR_SSD      26
  68. #define AR_CFLG     27
  69. #define AR_FSR      28
  70. #define AR_FIR      29
  71. #define AR_FDR      30
  72. /* AR 31 reserved */
  73. #define AR_CCV      32
  74. /* AR 33-35 reserved */
  75. #define AR_UNAT     36
  76. /* AR 37-39 reserved */
  77. #define AR_FPSR     40
  78. /* AR 41-43 reserved */
  79. #define AR_ITC      44
  80. /* AR 45-47 reserved */
  81. /* AR 48-63 ignored */
  82. #define AR_PFS      64
  83. #define AR_LC       65
  84. #define AR_EC       66
  85. /* AR 67-111 reserved */
  86. /* AR 112-127 ignored */
  87.  
  88. /** Control registers. */
  89. #define CR_DCR      0
  90. #define CR_ITM      1
  91. #define CR_IVA      2
  92. /* CR3-CR7 reserved */
  93. #define CR_PTA      8
  94. /* CR9-CR15 reserved */
  95. #define CR_IPSR     16
  96. #define CR_ISR      17
  97. /* CR18 reserved */
  98. #define CR_IIP      19
  99. #define CR_IFA      20
  100. #define CR_ITIR     21
  101. #define CR_IIPA     22
  102. #define CR_IFS      23
  103. #define CR_IIM      24
  104. #define CR_IHA      25
  105. /* CR26-CR63 reserved */
  106. #define CR_LID      64
  107. #define CR_IVR      65
  108. #define CR_TPR      66
  109. #define CR_EOI      67
  110. #define CR_IRR0     68
  111. #define CR_IRR1     69
  112. #define CR_IRR2     70
  113. #define CR_IRR3     71
  114. #define CR_ITV      72
  115. #define CR_PMV      73
  116. #define CR_CMCV     74
  117. /* CR75-CR79 reserved */
  118. #define CR_LRR0     80
  119. #define CR_LRR1     81
  120. /* CR82-CR127 reserved */
  121.  
  122. #ifndef __ASM__
  123. /** External Interrupt Vector Register */
  124. union cr_ivr {
  125.     __u8  vector;
  126.     __u64 value;
  127. };
  128.  
  129. typedef union cr_ivr cr_ivr_t;
  130.  
  131. /** Task Priority Register */
  132. union cr_tpr {
  133.     struct {
  134.         unsigned : 4;
  135.         unsigned mic: 4;        /**< Mask Interrupt Class. */
  136.         unsigned : 8;
  137.         unsigned mmi: 1;        /**< Mask Maskable Interrupts. */
  138.     } __attribute__ ((packed));
  139.     __u64 value;
  140. };
  141.  
  142. typedef union cr_tpr cr_tpr_t;
  143.  
  144. /** Interval Timer Vector */
  145. union cr_itv {
  146.     struct {
  147.         unsigned vector : 8;
  148.         unsigned : 4;
  149.         unsigned : 1;
  150.         unsigned : 3;
  151.         unsigned m : 1;         /**< Mask. */
  152.     } __attribute__ ((packed));
  153.     __u64 value;
  154. };
  155.  
  156. typedef union cr_itv cr_itv_t;
  157.  
  158. /** Interruption Status Register */
  159. union cr_isr {
  160.     struct {
  161.         union {
  162.             /** General Exception code field structuring. */
  163.             struct {
  164.                 unsigned ge_na : 4;
  165.                 unsigned ge_code : 4;
  166.             } __attribute__ ((packed));
  167.             __u16 code;
  168.         };
  169.         __u8 vector;
  170.         unsigned : 8;
  171.         unsigned x : 1;         /**< Execute exception. */
  172.         unsigned w : 1;         /**< Write exception. */
  173.         unsigned r : 1;         /**< Read exception. */
  174.         unsigned na : 1;        /**< Non-access exception. */
  175.         unsigned sp : 1;        /**< Speculative load exception. */
  176.         unsigned rs : 1;        /**< Register stack. */
  177.         unsigned ir : 1;        /**< Incomplete Register frame. */
  178.         unsigned ni : 1;        /**< Nested Interruption. */
  179.         unsigned so : 1;        /**< IA-32 Supervisor Override. */
  180.         unsigned ei : 2;        /**< Excepting Instruction. */
  181.         unsigned ed : 1;        /**< Exception Deferral. */
  182.         unsigned : 20;
  183.     } __attribute__ ((packed));
  184.     __u64 value;
  185. };
  186.  
  187. typedef union cr_isr cr_isr_t;
  188.  
  189. /** CPUID Register 3 */
  190. union cpuid3 {
  191.     struct {
  192.         __u8 number;
  193.         __u8 revision;
  194.         __u8 model;
  195.         __u8 family;
  196.         __u8 archrev;
  197.     } __attribute__ ((packed));
  198.     __u64 value;
  199. };
  200.  
  201. typedef union cpuid3 cpuid3_t;
  202.  
  203. #endif /* !__ASM__ */
  204.  
  205. #endif
  206.