home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume25 / trash / part01 / register.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-03-22  |  2.1 KB  |  114 lines

  1. /*
  2.  * Register space size.
  3.  */
  4. #define    NREGS        32
  5.  
  6. /*
  7.  * Main processor general registers.
  8.  */
  9. #define    PGBASE        0
  10. #define    PG(r)        (PGBASE + r)
  11.  
  12. /*
  13.  * Main processor "control" registers.
  14.  */
  15. #define    PCBASE        (PGBASE + NREGS)
  16. #define    PC(r)        (PCBASE + r)
  17.  
  18. /*
  19.  * Coprocessor 0 general registers.
  20.  */
  21. #define    CP0GBASE    (PCBASE + NREGS)
  22. #define    CP0G(r)        (CP0GBASE + r)
  23.  
  24. /*
  25.  * Coprocessor 0 control registers.
  26.  */
  27. #define    CP0CBASE    (CP0GBASE + NREGS)
  28. #define    CP0C(r)        (CP0CBASE + r)
  29.  
  30. /*
  31.  * Coprocessor 1 general registers.
  32.  */
  33. #define    CP1GBASE    (CP0CBASE + NREGS)
  34. #define    CP1G(r)        (CP1GBASE + r)
  35.  
  36. /*
  37.  * Coprocessor 1 control registers.
  38.  */
  39. #define    CP1CBASE    (CP1GBASE + NREGS)
  40. #define    CP1C(r)        (CP1CBASE + r)
  41. #define    CP1CS        (CP1C(31))    /* Control/Status Register */
  42. #define    Condition_Shift    23
  43. #define    Set_Cond(r,v)    r = ((v) ? (r | (1 << Condition_Shift)) : (r & ~(1 << Condition_Shift)))
  44. #define    Test_Cond(r)    (((r) >> Condition_Shift) & 0x1)
  45.  
  46. /*
  47.  * Coprocessor 2 general registers.
  48.  */
  49. #define    CP2GBASE    (CP1CBASE + NREGS)
  50. #define    CP2G(r)        (CP2GBASE + r)
  51.  
  52. /*
  53.  * Coprocessor 2 control registers.
  54.  */
  55. #define    CP2CBASE    (CP2GBASE + NREGS)
  56. #define    CP2C(r)        (CP2CBASE + r)
  57.  
  58. /*
  59.  * Coprocessor 3 general registers.
  60.  */
  61. #define    CP3GBASE    (CP2CBASE + NREGS)
  62. #define    CP3G(r)        (CP3GBASE + r)
  63.  
  64. /*
  65.  * Coprocessor 3 control registers.
  66.  */
  67. #define    CP3CBASE    (CP3GBASE + NREGS)
  68. #define    CP3C(r)        (CP3CBASE + r)
  69.  
  70. /*
  71.  * Must be greater than
  72.  * the largest of the above..
  73.  */
  74. #define    R_MAX        (CP3CBASE + NREGS)
  75.  
  76. /*
  77.  * Some aliases.
  78.  */
  79. #define    R_0        PG(0)
  80. #define    R_AT        PG(1)
  81. #define    R_V0        PG(2)
  82. #define    R_V1        PG(3)
  83. #define    R_A0        PG(4)
  84. #define    R_A1        PG(5)
  85. #define    R_A2        PG(6)
  86. #define    R_A3        PG(7)
  87. #define    R_T0        PG(8)
  88. #define    R_T1        PG(9)
  89. #define    R_T2        PG(10)
  90. #define    R_T3        PG(11)
  91. #define    R_T4        PG(12)
  92. #define    R_T5        PG(13)
  93. #define    R_T6        PG(14)
  94. #define    R_T7        PG(15)
  95. #define    R_S0        PG(16)
  96. #define    R_S1        PG(17)
  97. #define    R_S2        PG(18)
  98. #define    R_S3        PG(19)
  99. #define    R_S4        PG(20)
  100. #define    R_S5        PG(21)
  101. #define    R_S6        PG(22)
  102. #define    R_S7        PG(23)
  103. #define    R_T8        PG(24)
  104. #define    R_T9        PG(25)
  105. #define    R_K0        PG(26)
  106. #define    R_K1        PG(27)
  107. #define    R_GP        PG(28)
  108. #define    R_SP        PG(29)
  109. #define    R_S8        PG(30)
  110. #define    R_RA        PG(31)
  111.  
  112. #define    R_HI        PC(0)
  113. #define    R_LO        PC(1)
  114.