Asmdef.h 82 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221
  1. /******** ASSEMBLER SPECIFIC DEFINITIONS ********/
  2. #define MIPS_Release2 1
  3. /* For Different platform */
  4. //#define ALIGN(x) .##align (x)
  5. #define SET_MIPS3() .##set mips3
  6. #define SET_MIPS0() .##set mips0
  7. #define SET_PUSH() .##set push
  8. #define SET_POP() .##set pop
  9. /* Different assemblers have different requirements for how to
  10. * indicate that the next section is bss :
  11. *
  12. * Some use : .bss
  13. * Others use : .section bss
  14. *
  15. * We select which to use based on _BSS_OLD_, which may be defined
  16. * in makefile.
  17. */
  18. #define BSS .##bss
  19. #define LEAF(name)\
  20. .##text;\
  21. .##globl name;\
  22. .##ent name;\
  23. name:
  24. #define SLEAF(name)\
  25. .##text;\
  26. .##ent name;\
  27. name:
  28. #define CPU0LEAF(name) \
  29. .section ".cpu0.text","ax",@progbits; \
  30. .globl name; \
  31. .ent name; \
  32. name:
  33. #define END(name)\
  34. .##size name,.-name;\
  35. .##end name
  36. /*
  37. *************************************************************************
  38. * V I R T U A L A D D R E S S D E F I N I T I O N S *
  39. *************************************************************************
  40. */
  41. #define A_K0BASE 0x80000000
  42. #define A_K1BASE 0xa0000000
  43. #define A_K2BASE 0xc0000000
  44. #define A_K3BASE 0xe0000000
  45. #define M_KMAPPED 0x40000000 /* KnSEG address is mapped if bit is one */
  46. #define M_KUNCACHED 0x20000000 /* K[01]SEG address is uncached if bit is one */
  47. /*
  48. *************************************************************************
  49. * S O F T W A R E G P R N A M E S *
  50. *************************************************************************
  51. */
  52. #define zero $0
  53. #define AT $1
  54. #define v0 $2
  55. #define v1 $3
  56. #define a0 $4
  57. #define a1 $5
  58. #define a2 $6
  59. #define a3 $7
  60. #define t0 $8
  61. #define t1 $9
  62. #define t2 $10
  63. #define t3 $11
  64. #define t4 $12
  65. #define t5 $13
  66. #define t6 $14
  67. #define t7 $15
  68. #define s0 $16
  69. #define s1 $17
  70. #define s2 $18
  71. #define s3 $19
  72. #define s4 $20
  73. #define s5 $21
  74. #define s6 $22
  75. #define s7 $23
  76. #define t8 $24
  77. #define t9 $25
  78. #define k0 $26
  79. #define k1 $27
  80. #define gp $28
  81. #define sp $29
  82. #define fp $30
  83. #define ra $31
  84. /*
  85. *************************************************************************
  86. * C P 0 R E G I S T E R D E F I N I T I O N S *
  87. *************************************************************************
  88. * Each register has the following definitions:
  89. *
  90. * C0_rrr The register number (as a $n value)
  91. * R_C0_rrr The register index (as an integer corresponding
  92. * to the register number)
  93. * R_C0_Selrrr The register select (as an integer corresponding
  94. * to the register select)
  95. *
  96. * Each field in a register has the following definitions:
  97. *
  98. * S_rrrfff The shift count required to right-justify
  99. * the field. This corresponds to the bit
  100. * number of the right-most bit in the field.
  101. * M_rrrfff The Mask required to isolate the field.
  102. *
  103. * Register diagrams included below as comments correspond to the
  104. * MIPS32 and MIPS64 architecture specifications. Refer to other
  105. * sources for register diagrams for older architectures.
  106. */
  107. /*
  108. ************************************************************************
  109. * I N D E X R E G I S T E R ( 0 ) *
  110. ************************************************************************
  111. *
  112. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  113. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  114. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  115. * |P| 0 | Index | Index
  116. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  117. */
  118. #define C0_Index $0
  119. #define R_C0_Index 0
  120. #define R_C0_SelIndex 0
  121. #define C0_INX C0_Index /* OBSOLETE - DO NOT USE IN NEW CODE */
  122. #define S_IndexP 31 /* Probe failure (R)*/
  123. #define M_IndexP (0x1 << S_IndexP)
  124. #define S_IndexIndex 0 /* TLB index (R/W)*/
  125. #define M_IndexIndex (0x3f << S_IndexIndex)
  126. #define M_Index0Fields 0x7fffffc0
  127. #define M_IndexRFields 0x80000000
  128. /*
  129. ************************************************************************
  130. * R A N D O M R E G I S T E R ( 1 ) *
  131. ************************************************************************
  132. *
  133. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  134. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  135. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  136. * | 0 | Index | Random
  137. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  138. */
  139. #define C0_Random $1
  140. #define R_C0_Random 1
  141. #define R_C0_SelRandom 0
  142. #define C0_RAND $1 /* OBSOLETE - DO NOT USE IN NEW CODE */
  143. #define S_RandomIndex 0 /* TLB random index (R)*/
  144. #define M_RandomIndex (0x3f << S_RandomIndex)
  145. #define M_Random0Fields 0xffffffc0
  146. #define M_RandomRFields 0x0000003f
  147. /*
  148. ************************************************************************
  149. * E N T R Y L O 0 R E G I S T E R ( 2 ) *
  150. ************************************************************************
  151. *
  152. * 6 6 6 6 5 // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  153. * 3 2 1 0 9 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  154. * +-+-+-+-+-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  155. * | Fill (0) //|R|X| PFN | C |D|V|G| EntryLo0
  156. * | //|I|I| | | | | |
  157. * +-+-+-+-+-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  158. */
  159. #define C0_EntryLo0 $2
  160. #define R_C0_EntryLo0 2
  161. #define R_C0_SelEntryLo0 0
  162. #define C0_TLBLO_0 C0_EntryLo0 /* OBSOLETE - DO NOT USE IN NEW CODE */
  163. #if defined(MIPS_SmartMIPS_ASE)
  164. /*
  165. * SmartMIPS MMU has RI and XI bits for further access qualification.
  166. * Non-SmartMIPS MMUs have bits 31 and 30 as reserved/zero bits.
  167. */
  168. #define S_EntryLoRI 31 /* Read Inhibit (R/W) */
  169. #define M_EntryLoRI (0x1 << S_EntryLoRI)
  170. #define S_EntryLoXI 30 /* Execute Inhibit (R/W) */
  171. #define M_EntryLoXI (0x1 << S_EntryLoXI)
  172. #endif /* MIPS_SmartMIPS_ASE */
  173. #define S_EntryLoPFN 6 /* PFN (R/W) */
  174. #define M_EntryLoPFN (0xffffff << S_EntryLoPFN)
  175. #define S_EntryLoC 3 /* Coherency attribute (R/W) */
  176. #define M_EntryLoC (0x7 << S_EntryLoC)
  177. #define S_EntryLoD 2 /* Dirty (R/W) */
  178. #define M_EntryLoD (0x1 << S_EntryLoD)
  179. #define S_EntryLoV 1 /* Valid (R/W) */
  180. #define M_EntryLoV (0x1 << S_EntryLoV)
  181. #define S_EntryLoG 0 /* Global (R/W) */
  182. #define M_EntryLoG (0x1 << S_EntryLoG)
  183. #define M_EntryLoOddPFN (0x1 << S_EntryLoPFN) /* Odd PFN bit */
  184. #define S_EntryLo_RS K_PageAlign /* ? */
  185. /* Shift to put PFN in its position within a physical address */
  186. #ifndef MIPS_SmartMIPS_ASE
  187. #define S_EntryLo_LS (12 - S_EntryLoPFN)
  188. #else
  189. #define S_EntryLo_LS ((12 - S_EntryLoPFN) - (12 - C0_PageGrainMSOne))
  190. #endif /* MIPS_SmartMIPS_ASE */
  191. #define M_EntryLo0Fields 0x00000000
  192. #define M_EntryLo0Fields64 UINT64_C(0x0000000000000000)
  193. #ifdef MIPS_SmartMIPS_ASE
  194. #define M_EntryLoRFields 0x00000000
  195. #define M_EntryLoRFields64 UINT64_C(0xffffffff00000000)
  196. #else
  197. #define M_EntryLoRFields 0xc0000000
  198. #define M_EntryLoRFields64 UINT64_C(0xffffffffc0000000)
  199. #endif /* MIPS_SmartMIPS_ASE */
  200. /*
  201. * Cache attribute values in the C field of EntryLo and the
  202. * K0 field of Config
  203. */
  204. #define K_CacheAttrCWTnWA 0 /* Cacheable, write-thru, no write allocate */
  205. #define K_CacheAttrCWTWA 1 /* Cacheable, write-thru, write allocate */
  206. #define K_CacheAttrU 2 /* Uncached */
  207. #define K_CacheAttrC 3 /* Cacheable */
  208. #define K_CacheAttrCN 3 /* Cacheable, non-coherent */
  209. #define K_CacheAttrCCE 4 /* Cacheable, coherent, exclusive */
  210. #define K_CacheAttrCCS 5 /* Cacheable, coherent, shared */
  211. #define K_CacheAttrCCU 6 /* Cacheable, coherent, update */
  212. #define K_CacheAttrUA 7 /* Uncached accelerated */
  213. /*
  214. ************************************************************************
  215. * E N T R Y L O 1 R E G I S T E R ( 3 ) *
  216. ************************************************************************
  217. *
  218. * 6 6 6 6 5 // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  219. * 3 2 1 0 9 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  220. * +-+-+-+-+-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  221. * | Fill (0) //| 0 | PFN | C |D|V|G| EntryLo1
  222. * +-+-+-+-+-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  223. */
  224. #define C0_EntryLo1 $3
  225. #define R_C0_EntryLo1 3
  226. #define R_C0_SelEntryLo1 0
  227. #define C0_TLBLO_1 C0_EntryLo1 /* OBSOLETE - DO NOT USE IN NEW CODE */
  228. /*
  229. * Field definitions are as given for EntryLo0 above
  230. */
  231. /*
  232. ************************************************************************
  233. * C O N T E X T R E G I S T E R ( 4, SELECT 0 ) *
  234. ************************************************************************
  235. *
  236. * 6 // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  237. * 3 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  238. * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  239. * | // PTEBase | BadVPN<31:13> | 0 | Context
  240. * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  241. */
  242. #define C0_Context $4
  243. #define R_C0_Context 4
  244. #define R_C0_SelContext 0
  245. #define C0_CTXT C0_Context /* OBSOLETE - DO NOT USE IN NEW CODE */
  246. #ifndef MIPS_SmartMIPS_ASE
  247. #define S_ContextPTEBase 23 /* PTE base (R/W) */
  248. #define S_ContextBadVPN 4 /* BadVPN2 (R) */
  249. #else
  250. /*
  251. * Definitions for Context as configured by ContextConfig.
  252. * Assumes that ContextConfigMSOne and ContextConfigLSOne
  253. * value are available at evaluation time. Whether these
  254. * are constants, variables, or returned by a function call
  255. * is outside the scope of ArchDefs.h
  256. */
  257. #define S_ContextPTEBase (C0_ContextConfigMSOne + 1)
  258. #define S_ContextBadVPN (C0_ContextConfigLSOne)
  259. #endif /* MIPS_SmartMIPS_ASE */
  260. /*
  261. * Definitions that can be derived from the above two,
  262. * regardless of whether or not ContextConfig is implemented.
  263. */
  264. #define M_Context0Fields ((1 << S_ContextBadVPN) - 1)
  265. #define M_ContextRFields (((1 << S_ContextPTEBase) - 1) \
  266. & ~(M_Context0Fields))
  267. #define M_Context0Fields64 ((UINT64_C(1) << S_ContextBadVPN) - 1)
  268. #define M_ContextRFields64 (((UINT64_C(1) << S_ContextPTEBase) - 1) \
  269. & ~(M_Context0Fields))
  270. #define M_ContextPTEBase (((1 << S_ContextBadVPN_LS) - 1) \
  271. << S_ContextPTEBase)
  272. #define M_ContextBadVPN (((1 << (S_ContextPTEBase - S_ContextBadVPN))\
  273. - 1) << S_ContextBadVPN)
  274. /* Position BadVPN to bit 31. */
  275. #define S_ContextBadVPN_LS (32 - S_ContextPTEBase)
  276. /* Right-justify shifted BadVPN field, i.e. VA bits not in BadVPN2 */
  277. #define S_ContextBadVPN_RS (32 - (S_ContextPTEBase - S_ContextBadVPN))
  278. #if defined(MIPS_SmartMIPS_ASE) || defined(MIPS_Release2)
  279. /*
  280. ************************************************************************
  281. * C O N T E X T C O N F I G R E G I S T E R ( 4, SELECT 1 ) *
  282. ************************************************************************
  283. *
  284. * 6 // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  285. * 3 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  286. * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  287. * | // VirtualIndex |ContextConfig
  288. * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  289. *
  290. * ContextConfig, if implemented, makes the definitions of the Context
  291. * register "soft". The number of bits in the PTEBase and BadVPN fields
  292. * become variable. The leading zero field of the ContextConfig register
  293. * corresponds to the set of bits to be treated as a read/write PTEBase
  294. * field. The following field of ones corrsponds to the set of bits to
  295. * be treated as the virtual page number, into which as many high order
  296. * bits of the VA are copied as there are bits set in the field.
  297. */
  298. #define C0_ContextConfig $4,1
  299. #define R_C0_ContextConfig 4 /* Overload */
  300. #define R_C0_SelContextConfig 1
  301. /*
  302. * It is possible to write definition for the Context register above
  303. * in terms of the word value of ContextConfig, but with gcc in particular,
  304. * it is extrememly ineffecient both at compile and run-time. Contex
  305. * is therefore defined in terms of two values, C0_ContextConfigMSOne
  306. * and C0_ContextConfigLSOne, which are the bit numbers of the most
  307. * significant and least significant one-valued bits of the
  308. * ContextConfig register. The default reset values are defined
  309. * here, BUT SHOULD BE OVERRIDDEN WITH A FUNCTION CALL OR A REFERENCE
  310. * TO A RUN-TIME VALUE IN ANY DYNAMIC MODEL OF A SmartMIPS CPU.
  311. */
  312. #ifndef C0_ContextConfigMSOne
  313. #define C0_ContextConfigMSOne 22
  314. #endif /* C0_ContextConfigMSOne */
  315. #ifndef C0_ContextConfigLSOne
  316. #define C0_ContextConfigLSOne 4
  317. #endif /* C0_ContextConfigLSOne */
  318. #endif /* MIPS_SmartMIPS_ASE */
  319. /*
  320. ************************************************************************
  321. * P A G E M A S K R E G I S T E R ( 5, SELECT 0 ) *
  322. ************************************************************************
  323. *
  324. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  325. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  326. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  327. * | 0 | Mask | 0 | PageMask
  328. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  329. */
  330. #define C0_PageMask $5
  331. #define R_C0_PageMask 5 /* Mask (R/W) */
  332. #define R_C0_SelPageMask 0
  333. #define C0_PGMASK C0_PageMask /* OBSOLETE - DO NOT USE IN NEW CODE */
  334. #ifndef MIPS_SmartMIPS_ASE
  335. #define S_PageMaskMask 13
  336. #define M_PageMaskMask (0xffff << S_PageMaskMask)
  337. #define S_PageMaskMaskX 11
  338. #define M_PageMaskMaskX (0x3 << S_PageMaskMaskX)
  339. #define M_PageMask0Fields 0xe0001fff
  340. #define M_PageMaskRFields 0x00000000
  341. /*
  342. * Values in the Mask field
  343. */
  344. #define K_PageMask4K 0x0000 /* K_PageMasknn values are values for use */
  345. #define K_PageMask16K 0x0003 /* with KReqPageAttributes or KReqPageMask macros */
  346. #define K_PageMask64K 0x000f
  347. #define K_PageMask256K 0x003f
  348. #define K_PageMask1M 0x00ff
  349. #define K_PageMask4M 0x03ff
  350. #define K_PageMask16M 0x0fff
  351. #define K_PageMask64M 0x3fff
  352. #define K_PageMask256M 0xffff
  353. #else /* MIPS_SmartMIPS_ASE */
  354. /*
  355. * In a SmartMIPS MMU, the PageGrain register can be used to
  356. * enable extending the PageMask Mask field downward by another
  357. * two bits. The writable/useable bits of PageMask are thus
  358. * variable, and depend on the value of the PageGrain register.
  359. */
  360. #define S_PageMaskMask (C0_PageGrainMSOne + 1)
  361. #define M_PageMaskMask (((0x1 << (12 + (12 - C0_PageGrainMSOne))) - 1)\
  362. << S_PageMaskMask)
  363. #define M_PageMask0Fields (0xfe0007ff | \
  364. (C0_PageGrainValue & M_PageGrainMask))
  365. #define M_PageMaskRFields 0x00000000
  366. /*
  367. * 1K Pages are only possible if the PageGrain Mask field is zero
  368. */
  369. #define K_PageMask1K ((0x1 << (10 - C0_PageGrainMSOne)) - 1)
  370. #define M_PageMask1K (K_PageMask1K << S_PageMaskMask)
  371. /*
  372. * 2K Pages are possible if the PageGrain Mask field is zero or one.
  373. */
  374. #define K_PageMask2K ((0x1 << (11 - C0_PageGrainMSOne)) - 1)
  375. #define M_PageMask2K (K_PageMask2K << S_PageMaskMask)
  376. /*
  377. * 4K and larger pages are expressed differently depending on PageGrain
  378. */
  379. #define K_PageMask4K ((0x1 << (12 - C0_PageGrainMSOne)) - 1)
  380. #define K_PageMask16K ((0x1 << (14 - C0_PageGrainMSOne)) - 1)
  381. #define K_PageMask64K ((0x1 << (16 - C0_PageGrainMSOne)) - 1)
  382. #define K_PageMask256K ((0x1 << (18 - C0_PageGrainMSOne)) - 1)
  383. #define K_PageMask1M ((0x1 << (20 - C0_PageGrainMSOne)) - 1)
  384. #define K_PageMask4M ((0x1 << (22 - C0_PageGrainMSOne)) - 1)
  385. #define K_PageMask16M ((0x1 << (24 - C0_PageGrainMSOne)) - 1)
  386. #define K_PageMask64M ((0x1 << (26 - C0_PageGrainMSOne)) - 1)
  387. #define K_PageMask256M ((0x1 << (28 - C0_PageGrainMSOne)) - 1)
  388. #endif /* MIPS_SmartMIPS_ASE */
  389. #define M_PageMask4K (K_PageMask4K << S_PageMaskMask) /* M_PageMasknn values are masks */
  390. #define M_PageMask16K (K_PageMask16K << S_PageMaskMask) /* in position in the PageMask register */
  391. #define M_PageMask64K (K_PageMask64K << S_PageMaskMask)
  392. #define M_PageMask256K (K_PageMask256K << S_PageMaskMask)
  393. #define M_PageMask1M (K_PageMask1M << S_PageMaskMask)
  394. #define M_PageMask4M (K_PageMask4M << S_PageMaskMask)
  395. #define M_PageMask16M (K_PageMask16M << S_PageMaskMask)
  396. #define M_PageMask64M (K_PageMask64M << S_PageMaskMask)
  397. #define M_PageMask256M (K_PageMask256M << S_PageMaskMask)
  398. /* Shift amounts for different Page Size */
  399. #define S_PAGE1K 10
  400. #define S_PAGE2K 11
  401. #define S_PAGE4K 12
  402. #define S_PAGE16K 14
  403. #define S_PAGE64K 16
  404. #define S_PAGE256K 18
  405. #define S_PAGE1M 20
  406. #define S_PAGE4M 22
  407. #define S_PAGE16M 24
  408. #define S_PAGE64M 26
  409. #define S_PAGE256M 28
  410. #define S_PageMask1K (S_PAGE1K + 1)
  411. #define S_PageMask2K (S_PAGE2K + 1)
  412. #define S_PageMask4K (S_PAGE4K + 1)
  413. #define S_PageMask16K (S_PAGE16K + 1)
  414. #define S_PageMask64K (S_PAGE64K + 1)
  415. #define S_PageMask256K (S_PAGE256K + 1)
  416. #define S_PageMask1M (S_PAGE1M + 1)
  417. #define S_PageMask4M (S_PAGE4M + 1)
  418. #define S_PageMask16M (S_PAGE16M + 1)
  419. #define S_PageMask64M (S_PAGE64M + 1)
  420. #define S_PageMask256M (S_PAGE256M + 1)
  421. /* For Release 2 we need to write correct value to pagemask, default to 4k page*/
  422. #define K_1KPAGEMASK (0x00000)
  423. #define K_2KPAGEMASK (0x00800)
  424. #define K_4KPAGEMASK (0x01800)
  425. #define K_16KPAGEMASK (0x07800)
  426. #define K_64KPAGEMASK (0x1f800)
  427. #define K_256KPAGEMASK (0x7f800)
  428. #define K_1MPAGEMASK (0x1ff800)
  429. #define K_4MPAGEMASK (0x7ff800)
  430. #define K_16MPAGEMASK (0x1fff800)
  431. #define K_64MPAGEMASK (0x7fff800)
  432. #define K_256MPAGEMASK (0x1ffff800)
  433. #if defined(MIPS_SmartMIPS_ASE) || defined(MIPS_Release2)
  434. /*
  435. ************************************************************************
  436. * P A G E G R A I N R E G I S T E R ( 5, SELECT 1 ) *
  437. ************************************************************************
  438. *
  439. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  440. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  441. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  442. * | | |E| | | | | |
  443. * |R|X|L|E| | | | |
  444. * |I|I|P|S| 0 |Msk|1 1 1| 0 | PageGrain
  445. * |E|E|A|P| | | | |
  446. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  447. *
  448. * The PageGrain register, if implemented, allows for finer grained
  449. * pages than would be provided by the default behavior of PageMask
  450. * and EntryHi. The Mask bits can be cleared to enable 2K or 4K
  451. * page granularity.
  452. */
  453. #define C0_PageGrain $5,1
  454. #define R_C0_PageGrain 5 /* Mask (R/W) */
  455. #define R_C0_SelPageGrain 1
  456. #define S_PageGrainOnes 8
  457. #define M_PageGrainOnes (0x7 << S_PageGrainOnes)
  458. #define S_PageGrainMask 11
  459. #define M_PageGrainMask (0x3 << S_PageGrainMask)
  460. /*
  461. * To allow full backward compatibility, the RI/XI bits
  462. * in EntryLo0/EntryLo1 are write-enabled by the corresponding
  463. * enable bits of PageGrain.
  464. */
  465. #define S_PageGrainRIE 31 /* Read Inhibit Enable (R/W) */
  466. #define M_PageGrainRIE (0x1 << S_PageGrainRIE)
  467. #define S_PageGrainXIE 30 /* Execute Inhibit Enable (R/W) */
  468. #define M_PageGrainXIE (0x1 << S_PageGrainXIE)
  469. #define S_PageGrainELPA 29 /* Large Physical Page support */
  470. #define M_PageGrainELPA (0x1 << S_PageGrainELPA)
  471. #define S_PageGrainESP 28 /* 1k page support */
  472. #define M_PageGrainESP (0x1 << S_PageGrainESP)
  473. #if defined(MIPS_SmartMIPS_ASE) && defined(MIPS_Release2)
  474. #define M_PageGrain0Fields 0x0fffe0ff
  475. #define M_PageGrainRFields 0x00000700
  476. #else
  477. #if defined(MIPS_Release2)
  478. #define M_PageGrain0Fields 0xcfffffff
  479. #define M_PageGrainRFields 0x00000000
  480. #else
  481. #define M_PageGrain0Fields 0x3fffe0ff
  482. #define M_PageGrainRFields 0x00000700
  483. #endif
  484. #endif
  485. /*
  486. * The Value of the PageGrain register affects the observable
  487. * behavior of PageMask and EntryHi. These effects are dynamic,
  488. * and as such THE FOLLOWING SYMBOLS SHOULD BE OVERRIDDEN WITH
  489. * FUNCTION CALLS OR REFERENCES TO RUN-TIME VARIABLES IN ANY
  490. * DYNAMIC MODEL OF A SmartMIPS CPU. They are defined here as
  491. * contstants with the reset default value.
  492. */
  493. #ifndef C0_PageGrainMSOne
  494. #define C0_PageGrainMSOne 12
  495. #endif /* C0_PageGrainMSOne */
  496. #define C0_PageGrainValue ((((0x1 << \
  497. (C0_PageGrainMSOne - S_PageGrainMask + 1)) - 1)\
  498. << S_PageGrainMask) | M_PageGrainOnes)
  499. #endif /* MIPS_SmartMIPS_ASE */
  500. /*
  501. ************************************************************************
  502. * W I R E D R E G I S T E R ( 6 ) *
  503. ************************************************************************
  504. *
  505. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  506. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  507. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  508. * | 0 | Index | Wired
  509. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  510. */
  511. #define C0_Wired $6
  512. #define R_C0_Wired 6
  513. #define R_C0_SelWired 0
  514. #define C0_TLBWIRED C0_Wired /* OBSOLETE - DO NOT USE IN NEW CODE */
  515. #define S_WiredIndex 0 /* TLB wired boundary (R/W) */
  516. #define M_WiredIndex (0x3f << S_WiredIndex)
  517. #define M_Wired0Fields 0xffffffc0
  518. #define M_WiredRFields 0x00000000
  519. #ifdef MIPS_Release2
  520. /*
  521. ************************************************************************
  522. * H W R E n a R E G I S T E R ( 7 ) *
  523. ************************************************************************
  524. *
  525. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  526. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  527. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  528. * | 0 | mask | HWREna
  529. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  530. */
  531. #define C0_HWREna $7
  532. #define R_C0_HWREna 7
  533. #define R_C0_SelHWREna 0
  534. #define S_HWREnaMask 0 /* Mask bits (R/W) */
  535. #define M_HWREnaMask (0xF << S_HWREnaMask)
  536. /*
  537. * The following defines both the individual mask bits, and the RDHWR
  538. * register numbers that correspond to the masks.
  539. */
  540. #define S_HWREnaMask_CPUNum 0
  541. #define M_HWREnaMask_CPUNum (1 << S_HWREnaMask_CPUNum)
  542. #define S_HWREnaMask_CycleCount 2
  543. #define M_HWREnaMask_CycleCount (1 << S_HWREnaMask_CycleCount)
  544. #define S_HWREnaMask_SYNCI_Step 1
  545. #define M_HWREnaMask_SYNCI_Step (1 << S_HWREnaMask_SYNCI_Step)
  546. #define S_HWREnaMask_CC 2
  547. #define M_HWREnaMask_CC (1 << S_HWREnaMask_CC)
  548. #define S_HWREnaMask_CCRes 3
  549. #define M_HWREnaMask_CCRes (1 << S_HWREnaMask_CCRes)
  550. #define HWR_CPUNum $0 /* CPUNum */
  551. #define R_HWR_CPUNum S_HWREnaMask_CPUNum
  552. #define HWR_SYNCI_Step $1 /* Address step for SYNCI */
  553. #define R_HWR_SYNCI_Step S_HWREnaMask_SYNCI_Step
  554. #define HWR_CycleCount $2 /* Cycle counter */
  555. #define R_HWR_CycleCount S_HWREnaMask_CycleCount
  556. #define HWR_CC $2 /* CycleCounter */
  557. #define R_HWR_CC S_HWREnaMask_CC
  558. #define HWR_CCRes $3 /* CCRes */
  559. #define R_HWR_CCRes S_HWREnaMask_CCRes
  560. #define M_HWREna0Fields 0xfffffff0
  561. #define M_HWREnaRFields 0x00000000
  562. #endif /* ifdef MIPS_Release2 */
  563. /*
  564. ************************************************************************
  565. * B A D V A D D R R E G I S T E R ( 8 ) *
  566. ************************************************************************
  567. *
  568. * 6 // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  569. * 3 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  570. * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  571. * | // Bad Virtual Address | BadVAddr
  572. * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  573. */
  574. #define C0_BadVAddr $8
  575. #define R_C0_BadVAddr 8
  576. #define R_C0_SelBadVAddr 0
  577. #define C0_BADVADDR C0_BadVAddr /* OBSOLETE - DO NOT USE IN NEW CODE */
  578. #define M_BadVAddrOddPage K_PageSize /* Even/Odd VA bit for pair of PAs */
  579. #define M_BadVAddr0Fields 0x00000000
  580. #define M_BadVAddrRFields 0xffffffff
  581. #define M_BadVAddr0Fields64 UINT64_C(0x0000000000000000)
  582. #define M_BadVAddrRFields64 UINT64_C(0xffffffffffffffff)
  583. /*
  584. ************************************************************************
  585. * C O U N T R E G I S T E R ( 9 ) *
  586. ************************************************************************
  587. *
  588. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  589. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  590. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  591. * | Count Value | Count
  592. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  593. */
  594. #define C0_Count $9
  595. #define R_C0_Count 9
  596. #define R_C0_SelCount 0
  597. #define C0_COUNT C0_Count /* OBSOLETE - DO NOT USE IN NEW CODE */
  598. #define M_Count0Fields 0x00000000
  599. #define M_CountRFields 0x00000000
  600. /*
  601. ************************************************************************
  602. * E N T R Y H I R E G I S T E R ( 1 0 ) *
  603. ************************************************************************
  604. *
  605. * 6 6 6 6 5 // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  606. * 3 2 1 0 9 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  607. * +-+-+-+-+-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  608. * | R | Fill // VPN2 | 0 | ASID | EntryHi
  609. * +-+-+-+-+-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  610. */
  611. #define C0_EntryHi $10
  612. #define R_C0_EntryHi 10
  613. #define R_C0_SelEntryHi 0
  614. #define C0_TLBHI C0_EntryHi /* OBSOLETE - DO NOT USE IN NEW CODE */
  615. #define S_EntryHiR64 62 /* Region (R/W) */
  616. #define M_EntryHiR64 UINT64_C(0xc000000000000000)
  617. #ifndef MIPS_SmartMIPS_ASE
  618. #define S_EntryHiVPN2 13 /* VPN/2 (R/W) */
  619. #define M_EntryHiVPN2 (0x7ffff << S_EntryHiVPN2)
  620. #define M_EntryHiVPN264 UINT64_C(0x000000ffffffe000)
  621. #ifdef MIPS_Release2
  622. #define S_EntryHiVPN2X 11
  623. #define M_EntryHiVPN2X (0x3 << S_EntryHiVPN2X)
  624. #define M_EntryHi0Fields 0x00000700
  625. #define M_EntryHiRFields 0x00000000
  626. #define M_EntryHi0Fields64 UINT64_C(0x0000000000000700)
  627. #else
  628. #define M_EntryHi0Fields 0x00001f00
  629. #define M_EntryHiRFields 0x00000000
  630. #define M_EntryHi0Fields64 UINT64_C(0x0000000000001f00)
  631. #endif
  632. #else /* MIPS_SmartMIPS_ASE */
  633. #define S_EntryHiVPN2 (C0_PageGrainMSOne + 1)
  634. #define M_EntryHiVPN2 (((0x1 << (19 + (12 - C0_PageGrainMSOne)))-1)\
  635. << S_EntryHiVPN2)
  636. #define M_EntryHiVPN264 (((UINT64_C(0x1) << \
  637. (27 + (12 - C0_PageGrainMSOne)))-1)\
  638. << S_EntryHiVPN2)
  639. #define M_EntryHi0Fields (0x00000700 | \
  640. (C0_PageGrainValue & M_PageGrainMask))
  641. #define M_EntryHiRFields 0x00000000
  642. #define M_EntryHi0Fields64 (UINT64_C(0x0000000000001f00) | \
  643. (C0_PageGrainValue & M_PageGrainMask))
  644. #endif /* MIPS_SmartMIPS_ASE */
  645. #define M_EntryHiRFields64 UINT64_C(0x3fffff0000000000)
  646. #define S_EntryHiASID 0 /* ASID (R/W) */
  647. #define M_EntryHiASID (0xff << S_EntryHiASID)
  648. #define S_EntryHiVPN_Shf S_EntryHiVPN2
  649. /*
  650. ************************************************************************
  651. * C O M P A R E R E G I S T E R ( 1 1 ) *
  652. ************************************************************************
  653. *
  654. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  655. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  656. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  657. * | Compare Value | Compare
  658. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  659. */
  660. #define C0_Compare $11
  661. #define R_C0_Compare 11
  662. #define R_C0_SelCompare 0
  663. #define C0_COMPARE C0_Compare /* OBSOLETE - DO NOT USE IN NEW CODE */
  664. #define M_Compare0Fields 0x00000000
  665. #define M_CompareRFields 0x00000000
  666. /*
  667. ************************************************************************
  668. * S T A T U S R E G I S T E R ( 1 2 ) *
  669. ************************************************************************
  670. *
  671. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  672. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  673. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  674. * |C|C|C|C|R|F|R|M|P|B|T|S|M| | R |I|I|I|I|I|I|I|I|K|S|U|U|R|E|E|I|
  675. * |U|U|U|U|P|R|E|X|X|E|S|R|M| | s |M|M|M|M|M|M|M|M|X|X|X|M|s|R|X|E| Status
  676. * |3|2|1|0| | | | | |V| | |I| | v |7|6|5|4|3|2|1|0| | | | |v|L|L| |
  677. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  678. */
  679. #define C0_Status $12
  680. #define R_C0_Status 12
  681. #define R_C0_SelStatus 0
  682. #define C0_SR C0_Status /* OBSOLETE - DO NOT USE IN NEW CODE */
  683. #define S_StatusCU 28 /* Coprocessor enable (R/W) */
  684. #define M_StatusCU (0xf << S_StatusCU)
  685. #define S_StatusCU3 31 /* No longer used in Release 2 */
  686. #define M_StatusCU3 (0x1 << S_StatusCU3)
  687. #define S_StatusCU2 30
  688. #define M_StatusCU2 (0x1 << S_StatusCU2)
  689. #define S_StatusCU1 29
  690. #define M_StatusCU1 (0x1 << S_StatusCU1)
  691. #define S_StatusCU0 28
  692. #define M_StatusCU0 (0x1 << S_StatusCU0)
  693. #define S_StatusRP 27 /* Enable reduced power mode (R/W) */
  694. #define M_StatusRP (0x1 << S_StatusRP)
  695. #define S_StatusFR 26 /* Enable 64-bit FPRs (R/W) */
  696. #define M_StatusFR (0x1 << S_StatusFR)
  697. #define S_StatusRE 25 /* Enable reverse endian (R/W) */
  698. #define M_StatusRE (0x1 << S_StatusRE)
  699. #define S_StatusMX 24 /* Enable access to MDMX and DSP ASE's (R/W) */
  700. #define M_StatusMX (0x1 << S_StatusMX)
  701. #define S_StatusPX 23 /* Enable access to 64-bit instructions/data (MIPS64 only) (R/W) */
  702. #define M_StatusPX (0x1 << S_StatusPX)
  703. #define S_StatusBEV 22 /* Enable Boot Exception Vectors (R/W) */
  704. #define M_StatusBEV (0x1 << S_StatusBEV)
  705. #define S_StatusTS 21 /* Denote TLB shutdown (R/W) */
  706. #define M_StatusTS (0x1 << S_StatusTS)
  707. #define S_StatusSR 20 /* Denote soft reset (R/W) */
  708. #define M_StatusSR (0x1 << S_StatusSR)
  709. #define S_StatusNMI 19
  710. #define M_StatusNMI (0x1 << S_StatusNMI) /* Denote NMI (R/W) */
  711. #define S_StatusIM 8 /* Interrupt mask (R/W) */
  712. #define M_StatusIM (0xff << S_StatusIM)
  713. #define S_StatusIM7 15
  714. #define M_StatusIM7 (0x1 << S_StatusIM7)
  715. #define S_StatusIM6 14
  716. #define M_StatusIM6 (0x1 << S_StatusIM6)
  717. #define S_StatusIM5 13
  718. #define M_StatusIM5 (0x1 << S_StatusIM5)
  719. #define S_StatusIM4 12
  720. #define M_StatusIM4 (0x1 << S_StatusIM4)
  721. #define S_StatusIM3 11
  722. #define M_StatusIM3 (0x1 << S_StatusIM3)
  723. #define S_StatusIM2 10
  724. #define M_StatusIM2 (0x1 << S_StatusIM2)
  725. #define S_StatusIM1 9
  726. #define M_StatusIM1 (0x1 << S_StatusIM1)
  727. #define S_StatusIM0 8
  728. #define M_StatusIM0 (0x1 << S_StatusIM0)
  729. #define S_StatusIPL 10
  730. #define M_StatusIPL (0x3f << S_StatusIPL)
  731. #define S_StatusKX 7 /* Enable access to extended kernel addresses (MIPS64 only) (R/W) */
  732. #define M_StatusKX (0x1 << S_StatusKX)
  733. #define S_StatusSX 6 /* Enable access to extended supervisor addresses (MIPS64 only) (R/W) */
  734. #define M_StatusSX (0x1 << S_StatusSX)
  735. #define S_StatusUX 5 /* Enable access to extended user addresses (MIPS64 only) (R/W) */
  736. #define M_StatusUX (0x1 << S_StatusUX)
  737. #define S_StatusKSU 3 /* Two-bit current mode (R/W) */
  738. #define M_StatusKSU (0x3 << S_StatusKSU)
  739. #define S_StatusUM 4 /* User mode if supervisor mode not implemented (R/W) */
  740. #define M_StatusUM (0x1 << S_StatusUM)
  741. #define S_StatusSM 3 /* Supervisor mode (R/W) */
  742. #define M_StatusSM (0x1 << S_StatusSM)
  743. #define S_StatusERL 2 /* Denotes error level (R/W) */
  744. #define M_StatusERL (0x1 << S_StatusERL)
  745. #define S_StatusEXL 1 /* Denotes exception level (R/W) */
  746. #define M_StatusEXL (0x1 << S_StatusEXL)
  747. #define S_StatusIE 0 /* Enables interrupts (R/W) */
  748. #define M_StatusIE (0x1 << S_StatusIE)
  749. #define M_Status0Fields 0x00040000
  750. #define M_StatusRFields 0x058000e0 /* FR, MX, PX, KX, SX, UX unused in MIPS32 */
  751. #define M_Status0Fields64 0x00040000
  752. #define M_StatusRFields64 0x00000000
  753. /*
  754. * Values in the KSU field
  755. */
  756. #define K_StatusKSU_U 2 /* User mode in KSU field */
  757. #define K_StatusKSU_S 1 /* Supervisor mode in KSU field */
  758. #define K_StatusKSU_K 0 /* Kernel mode in KSU field */
  759. #ifdef MIPS_Release2
  760. /*
  761. ************************************************************************
  762. * I N T C T L R E G I S T E R ( 1 2, SELECT 1 ) *
  763. ************************************************************************
  764. *
  765. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  766. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  767. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  768. * | I | I | | | |
  769. * | P | P | 0 | VS | 0 | IntCtl
  770. * | T | P | | | |
  771. * | I | C | | | |
  772. * | | I | | | |
  773. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  774. */
  775. #define C0_IntCtl $12,1
  776. #define R_C0_IntCtl 12
  777. #define R_C0_SelIntCtl 1
  778. #define S_IntCtlIPTI 29
  779. #define M_IntCtlIPTI (0x7 << S_IntCtlIPTI)
  780. #define W_IntCtlIPTI 3
  781. #define S_IntCtlIPPCI 26
  782. #define M_IntCtlIPPCI (0x7 << S_IntCtlIPPCI)
  783. #define S_IntCtlVS 5
  784. #define M_IntCtlVS (0x1f << S_IntCtlVS)
  785. #define M_IntCtl0Fields 0x03fffc1f
  786. #define M_IntCtlRFields 0xfc000000
  787. /*
  788. * Constants in the VS field
  789. */
  790. #define K_IntCtlVS0 0x00 /* 0 bytes */
  791. #define K_IntCtlVS32 0x01 /* 32 bytes */
  792. #define K_IntCtlVS64 0x02 /* 64 bytes */
  793. #define K_IntCtlVS128 0x04 /* 128 bytes */
  794. #define K_IntCtlVS256 0x08 /* 256 bytes */
  795. #define K_IntCtlVS512 0x10 /* 512 bytes */
  796. /*
  797. ************************************************************************
  798. * S R S C t l R E G I S T E R ( 1 2, SELECT 2 ) *
  799. ************************************************************************
  800. *
  801. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  802. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  803. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  804. * | 0 | HSS | 0 | EICSS | 0 | ESS | 0 | PSS | 0 | CSS | : SRSCtl
  805. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  806. *
  807. */
  808. #define C0_SRSCtl $12,2
  809. #define R_C0_SRSCtl 12
  810. #define R_C0_SelSRSCtl 2
  811. #define S_SRSCtlHSS 26 /* Highest shadow set (R) */
  812. #define W_SRSCtlHSS 4
  813. #define M_SRSCtlHSS (0xf << S_SRSCtlHSS)
  814. #define S_SRSCtlEICSS 18 /* Exception shadow set (R/W) */
  815. #define W_SRSCtlEICSS 4
  816. #define M_SRSCtlEICSS (0xf << S_SRSCtlEICSS)
  817. #define S_SRSCtlESS 12 /* Exception shadow set (R/W) */
  818. #define W_SRSCtlESS 4
  819. #define M_SRSCtlESS (0xf << S_SRSCtlESS)
  820. #define S_SRSCtlPSS 6 /* Previous shadow set (R/W) */
  821. #define W_SRSCtlPSS 4
  822. #define M_SRSCtlPSS (0xf << S_SRSCtlPSS)
  823. #define S_SRSCtlCSS 0
  824. #define W_SRSCtlCSS 4
  825. #define M_SRSCtlCSS (0xf << S_SRSCtlCSS) /* Current Shadow set (R/W) */
  826. #define M_SRSCtl0Fields 0xc3c30c30
  827. #define M_SRSCtlRFields 0x3c3c000f
  828. /*
  829. ************************************************************************
  830. * S R S Map R E G I S T E R ( 1 2, SELECT 3 ) *
  831. ************************************************************************
  832. *
  833. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  834. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  835. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  836. * | SSV7 | SSV6 | SSV5 | SSV4 | SSV3 | SSV2 | SSV1 | SSV0 | SRSMap
  837. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  838. */
  839. #define C0_SRSMap $12, 3
  840. #define R_C0_SRSMap 12
  841. #define R_C0_SelSRSMap 3
  842. #define S_SRSMapSSV7 28 /* Shadow Register for SSV7 */
  843. #define W_SRSMapSSV7 4
  844. #define M_SRSMapSSV7 (0xf << S_SRSMapSSV7)
  845. #define S_SRSMapSSV6 24 /* Shadow Register for SSV6 */
  846. #define W_SRSMapSSV6 4
  847. #define M_SRSMapSSV6 (0xf << S_SRSMapSSV6)
  848. #define S_SRSMapSSV5 20 /* Shadow Register for SSV5 */
  849. #define W_SRSMapSSV5 4
  850. #define M_SRSMapSSV5 (0xf << S_SRSMapSSV5)
  851. #define S_SRSMapSSV4 16 /* Shadow Register for SSV4 */
  852. #define W_SRSMapSSV4 4
  853. #define M_SRSMapSSV4 (0xf << S_SRSMapSSV4)
  854. #define S_SRSMapSSV3 12 /* Shadow Register for SSV3 */
  855. #define W_SRSMapSSV3 4
  856. #define M_SRSMapSSV3 (0xf << S_SRSMapSSV3)
  857. #define S_SRSMapSSV2 8 /* Shadow Register for SSV2 */
  858. #define W_SRSMapSSV2 4
  859. #define M_SRSMapSSV2 (0xf << S_SRSMapSSV2)
  860. #define S_SRSMapSSV1 4 /* Shadow Register for SSV1 */
  861. #define W_SRSMapSSV1 4
  862. #define M_SRSMapSSV1 (0xf << S_SRSMapSSV1)
  863. #define S_SRSMapSSV0 0 /* Shadow Register for SSV0 */
  864. #define W_SRSMapSSV0 4
  865. #define M_SRSMapSSV0 (0xf << S_SRSMapSSV0)
  866. #define M_SRSMap0Fields 0x00000000
  867. #define M_SRSMapRFields 0xffffffff
  868. /*
  869. ************************************************************************
  870. * S R S H i R E G I S T E R ( 1 2, SELECT 4 ) *
  871. ************************************************************************
  872. *
  873. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  874. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  875. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  876. * | 0 | IPL12 | IPL11 | IPL10 | IPL9 | IPL8 |
  877. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  878. */
  879. #define C0_SRSHi $12, 4
  880. #define R_C0_SRSHi 12
  881. #define R_C0_SelSRSHi 4
  882. #define S_SRSHiIPL12 16 /* Shadow Register for IPL12 */
  883. #define W_SRSHiIPL12 4
  884. #define M_SRSHiIPL12 (0xf << S_SRSHiIPL12)
  885. #define S_SRSHiIPL11 12 /* Shadow Register for IPL11 */
  886. #define W_SRSHiIPL11 4
  887. #define M_SRSHiIPL11 (0xf << S_SRSHiIPL11)
  888. #define S_SRSHiIPL10 8 /* Shadow Register for IPL10 */
  889. #define W_SRSHiIPL10 4
  890. #define M_SRSHiIPL10 (0xf << S_SRSHiIPL10)
  891. #define S_SRSHiIPL9 4 /* Shadow Register for IPL9 */
  892. #define W_SRSHiIPL9 4
  893. #define M_SRSHiIPL9 (0xf << S_SRSHiIPL9)
  894. #define S_SRSHiIPL8 0 /* Shadow Register for IPL8 */
  895. #define W_SRSHiIPL8 4
  896. #define M_SRSHiIPL8 (0xf << S_SRSHiIPL8)
  897. #define M_SRSHi0Fields 0xfff00000
  898. #define M_SRSHiRFields 0x000fffff
  899. #endif /* Release2 */
  900. /*
  901. ************************************************************************
  902. * C A U S E R E G I S T E R ( 1 3 ) *
  903. ************************************************************************
  904. *
  905. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  906. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  907. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  908. * | | | | | | |I|W| | | | | | |I|I|I|I|I|I|I|I| | | |
  909. * |B|0| C |0|0| 0 |V|P| | | | | | |P|P|P|P|P|P|P|P|0| ExcCode | 0 | Cause
  910. * |D| | E | | | | | | | | | | | |7|6|5|4|3|2|1|0| | | |
  911. * | | | | | | | | | | | | | | | | | | | | | | | | | |
  912. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  913. * T D P \---RIPL----/
  914. * I C C Release 2
  915. * I
  916. */
  917. #define C0_Cause $13
  918. #define R_C0_Cause 13
  919. #define R_C0_SelCause 0
  920. #define C0_CAUSE C0_Cause /* OBSOLETE - DO NOT USE IN NEW CODE */
  921. #define S_CauseBD 31
  922. #define M_CauseBD (0x1 << S_CauseBD)
  923. #define S_CauseCE 28
  924. #define M_CauseCE (0x3<< S_CauseCE)
  925. #define S_CauseIV 23
  926. #define M_CauseIV (0x1 << S_CauseIV)
  927. #define S_CauseWP 22
  928. #define M_CauseWP (0x1 << S_CauseWP)
  929. #define S_CauseIP 8
  930. #define M_CauseIP (0xff << S_CauseIP)
  931. #define S_CauseIPEXT 10
  932. #define M_CauseIPEXT (0x3f << S_CauseIPEXT)
  933. #define S_CausePCI 26
  934. #define M_CausePCI (0x1 << S_CausePCI)
  935. #define S_CauseDC 27
  936. #define M_CauseDC (0x1 << S_CauseDC)
  937. #define S_CauseTI 30
  938. #define M_CauseTI (0x1 << S_CauseTI)
  939. #define S_CauseRIPL 10
  940. #define M_CauseRIPL (0x3f << S_CauseRIPL)
  941. #define S_CauseIP13 21
  942. #define M_CauseIP13 (0x1 << S_CauseIP13)
  943. #define S_CauseIP12 20
  944. #define M_CauseIP12 (0x1 << S_CauseIP12)
  945. #define S_CauseIP11 19
  946. #define M_CauseIP11 (0x1 << S_CauseIP10)
  947. #define S_CauseIP10 18
  948. #define M_CauseIP10 (0x1 << S_CauseIP9)
  949. #define S_CauseIP9 17
  950. #define M_CauseIP9 (0x1 << S_CauseIP8)
  951. #define S_CauseIP8 16
  952. #define M_CauseIP8 (0x1 << S_CauseIP7)
  953. #define S_CauseIP7 15
  954. #define M_CauseIP7 (0x1 << S_CauseIP7)
  955. #define S_CauseIP6 14
  956. #define M_CauseIP6 (0x1 << S_CauseIP6)
  957. #define S_CauseIP5 13
  958. #define M_CauseIP5 (0x1 << S_CauseIP5)
  959. #define S_CauseIP4 12
  960. #define M_CauseIP4 (0x1 << S_CauseIP4)
  961. #define S_CauseIP3 11
  962. #define M_CauseIP3 (0x1 << S_CauseIP3)
  963. #define S_CauseIP2 10
  964. #define M_CauseIP2 (0x1 << S_CauseIP2)
  965. #define S_CauseIP1 9
  966. #define M_CauseIP1 (0x1 << S_CauseIP1)
  967. #define S_CauseIP0 8
  968. #define M_CauseIP0 (0x1 << S_CauseIP0)
  969. #define S_CauseExcCode 2
  970. #define M_CauseExcCode (0x1f << S_CauseExcCode)
  971. #ifdef MIPS_Release2
  972. #define M_Cause0FieldsR2 0x033f0083
  973. #define M_CauseRFieldsR2 0xf400fc7c
  974. #endif
  975. #define M_Cause0Fields 0x4f3f0083
  976. #define M_CauseRFields 0xb000fc7c
  977. /*
  978. * Values in the CE field
  979. */
  980. #define K_CauseCE0 0 /* Coprocessor 0 in the CE field */
  981. #define K_CauseCE1 1 /* Coprocessor 1 in the CE field */
  982. #define K_CauseCE2 2 /* Coprocessor 2 in the CE field */
  983. #define K_CauseCE3 3 /* Coprocessor 3 in the CE field */
  984. /*
  985. * Values in the ExcCode field
  986. */
  987. #define EX_INT 0 /* Interrupt */
  988. #define EXC_INT (EX_INT << S_CauseExcCode)
  989. #define EX_MOD 1 /* TLB modified */
  990. #define EXC_MOD (EX_MOD << S_CauseExcCode)
  991. #define EX_TLBL 2 /* TLB exception (load or ifetch) */
  992. #define EXC_TLBL (EX_TLBL << S_CauseExcCode)
  993. #define EX_TLBS 3 /* TLB exception (store) */
  994. #define EXC_TLBS (EX_TLBS << S_CauseExcCode)
  995. #define EX_ADEL 4 /* Address error (load or ifetch) */
  996. #define EXC_ADEL (EX_ADEL << S_CauseExcCode)
  997. #define EX_ADES 5 /* Address error (store) */
  998. #define EXC_ADES (EX_ADES << S_CauseExcCode)
  999. #define EX_IBE 6 /* Instruction Bus Error */
  1000. #define EXC_IBE (EX_IBE << S_CauseExcCode)
  1001. #define EX_DBE 7 /* Data Bus Error */
  1002. #define EXC_DBE (EX_DBE << S_CauseExcCode)
  1003. #define EX_SYS 8 /* Syscall */
  1004. #define EXC_SYS (EX_SYS << S_CauseExcCode)
  1005. #define EX_SYSCALL EX_SYS
  1006. #define EXC_SYSCALL EXC_SYS
  1007. #define EX_BP 9 /* Breakpoint */
  1008. #define EXC_BP (EX_BP << S_CauseExcCode)
  1009. #define EX_BREAK EX_BP
  1010. #define EXC_BREAK EXC_BP
  1011. #define EX_RI 10 /* Reserved instruction */
  1012. #define EXC_RI (EX_RI << S_CauseExcCode)
  1013. #define EX_CPU 11 /* CoProcessor Unusable */
  1014. #define EXC_CPU (EX_CPU << S_CauseExcCode)
  1015. #define EX_OV 12 /* OVerflow */
  1016. #define EXC_OV (EX_OV << S_CauseExcCode)
  1017. #define EX_TR 13 /* Trap instruction */
  1018. #define EXC_TR (EX_TR << S_CauseExcCode)
  1019. #define EX_TRAP EX_TR
  1020. #define EXC_TRAP EXC_TR
  1021. #define EX_FPE 15 /* floating point exception */
  1022. #define EXC_FPE (EX_FPE << S_CauseExcCode)
  1023. #define EX_CEU 17 /* CorExtend exception */
  1024. #define EXC_CEU (EX_CEU << S_CauseExcCode)
  1025. #define EX_C2E 18 /* COP2 exception */
  1026. #define EXC_C2E (EX_C2E << S_CauseExcCode)
  1027. #define EX_MDMX 22 /* MDMX exception */
  1028. #define EXC_MDMX (EX_MDMX << S_CauseExcCode)
  1029. #define EX_WATCH 23 /* Watch exception */
  1030. #define EXC_WATCH (EX_WATCH << S_CauseExcCode)
  1031. #define EX_MCHECK 24 /* Machine check exception */
  1032. #define EXC_MCHECK (EX_MCHECK << S_CauseExcCode)
  1033. #define EX_THREAD 25 /* MT Thread exception */
  1034. #define EXC_THREAD (EX_THREAD << S_CauseExcCode)
  1035. #define EX_DSPDIS 26 /* DSP Disabled exception */
  1036. #define EXC_DSPDIS (EX_DSPDIS << S_CauseExcCode)
  1037. #define EX_CacheErr 30 /* Cache error caused re-entry to Debug Mode */
  1038. #define EXC_CacheErr (EX_CacheErr << S_CauseExcCode)
  1039. /*
  1040. ************************************************************************
  1041. * E P C R E G I S T E R ( 1 4 ) *
  1042. ************************************************************************
  1043. *
  1044. * 6 // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  1045. * 3 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  1046. * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1047. * | // Exception PC | EPC
  1048. * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1049. */
  1050. #define C0_EPC $14
  1051. #define R_C0_EPC 14
  1052. #define R_C0_SelEPC 0
  1053. #define M_EPC0Fields 0x00000000
  1054. #define M_EPCRFields 0x00000000
  1055. #define M_EPC0Fields64 UINT64_C(0x0000000000000000)
  1056. #define M_EPCRFields64 UINT64_C(0x0000000000000000)
  1057. /*
  1058. ************************************************************************
  1059. * P R I D R E G I S T E R ( 1 5 ) *
  1060. ************************************************************************
  1061. *
  1062. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  1063. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  1064. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1065. * | Company Opts | Company ID | Procesor ID | Revision | PRId
  1066. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1067. */
  1068. #define C0_PRId $15
  1069. #define R_C0_PRId 15
  1070. #define R_C0_SelPRId 0
  1071. #define C0_PRID C0_PRID /* OBSOLETE - DO NOT USE IN NEW CODE */
  1072. #define S_PRIdCoOpt 24 /* Company options (R) */
  1073. #define M_PRIdCoOpt (0xff << S_PRIdCoOpt)
  1074. #define S_PRIdCoID 16 /* Company ID (R) */
  1075. #define M_PRIdCoID (0xff << S_PRIdCoID)
  1076. #define S_PRIdImp 8 /* Implementation ID (R) */
  1077. #define M_PRIdImp (0xff << S_PRIdImp)
  1078. #define S_PRIdRev 0 /* Revision (R) */
  1079. #define M_PRIdRev (0xff << S_PRIdRev)
  1080. #define M_PRId0Fields 0x00000000
  1081. #define M_PRIdRFields 0xffffffff
  1082. /*
  1083. * Values in the Company ID field
  1084. */
  1085. #define K_PRIdCoID_MIPS 1
  1086. #define K_PRIdCoID_Broadcom 2
  1087. #define K_PRIdCoID_Alchemy 3
  1088. #define K_PRIdCoID_SiByte 4
  1089. #define K_PRIdCoID_SandCraft 5
  1090. #define K_PRIdCoID_Philips 6
  1091. #define K_PRIdCoID_Toshiba 7
  1092. #define K_PRIdCoID_LSI 8
  1093. #define K_PRIdCoID_Intrinsity 9
  1094. #define K_PRIdCoID_UNANNOUNCED10 10
  1095. #define K_PRIdCoID_Lexra 11
  1096. #define K_PRIdCoID_UNANNOUNCED12 12
  1097. #define K_PRIdCoID_UNANNOUNCED13 13
  1098. #define K_PRIdCoID_NextAvailable 14 /* Next available encoding */
  1099. /*
  1100. * Values in the implementation number field
  1101. */
  1102. #define K_PRIdImp_4KC 0x80 /* MIPS32 4Kc with TLB MMU and Release 1 Architecture*/
  1103. #define K_PRIdImp_Jade 0x80 /* Alternate (obsolete) name */
  1104. #define K_PRIdImp_5KC 0x81 /* MIPS64 5Kc/5Kf with TLB MMU and Release 1 Architecture */
  1105. #define K_PRIdImp_Opal 0x81 /* Alternate (obsolete) name */
  1106. #define K_PRIdImp_20KC 0x82 /* MIPS64 20Kc with TLB MMU and Release 1 Architecture */
  1107. #define K_PRIdImp_Ruby 0x82 /* Alternate (obsolete) name */
  1108. #define K_PRIdImp_4KMP 0x83 /* MIPS32 4Kp/4Km with FM MMU and Release 1 Architectur */
  1109. #define K_PRIdImp_JadeLite 0x83 /* Alternate (obsolete) name */
  1110. #define K_PRIdImp_4KEc 0x84 /* MIPS32 4KEc with TLB MMU and Release 1 Architecture */
  1111. #define K_PRIdImp_4KEmp 0x85 /* MIPS32 4KEm/4KEp with FM MMU and Release 1 Architecture */
  1112. #define K_PRIdImp_4KSc 0x86 /* MIPS32 4KSc with TLB MMU and Release 1 Architecture */
  1113. #define K_PRIdImp_M4K 0x87 /* MIPS32 M4K with FM MMU and Release 2 Architecture */
  1114. #define K_PRIdImp_25Kf 0x88 /* MIPS64 25Kf with TLB MMU and Release 1 Architecture */
  1115. #define K_PRIdImp_Amethyst 0x88 /* Alternate (obsolete) name */
  1116. #define K_PRIdImp_5KE 0x89 /* MIPS64 5KE with TLB MMU and Release 2 Architecture */
  1117. #define K_PRIdImp_4KEc_R2 0x90 /* MIPS32 4KEc with TLB MMU and Release 2 Architecture */
  1118. #define K_PRIdImp_4KEmp_R2 0x91 /* MIPS32 4KEm/4KEp with FM MMU and Release 2 Architecture */
  1119. #define K_PRIdImp_4KSd 0x92 /* MIPS32 4KSd with TLB MMU and Release 2 Architecture */
  1120. #define K_PRIdImp_24K 0x93 /* MIPS32 24K (Topaz) with Release 2 Architecture */
  1121. #define K_PRIdImp_Topaz 0x93 /* Alternate (obsolete) name */
  1122. #define K_PRIdImp_TopazTLB 0x93 /* Alternate (obsolete) name */
  1123. #define K_PRIdImp_34K 0x95 /* MIPS32 34K */
  1124. #define K_PRIdImp_24KE 0x96 /* MIPS32 24KE */
  1125. #define K_PRIdImp_R3000 0x01
  1126. #define K_PRIdImp_R4000 0x04
  1127. #define K_PRIdImp_R10000 0x09
  1128. #define K_PRIdImp_R4300 0x0b
  1129. #define K_PRIdImp_R5000 0x23
  1130. #define K_PRIdImp_R5200 0x28
  1131. #define K_PRIdImp_R5400 0x54
  1132. #ifdef MIPS_Release2
  1133. /*
  1134. ************************************************************************
  1135. * E B A S E R E G I S T E R ( 1 5, SELECT 1 ) *
  1136. ************************************************************************
  1137. *
  1138. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  1139. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  1140. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1141. * |1|0| Exception Base |0 0| CPUNum | EBase
  1142. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1143. */
  1144. #define C0_EBase $15,1
  1145. #define R_C0_EBase 15
  1146. #define R_C0_SelEBase 1
  1147. #ifdef MIPS_MT
  1148. #define S_EBaseVPENum 0 /* VPE number in the CPUNum field */
  1149. #define M_EBaseVPENum (0xf << S_EBaseVPENum)
  1150. #endif
  1151. #define S_EBaseVA 12 /* Exception Base (R/W) */
  1152. #define M_EBaseVA (0xfffff << S_EBaseVA)
  1153. #define S_EBaseCPUNum 0 /* CPU Number (R) */
  1154. #define M_EBaseCPUNum (0x3ff << S_EBaseCPUNum)
  1155. #define M_EBase0Fields 0x40000C00
  1156. #define M_EBaseRFields 0x800003ff
  1157. #endif
  1158. /*
  1159. ************************************************************************
  1160. * C O N F I G R E G I S T E R ( 1 6 ) *
  1161. ************************************************************************
  1162. *
  1163. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  1164. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  1165. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1166. * |M| |B| A | A | M |RSVD |V| K | Config
  1167. * | | Reserved for Implementations|E| T | R | T | |I| 0 |
  1168. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1169. */
  1170. #define C0_Config $16
  1171. #define R_C0_Config 16
  1172. #define R_C0_SelConfig 0
  1173. #define C0_CONFIG C0_Config /* OBSOLETE - DO NOT USE IN NEW CODE */
  1174. #define S_ConfigMore 31 /* Additional config registers present (R) */
  1175. #define M_ConfigMore (0x1 << S_ConfigMore)
  1176. #define S_ConfigImpl 16 /* Implementation-specific fields */
  1177. #define M_ConfigImpl (0x7fff << S_ConfigImpl)
  1178. #define S_ConfigBE 15 /* Denotes big-endian operation (R) */
  1179. #define M_ConfigBE (0x1 << S_ConfigBE)
  1180. #define S_ConfigAT 13 /* Architecture type (R) */
  1181. #define M_ConfigAT (0x3 << S_ConfigAT)
  1182. #define W_ConfigAT 2
  1183. #define S_ConfigAR 10 /* Architecture revision (R) */
  1184. #define M_ConfigAR (0x7 << S_ConfigAR)
  1185. #define S_ConfigMT 7 /* MMU Type (R) */
  1186. #define M_ConfigMT (0x7 << S_ConfigMT)
  1187. #define W_ConfigMT 3
  1188. #define S_ConfigVI 3 /* Icache is virtual (R) */
  1189. #define M_ConfigVI (0x1 << S_ConfigVI)
  1190. #define S_ConfigK0 0 /* Kseg0 coherency algorithm (R/W) */
  1191. #define M_ConfigK0 (0x7 << S_ConfigK0)
  1192. #define W_ConfigK0 3
  1193. /*
  1194. * The following definitions are technically part of the "reserved for
  1195. * implementations" field, but are the semi-standard definition used in
  1196. * fixed-mapping MMUs to control the cacheability of kuseg and kseg2/3
  1197. * references. For that reason, they are included here, but may be
  1198. * overridden by true implementation-specific definitions
  1199. */
  1200. #define S_ConfigK23 28 /* Kseg2/3 coherency algorithm (FM MMU only) (R/W) */
  1201. #define M_ConfigK23 (0x7 << S_ConfigK23)
  1202. #define W_ConfigK23 3
  1203. #define S_ConfigKU 25 /* Kuseg coherency algorithm (FM MMU only) (R/W) */
  1204. #define M_ConfigKU (0x7 << S_ConfigKU)
  1205. #define W_ConfigKU 3
  1206. #define M_Config0Fields 0x00000070
  1207. #define M_ConfigRFields 0x8000ff88
  1208. /*
  1209. * Values in the AT field
  1210. */
  1211. #define K_ConfigAT_MIPS32 0 /* MIPS32 */
  1212. #define K_ConfigAT_MIPS64S 1 /* MIPS64 with 32-bit addresses */
  1213. #define K_ConfigAT_MIPS64 2 /* MIPS64 with 32/64-bit addresses */
  1214. #define K_ConfigAT_MAX 2 /* Max value */
  1215. /*
  1216. * Values in the AR field
  1217. */
  1218. #define K_ConfigAR_Rel1 0 /* Release 1 of the architecture */
  1219. #define K_ConfigAR_Rel2 1 /* Release 2 of the architecture */
  1220. /*
  1221. * Values in the MT field
  1222. */
  1223. #define K_ConfigMT_NoMMU 0 /* No MMU */
  1224. #define K_ConfigMT_TLBMMU 1 /* Standard TLB MMU */
  1225. #define K_ConfigMT_BATMMU 2 /* Standard BAT MMU */
  1226. #define K_ConfigMT_FMTMMU 3 /* Standard FMT MMU */
  1227. #define K_ConfigMT_FMMMU K_ConfigMT_FMTMMU /* alias for compatibility */
  1228. /*
  1229. ************************************************************************
  1230. * C O N F I G 1 R E G I S T E R ( 1 6, SELECT 1 ) *
  1231. ************************************************************************
  1232. *
  1233. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  1234. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  1235. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1236. * |M| MMU Size | IS | IL | IA | DS | DL | DA |C|M|P|W|C|E|F| Config1
  1237. * | | | | | | | | |2|D|C|R|A|P|P|
  1238. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1239. */
  1240. #define C0_Config1 $16,1
  1241. #define R_C0_Config1 16
  1242. #define R_C0_SelConfig1 1
  1243. #define S_Config1M 31 /* Additional Config registers present (R) */
  1244. #define M_Config1M (0x1 << S_Config1More)
  1245. #define S_Config1More S_Config1M /* OBSOLETE */
  1246. #define M_Config1More (0x1 << S_Config1M)
  1247. #define S_Config1MMUSize 25 /* Number of MMU entries - 1 (R) */
  1248. #define M_Config1MMUSize (0x3f << S_Config1MMUSize)
  1249. #define W_Config1MMUSize 6
  1250. #define S_Config1IS 22 /* Icache sets per way (R) */
  1251. #define M_Config1IS (0x7 << S_Config1IS)
  1252. #define W_Config1IS 3
  1253. #define S_Config1IL 19 /* Icache line size (R) */
  1254. #define M_Config1IL (0x7 << S_Config1IL)
  1255. #define W_Config1IL 3
  1256. #define S_Config1IA 16 /* Icache associativity - 1 (R) */
  1257. #define M_Config1IA (0x7 << S_Config1IA)
  1258. #define W_Config1IA 3
  1259. #define S_Config1DS 13 /* Dcache sets per way (R) */
  1260. #define M_Config1DS (0x7 << S_Config1DS)
  1261. #define W_Config1DS 3
  1262. #define S_Config1DL 10 /* Dcache line size (R) */
  1263. #define M_Config1DL (0x7 << S_Config1DL)
  1264. #define W_Config1DL 3
  1265. #define S_Config1DA 7 /* Dcache associativity (R) */
  1266. #define M_Config1DA (0x7 << S_Config1DA)
  1267. #define S_Config1C2 6 /* Coprocessor 2 present (R) */
  1268. #define W_Config1DA 3
  1269. #define M_Config1C2 (0x1 << S_Config1C2)
  1270. #define S_Config1MD 5 /* Denotes MDMX present (R) */
  1271. #define M_Config1MD (0x1 << S_Config1MD)
  1272. #define S_Config1PC 4 /* Denotes performance counters present (R) */
  1273. #define M_Config1PC (0x1 << S_Config1PC)
  1274. #define S_Config1WR 3 /* Denotes watch registers present (R) */
  1275. #define M_Config1WR (0x1 << S_Config1WR)
  1276. #define S_Config1CA 2 /* Denotes MIPS-16 present (R) */
  1277. #define M_Config1CA (0x1 << S_Config1CA)
  1278. #define S_Config1EP 1 /* Denotes EJTAG present (R) */
  1279. #define M_Config1EP (0x1 << S_Config1EP)
  1280. #define S_Config1FP 0 /* Denotes floating point present (R) */
  1281. #define M_Config1FP (0x1 << S_Config1FP)
  1282. #define W_Config1FP 1
  1283. #define M_Config10Fields 0x00000000
  1284. #define M_Config1RFields 0xffffffff
  1285. /*
  1286. * The following macro generates a table that is indexed
  1287. * by the Icache or Dcache sets field in Config1 or the
  1288. * Scache or Tcache sets field in Config2 and
  1289. * contains the decoded value of sets per way
  1290. */
  1291. #define Config1CacheSets() \
  1292. HALF(64); \
  1293. HALF(128); \
  1294. HALF(256); \
  1295. HALF(512); \
  1296. HALF(1024); \
  1297. HALF(2048); \
  1298. HALF(4096); \
  1299. HALF(8192); \
  1300. HALF(0); \
  1301. HALF(0); \
  1302. HALF(0); \
  1303. HALF(0); \
  1304. HALF(0); \
  1305. HALF(0); \
  1306. HALF(0); \
  1307. HALF(0);
  1308. /*
  1309. * The following macro generates a table that is indexed
  1310. * by the Icache or Dcache line size field in Config1 or
  1311. * the Scache or Tcache line size field in Config2 and
  1312. * contains the decoded value of the cache line size, in bytes
  1313. */
  1314. #define Config1CacheLineSize() \
  1315. HALF(0); \
  1316. HALF(4); \
  1317. HALF(8); \
  1318. HALF(16); \
  1319. HALF(32); \
  1320. HALF(64); \
  1321. HALF(128); \
  1322. HALF(256); \
  1323. HALF(0); \
  1324. HALF(0); \
  1325. HALF(0); \
  1326. HALF(0); \
  1327. HALF(0); \
  1328. HALF(0); \
  1329. HALF(0); \
  1330. HALF(0);
  1331. /*
  1332. ************************************************************************
  1333. * C O N F I G 2 R E G I S T E R ( 1 6, SELECT 2 ) *
  1334. ************************************************************************
  1335. *
  1336. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  1337. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  1338. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1339. * |M| TU | TS | TL | TA | SU | SS | SL | SA | Config2
  1340. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1341. */
  1342. #define C0_Config2 $16,2
  1343. #define R_C0_Config2 16
  1344. #define R_C0_SelConfig2 2
  1345. #define S_Config2M 31 /* Additional Config registers present (R) */
  1346. #define M_Config2M (0x1 << S_Config2M)
  1347. #define M_Config20Fields 0xffffffff
  1348. #define M_Config2RFields 0x00000000
  1349. /*
  1350. * The following definitions are not inside a MIPS_Release2 conditional
  1351. * because a number of Release 1 chips have stanardized on this
  1352. * definition.
  1353. */
  1354. #define S_Config2TU 28
  1355. #define M_Config2TU (0x7 << S_Config2TU) /* Implementation-dependent tertiary cache control (R/W) */
  1356. #define S_Config2TS 24
  1357. #define M_Config2TS (0xf << S_Config2TS) /* Tertiary cache sets per way (R) */
  1358. #define S_Config2TL 20
  1359. #define M_Config2TL (0xf << S_Config2TL) /* Tertiary cache line size (R) */
  1360. #define S_Config2TA 16
  1361. #define M_Config2TA (0xf << S_Config2TA) /* Tertiary cache associativity (R) */
  1362. #define S_Config2SU 12
  1363. #define M_Config2SU (0xf << S_Config2SU) /* Implementation-dependent secondary cache control (R/W) */
  1364. #define S_Config2SS 8
  1365. #define M_Config2SS (0xf << S_Config2SS) /* Secondary cache sets per way (R) */
  1366. #define S_Config2SL 4
  1367. #define M_Config2SL (0xf << S_Config2SL) /* Secondary cache line size (R) */
  1368. #define S_Config2SA 0
  1369. #define M_Config2SA (0xf << S_Config2SA) /* Secondary cache associativity (R) */
  1370. /*
  1371. ************************************************************************
  1372. * C O N F I G 3 R E G I S T E R ( 1 6, SELECT 3 ) *
  1373. ************************************************************************
  1374. *
  1375. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  1376. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  1377. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1378. * | | |D| | |V|V| | | | | |
  1379. * | | |S| |L|E|I| | |M| | |
  1380. * |M| |P| |P|I|n|S| |T|S|T| Config3
  1381. * | | |P| |A|C|t|P| | |M|L|
  1382. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1383. */
  1384. #define C0_Config3 $16,3
  1385. #define R_C0_Config3 16
  1386. #define R_C0_SelConfig3 3
  1387. #define S_Config3M 31 /* Additional Config registers present (R) */
  1388. #define M_Config3M (0x1 << S_Config3M)
  1389. #define S_Config3DSPP 10 /* DSP Present */
  1390. #define M_Config3DSPP (0x1 << S_Config3DSPP)
  1391. #define S_Config3LPA 7 /* Large Physical address support */
  1392. #define M_Config3LPA (0x1 << S_Config3LPA)
  1393. #define S_Config3VEIC 6
  1394. #define M_Config3VEIC (0x1 << S_Config3VEIC)
  1395. #define S_Config3VInt 5 /* External Interrupt controller support*/
  1396. #define M_Config3VInt (0x1 << S_Config3VInt)
  1397. #define S_Config3SP 4 /* Small Page & PageGrain present */
  1398. #define M_Config3SP (0x1 << S_Config3SP)
  1399. #define S_Config3MT 2 /* MT ASE is implemented */
  1400. #define M_Config3MT (0x1 << S_Config3MT)
  1401. #define S_Config3SM 1 /* Denotes SmartMIPS ASE present (R) */
  1402. #define M_Config3SM (0x1 << S_Config3SM)
  1403. #define S_Config3TL 0 /* Denotes Tracing Logic present (R) */
  1404. #define M_Config3TL (0x1 << S_Config3TL)
  1405. #ifdef MIPS_Release2
  1406. #define M_Config30Fields 0xffffff00
  1407. #define M_Config3RFields 0x000000ff
  1408. #else
  1409. #define M_Config30Fields 0xfffffff0
  1410. #define M_Config3RFields 0x0000000f
  1411. #endif
  1412. /*
  1413. ************************************************************************
  1414. * L L A D D R R E G I S T E R ( 1 7 ) *
  1415. ************************************************************************
  1416. *
  1417. * 6 6 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  1418. * 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  1419. * +-+-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1420. * | // LL Physical Address | LLAddr
  1421. * +-+-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1422. */
  1423. #define C0_LLAddr $17
  1424. #define R_C0_LLAddr 17
  1425. #define R_C0_SelLLAddr 0
  1426. #define C0_LLADDR C0_LLAddr /* OBSOLETE - DO NOT USE IN NEW CODE */
  1427. #define M_LLAddr0Fields 0x00000000
  1428. #define M_LLAddrRFields 0x00000000
  1429. #define M_LLAddr0Fields64 UINT64_C(0x0000000000000000)
  1430. #define M_LLAddrRFields64 UINT64_C(0x0000000000000000)
  1431. /*
  1432. ************************************************************************
  1433. * W A T C H L O R E G I S T E R ( 1 8 ) *
  1434. ************************************************************************
  1435. *
  1436. * 6 // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  1437. * 3 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  1438. * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1439. * | // Watch Virtual Address |I|R|W| WatchLo
  1440. * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1441. */
  1442. #define C0_WatchLo $18
  1443. #define R_C0_WatchLo 18
  1444. #define R_C0_SelWatchLo 0
  1445. #define C0_WATCHLO C0_WatchLo /* OBSOLETE - DO NOT USE IN NEW CODE */
  1446. #define S_WatchLoVAddr 3 /* Watch virtual address (R/W) */
  1447. #define M_WatchLoVAddr (0x1fffffff << S_WatchLoVAddr)
  1448. #define S_WatchLoI 2 /* Enable Istream watch (R/W) */
  1449. #define M_WatchLoI (0x1 << S_WatchLoI)
  1450. #define S_WatchLoR 1 /* Enable data read watch (R/W) */
  1451. #define M_WatchLoR (0x1 << S_WatchLoR)
  1452. #define S_WatchLoW 0 /* Enable data write watch (R/W) */
  1453. #define M_WatchLoW (0x1 << S_WatchLoW)
  1454. #define M_WatchLo0Fields 0x00000000
  1455. #define M_WatchLoRFields 0x00000000
  1456. #define M_WatchLo0Fields64 UINT64_C(0x0000000000000000)
  1457. #define M_WatchLoRFields64 UINT64_C(0x0000000000000000)
  1458. #define M_WatchLoEnables (M_WatchLoI | M_WatchLoR | M_WatchLoW)
  1459. /*
  1460. ************************************************************************
  1461. * W A T C H H I R E G I S T E R ( 1 9 ) *
  1462. ************************************************************************
  1463. *
  1464. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  1465. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  1466. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1467. * |M|G| Rsvd | ASID | Rsvd | Mask | 0 | WatchHi
  1468. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1469. */
  1470. #define C0_WatchHi $19
  1471. #define R_C0_WatchHi 19
  1472. #define R_C0_SelWatchHi 0
  1473. #define C0_WATCHHI C0_WatchHi /* OBSOLETE - DO NOT USE IN NEW CODE */
  1474. #define S_WatchHiM 31 /* Denotes additional Watch registers present (R) */
  1475. #define M_WatchHiM (0x1 << S_WatchHiM)
  1476. #define S_WatchHiG 30 /* Enable ASID-independent Watch match (R/W) */
  1477. #define M_WatchHiG (0x1 << S_WatchHiG)
  1478. #define S_WatchHiASID 16 /* ASID value to match (R/W) */
  1479. #define M_WatchHiASID (0xff << S_WatchHiASID)
  1480. #define S_WatchHiMask 3 /* Address inhibit mask (R/W) */
  1481. #define M_WatchHiMask (0x1ff << S_WatchHiMask)
  1482. #ifdef MIPS_Release2
  1483. #define S_WatchHiI 2
  1484. #define M_WatchHiI (0x1 << S_WatchHiI)
  1485. #define S_WatchHiR 1
  1486. #define M_WatchHiR (0x1 << S_WatchHiR)
  1487. #define S_WatchHiW 0
  1488. #define M_WatchHiW (0x1 << S_WatchHiW)
  1489. #define M_WatchHi0Fields 0x3f00f000
  1490. #define M_WatchHiRFields 0x80000000
  1491. #else
  1492. #define M_WatchHi0Fields 0x3f00f007
  1493. #define M_WatchHiRFields 0x80000000
  1494. #endif
  1495. /*
  1496. ************************************************************************
  1497. * X C O N T E X T R E G I S T E R ( 2 0 ) *
  1498. ************************************************************************
  1499. *
  1500. * 6 // 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  1501. * 3 // 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  1502. * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1503. * | // PTEBase | R | BadVPN2<39:13> | 0 | XContext
  1504. * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1505. */
  1506. #define C0_XContext $20
  1507. #define R_C0_XContext 20
  1508. #define R_C0_SelXContext 0
  1509. #define C0_EXTCTXT C0_XContext /* OBSOLETE - DO NOT USE IN NEW CODE */
  1510. #define S_XContextBadVPN2 4 /* BadVPN2 (R) */
  1511. #define S_XContextBadVPN S_XContextBadVPN2
  1512. #define M_XContext0Fields 0x0000000f
  1513. /*
  1514. ************************************************************************
  1515. * D E B U G R E G I S T E R ( 2 3 ) *
  1516. ************************************************************************
  1517. *
  1518. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  1519. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  1520. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1521. * |D|D|N|L|D|H|C|I|M|C|D|I|D|D| | |N|S| |D|D|D|D|D|D|
  1522. * |B|M|o|S|o|a|o|B|C|a|B|E|D|D|EJTAG|DExcCode |o|S| |I|I|D|D|B|S|
  1523. * |D| |D|N|z|l|u|u|h|c|u|X|B|B| ver | |S|t| |N|B|B|B|p|S|
  1524. * | | |C|M|e|t|n|s|e|h|s|I|S|L| | |S| | 0 |T| |S|L| | | Debug
  1525. * | | |R| | | |t|E|c|e|E| |I|I| | |t| | | | | | | | |
  1526. * | | | | | | |D|P|k|E|P| |m|m| | | | | | | | | | | |
  1527. * | | | | | | |M| |P|P| | |p|p| | | | | | | | | | | |
  1528. * | | | | | | | | | | | | |r|r| | | | | | | | | | | |
  1529. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1530. */
  1531. #define C0_Debug $23 /* EJTAG */
  1532. #define R_C0_Debug 23
  1533. #define R_C0_SelDebug 0
  1534. #define S_DebugDBD 31 /* Debug branch delay (R) */
  1535. #define M_DebugDBD (0x1 << S_DebugDBD)
  1536. #define S_DebugDM 30 /* Debug mode (R) */
  1537. #define M_DebugDM (0x1 << S_DebugDM)
  1538. #define S_DebugNoDCR 29 /* No debug control register present (R) */
  1539. #define M_DebugNoDCR (0x1 << S_DebugNoDCR)
  1540. #define S_DebugLSNM 28 /* Load/Store Normal Memory (R/W) */
  1541. #define M_DebugLSNM (0x1 << S_DebugLSNM)
  1542. #define S_DebugDoze 27 /* Doze (R) */
  1543. #define M_DebugDoze (0x1 << S_DebugDoze)
  1544. #define S_DebugHalt 26 /* Halt (R) */
  1545. #define M_DebugHalt (0x1 << S_DebugHalt)
  1546. #define S_DebugCountDM 25 /* Count register behavior in debug mode (R/W) */
  1547. #define M_DebugCountDM (0x1 << S_DebugCountDM)
  1548. #define S_DebugIBusEP 24 /* Imprecise Instn Bus Error Pending (R/W) */
  1549. #define M_DebugIBusEP (0x1 << S_DebugIBusEP)
  1550. #define S_DebugMCheckP 23 /* Imprecise Machine Check Pending (R/W) */
  1551. #define M_DebugMCheckP (0x1 << S_DebugMCheckP)
  1552. #define S_DebugCacheEP 22 /* Imprecise Cache Error Pending (R/W) */
  1553. #define M_DebugCacheEP (0x1 << S_DebugCacheEP)
  1554. #define S_DebugDBusEP 21 /* Imprecise Data Bus Error Pending (R/W) */
  1555. #define M_DebugDBusEP (0x1 << S_DebugDBusEP)
  1556. #define S_DebugIEXI 20 /* Imprecise Exception Inhibit (R/W) */
  1557. #define M_DebugIEXI (0x1 << S_DebugIEXI)
  1558. #define S_DebugDDBSImpr 19 /* Debug data break store imprecise (R) */
  1559. #define M_DebugDDBSImpr (0x1 << S_DebugDDBSImpr)
  1560. #define S_DebugDDBLImpr 18 /* Debug data break load imprecise (R) */
  1561. #define M_DebugDDBLImpr (0x1 << S_DebugDDBLImpr)
  1562. #define S_DebugEJTAGver 15 /* EJTAG version number (R) */
  1563. #define M_DebugEJTAGver (0x7 << S_DebugEJTAGver)
  1564. #define S_DebugDExcCode 10 /* Debug exception code (R) */
  1565. #define M_DebugDExcCode (0x1f << S_DebugDExcCode)
  1566. #define S_DebugNoSSt 9 /* No single step implemented (R) */
  1567. #define M_DebugNoSSt (0x1 << S_DebugNoSSt)
  1568. #define S_DebugSSt 8 /* Single step enable (R/W) */
  1569. #define M_DebugSSt (0x1 << S_DebugSSt)
  1570. #define S_DebugDINT 5 /* Debug interrupt (R) */
  1571. #define M_DebugDINT (0x1 << S_DebugDINT)
  1572. #define S_DebugDIB 4 /* Debug instruction break (R) */
  1573. #define M_DebugDIB (0x1 << S_DebugDIB)
  1574. #define S_DebugDDBS 3 /* Debug data break store (R) */
  1575. #define M_DebugDDBS (0x1 << S_DebugDDBS)
  1576. #define S_DebugDDBL 2 /* Debug data break load (R) */
  1577. #define M_DebugDDBL (0x1 << S_DebugDDBL)
  1578. #define S_DebugDBp 1 /* Debug breakpoint (R) */
  1579. #define M_DebugDBp (0x1 << S_DebugDBp)
  1580. #define S_DebugDSS 0 /* Debug single step (R) */
  1581. #define M_DebugDSS (0x1 << S_DebugDSS)
  1582. #define M_Debug0Fields 0x01f000c0
  1583. #define M_DebugRFields 0xec0ffe3f
  1584. /*
  1585. ************************************************************************
  1586. * T r a c e C o n t r o l R E G I S T E R ( 2 3, SELECT 1 ) *
  1587. ************************************************************************
  1588. */
  1589. #define C0_TraceControl $23,1
  1590. #define R_C0_TraceControl 23
  1591. #define R_C0_SelTraceControl 1
  1592. #define S_TraceControlTS 31 /* Trace Select */
  1593. #define M_TraceControlTS (0x1 << S_TraceControlTS)
  1594. #define S_TraceControlUT 30 /* User Triggered */
  1595. #define M_TraceControlUT (0x1 << S_TraceControlUT)
  1596. #define S_TraceControlTPC 28 /* Trace PC */
  1597. #define M_TraceControlTPC (0x1 << S_TraceControlTPC)
  1598. #define S_TraceControlTB 27 /* Trace Branch */
  1599. #define M_TraceControlTB (0x1 << S_TraceControlTB)
  1600. #define S_TraceControlIO 26 /* Inhibit Overflow */
  1601. #define M_TraceControlIO (0x1 << S_TraceControlIO)
  1602. #define S_TraceControlD 25 /* Debug Mode Enable */
  1603. #define M_TraceControlD (0x1 << S_TraceControlD)
  1604. #define S_TraceControlE 24 /* Exception Mode Enable */
  1605. #define M_TraceControlE (0x1 << S_TraceControlE)
  1606. #define S_TraceControlK 23 /* Kernel Mode Enable */
  1607. #define M_TraceControlK (0x1 << S_TraceControlK)
  1608. #define S_TraceControlS 22 /* Supervisor Mode Enable */
  1609. #define M_TraceControlS (0x1 << S_TraceControlS)
  1610. #define S_TraceControlU 21 /* User Mode Enable */
  1611. #define M_TraceControlU (0x1 << S_TraceControlU)
  1612. #define S_TraceControlASID_M 13 /* ASID Mask */
  1613. #define M_TraceControlASID_M (0xff << S_TraceControlASID_M)
  1614. #define S_TraceControlASID 5 /* ASID */
  1615. #define M_TraceControlASID (0xff << S_TraceControlASID)
  1616. #define S_TraceControlG 4 /* Global (all ASIDs) */
  1617. #define M_TraceControlG (0x1 << S_TraceControlG)
  1618. #define S_TraceControlTFCR 3 /* Trace Function Call and Return */
  1619. #define M_TraceControlTFCR (0x1 << S_TraceControlTFCR)
  1620. #define S_TraceControlTLSM 2 /* Trace Load Store Misses */
  1621. #define M_TraceControlTLSM (0x1 << S_TraceControlTLSM)
  1622. #define S_TraceControlTIM 1 /* Trace Instruction Missses */
  1623. #define M_TraceControlTIM (0x1 << S_TraceControlTIM)
  1624. #define S_TraceControlOn 0 /* Master Trace Enable */
  1625. #define M_TraceControlOn (0x1 << S_TraceControlOn)
  1626. /* Reserved bits */
  1627. #define M_TraceControlR (0x1 << 29)
  1628. /*
  1629. ************************************************************************
  1630. * T r a c e C o n t r o l 2 R E G I S T E R ( 2 3, SELECT 2 ) *
  1631. ************************************************************************
  1632. */
  1633. #define C0_TraceControl2 $23,2
  1634. #define R_C0_TraceControl2 23
  1635. #define R_C0_SelTraceControl2 2
  1636. #define S_TraceControl2CPUIdV 29 /* Trace Specified VPE only */
  1637. #define M_TraceControl2CPUIdV (0x1 << S_TraceControl2CPUIdV)
  1638. #define S_TraceControl2CPUId 21 /* VPE number to trace */
  1639. #define M_TraceControl2CPUId (0xff << S_TraceControl2CPUId)
  1640. #define S_TraceControl2TCV 20 /* Trace Specified TC only */
  1641. #define M_TraceControl2TCV (0x1 << S_TraceControl2TCV)
  1642. #define S_TraceControl2TCNum 12 /* TC number to trace */
  1643. #define M_TraceControl2TCNum (0xff << S_TraceControl2TCNum)
  1644. #define S_TraceControl2Mode 7 /* Trace Mode */
  1645. #define M_TraceControl2Mode (0x1f << S_TraceControl2Mode)
  1646. #define S_TraceControl2ValidModes 5 /* Trace Modes supported by the processor */
  1647. #define M_TraceControl2ValidModes (0x3 << S_TraceControl2ValidModes)
  1648. #define S_TraceControl2TBI 4 /* Trace Buffers Implemented */
  1649. #define M_TraceControl2TBI (0x1f << S_TraceControl2TBI)
  1650. #define S_TraceControl2TBU 3 /* Trace Buffer in Use */
  1651. #define M_TraceControl2TBU (0x1f << S_TraceControl2TBU)
  1652. #define S_TraceControl2SyP 0 /* Sync Period */
  1653. #define M_TraceControl2SyP (0x7 << S_TraceControl2SyP)
  1654. /* Reserved bits */
  1655. #define M_TraceControl2R (0x3 << 30)
  1656. /*
  1657. ************************************************************************
  1658. * U s e r T r a c e D a t a R E G I S T E R ( 2 3, SELECT 3 ) *
  1659. ************************************************************************
  1660. */
  1661. #define C0_UserTraceData $23,3
  1662. #define R_C0_UserTraceData 23
  1663. #define R_C0_SelUserTraceData 3
  1664. #if defined(MIPS_Model64)
  1665. #define M_UserTraceDataData UINT64_C(0xffffffffffffffff)
  1666. #else
  1667. #define M_UserTraceDataData 0xffffffff
  1668. #endif
  1669. /*
  1670. ************************************************************************
  1671. * T r a c e B P C R E G I S T E R ( 2 3, SELECT 4 ) *
  1672. ************************************************************************
  1673. */
  1674. #define C0_TraceBPC $23,4
  1675. #define R_C0_TraceBPC 23
  1676. #define R_C0_SelTraceBPC 4
  1677. #define S_TraceBPCDE 31 /* Enable EJTAG data breakpoint triggers */
  1678. #define M_TraceBPCDE (0x1 << S_TraceBPCDE)
  1679. #define S_TraceBPCDBPOn 16 /* Enable individual EJTAG data breakpoints to trigger tracing */
  1680. #define M_TraceBPCDBPOn (0x7fff << S_TraceBPCDBPOn)
  1681. #define S_TraceBPCIE 15 /* Enable EJTAG instruction breakpoint triggers */
  1682. #define M_TraceBPCIE (0x1 << S_TraceBPCIE)
  1683. #define S_TraceBPCIBPOn 0 /* Enable individual EJTAG instruction breakpoints to trigger tracing */
  1684. #define M_TraceBPCIBPOn (0x7fff << S_TraceBPCIBPOn)
  1685. /*
  1686. ************************************************************************
  1687. * D E P C R E G I S T E R ( 2 4 ) *
  1688. ************************************************************************
  1689. *
  1690. * 6 // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  1691. * 3 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  1692. * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1693. * | // EJTAG Debug Exception PC | DEPC
  1694. * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1695. */
  1696. #define C0_DEPC $24
  1697. #define R_C0_DEPC 24
  1698. #define R_C0_SelDEPC 0
  1699. #define M_DEEPC0Fields 0x00000000
  1700. #define M_DEEPCRFields 0x00000000
  1701. #define M_DEEPC0Fields64 UINT64_C(0x0000000000000000)
  1702. #define M_DEEPCRFields64 UINT64_C(0x0000000000000000)
  1703. /*
  1704. ************************************************************************
  1705. * P E R F C N T R E G I S T E R ( 2 5 ) *
  1706. ************************************************************************
  1707. *
  1708. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  1709. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  1710. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1711. * | | | | |I| | | |E|
  1712. * |M|W| 0 | Event |E|U|S|K|X| PerfCnt
  1713. * | | | | | | | | |L|
  1714. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1715. *
  1716. *
  1717. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  1718. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  1719. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1720. * | Event Count | PerfCnt
  1721. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1722. */
  1723. #define C0_PerfCnt $25
  1724. #define R_C0_PerfCnt 25
  1725. #define R_C0_SelPerfCnt 0
  1726. #define C0_PRFCNT0 C0_PerfCnt /* OBSOLETE - DO NOT USE IN NEW CODE */
  1727. #define C0_PRFCNT1 C0_PerfCnt /* OBSOLETE - DO NOT USE IN NEW CODE */
  1728. #define S_PerfCntM 31 /* More performance counters exist (R) */
  1729. #define M_PerfCntM (1 << S_PerfCntM)
  1730. #ifdef MIPS_Release2
  1731. #define S_PerfCntW 30 /* Event count is 64 bits (R) */
  1732. #define M_PerfCntW (1 << S_PerfCntW)
  1733. #endif
  1734. #define S_PerfCntEvent 5 /* Enabled event (R/W) */
  1735. #define M_PerfCntEvent (0x3f << S_PerfCntEvent)
  1736. #define S_PerfCntIE 4 /* Interrupt Enable (R/W) */
  1737. #define M_PerfCntIE (1 << S_PerfCntIE)
  1738. #define S_PerfCntU 3 /* Enable counting in User Mode (R/W) */
  1739. #define M_PerfCntU (1 << S_PerfCntU)
  1740. #define S_PerfCntS 2 /* Enable counting in Supervisor Mode (R/W) */
  1741. #define M_PerfCntS (1 << S_PerfCntS)
  1742. #define S_PerfCntK 1 /* Enable counting in Kernel Mode (R/W) */
  1743. #define M_PerfCntK (1 << S_PerfCntK)
  1744. #define S_PerfCntEXL 0 /* Enable counting while EXL==1 (R/W) */
  1745. #define M_PerfCntEXL (1 << S_PerfCntEXL)
  1746. #ifdef MIPS_Release2
  1747. #define M_PerfCnt0Fields 0x3ffff800
  1748. #define M_PerfCntRFields 0xc0000000
  1749. #else
  1750. #define M_PerfCnt0Fields 0x7ffff800
  1751. #define M_PerfCntRFields 0x80000000
  1752. #endif
  1753. /*
  1754. ************************************************************************
  1755. * E R R C T L R E G I S T E R ( 2 6 ) *
  1756. ************************************************************************
  1757. *
  1758. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  1759. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  1760. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1761. * | Error Control | ErrCtl
  1762. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1763. */
  1764. #define C0_ErrCtl $26
  1765. #define R_C0_ErrCtl 26
  1766. #define R_C0_SelErrCtl 0
  1767. #define C0_ECC $26 /* OBSOLETE - DO NOT USE IN NEW CODE */
  1768. #define R_C0_ECC 26 /* OBSOLETE - DO NOT USE IN NEW CODE */
  1769. #define M_ErrCtl0Fields 0x00000000
  1770. #define M_ErrCtlRFields 0x00000000
  1771. /*
  1772. ************************************************************************
  1773. * C A C H E E R R R E G I S T E R ( 2 7 ) * CacheErr
  1774. ************************************************************************
  1775. *
  1776. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  1777. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  1778. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1779. * | Cache Error Control | CacheErr
  1780. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1781. */
  1782. #define C0_CacheErr $27
  1783. #define R_C0_CacheErr 27
  1784. #define R_C0_SelCacheErr 0
  1785. #define C0_CACHE_ERR C0_CacheErr /* OBSOLETE - DO NOT USE IN NEW CODE */
  1786. #define M_CacheErr0Fields 0x00000000
  1787. #define M_CachErrRFields 0x00000000
  1788. /*
  1789. ************************************************************************
  1790. * T A G L O R E G I S T E R ( 2 8 ) * TagLo
  1791. ************************************************************************
  1792. *
  1793. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  1794. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  1795. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1796. * | TagLo | TagLo
  1797. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1798. */
  1799. #define C0_TagLo $28
  1800. #define R_C0_TagLo 28
  1801. #define R_C0_SelTagLo 0
  1802. #define C0_TAGLO C0_TagLo /* OBSOLETE - DO NOT USE IN NEW CODE */
  1803. /*
  1804. * Some implementations use separate TagLo registers for the
  1805. * instruction and data caches. In those cases, the following
  1806. * definitions can be used in relevant code
  1807. */
  1808. #define C0_ITagLo $28,0
  1809. #define C0_DTagLo $28,2
  1810. #define M_TagLo0Fields 0x00000000
  1811. #define M_TagLoRFields 0x00000000
  1812. /*
  1813. ************************************************************************
  1814. * D A T A L O R E G I S T E R ( 2 8, SELECT 1 ) * DataLo
  1815. ************************************************************************
  1816. *
  1817. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  1818. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  1819. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1820. * | DataLo | DataLo
  1821. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1822. */
  1823. #define C0_DataLo $28,1
  1824. #define R_C0_DataLo 28
  1825. #define R_C0_SelDataLo 1
  1826. /*
  1827. * Some implementations use separate DataLo registers for the
  1828. * instruction and data caches. In those cases, the following
  1829. * definitions can be used in relevant code
  1830. */
  1831. #define C0_IDataLo $28,1
  1832. #define C0_DDataLo $28,3
  1833. #define M_DataLo0Fields 0x00000000
  1834. #define M_DataLoRFields 0xffffffff
  1835. /*
  1836. ************************************************************************
  1837. * T A G H I R E G I S T E R ( 2 9 ) * TagHi
  1838. ************************************************************************
  1839. *
  1840. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  1841. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  1842. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1843. * | TagHi | TagHi
  1844. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1845. */
  1846. #define C0_TagHi $29
  1847. #define R_C0_TagHi 29
  1848. #define R_C0_SelTagHi 0
  1849. #define C0_TAGHI C0_TagHi /* OBSOLETE - DO NOT USE IN NEW CODE */
  1850. /*
  1851. * Some implementations use separate TagHi registers for the
  1852. * instruction and data caches. In those cases, the following
  1853. * definitions can be used in relevant code
  1854. */
  1855. #define C0_ITagHi $29,0
  1856. #define C0_DTagHi $29,2
  1857. #define M_TagHi0Fields 0x00000000
  1858. #define M_TagHiRFields 0x00000000
  1859. /*
  1860. ************************************************************************
  1861. * D A T A H I R E G I S T E R ( 2 9, SELECT 1 ) * DataHi
  1862. ************************************************************************
  1863. *
  1864. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  1865. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  1866. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1867. * | DataHi | DataHi
  1868. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1869. */
  1870. #define C0_DataHi $29,1
  1871. #define R_C0_DataHi 29
  1872. #define R_C0_SelDataHi 1
  1873. /*
  1874. * Some implementations use separate DataHi registers for the
  1875. * instruction and data caches. In those cases, the following
  1876. * definitions can be used in relevant code
  1877. */
  1878. #define C0_IDataHi $29,1
  1879. #define C0_DDataHi $29,3
  1880. #define M_DataHi0Fields 0x00000000
  1881. #define M_DataHiRFields 0xffffffff
  1882. /*
  1883. ************************************************************************
  1884. * E R R O R E P C R E G I S T E R ( 3 0 ) *
  1885. ************************************************************************
  1886. *
  1887. * 6 // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  1888. * 3 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  1889. * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1890. * | // Error PC | ErrorEPC
  1891. * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1892. */
  1893. #define C0_ErrorEPC $30
  1894. #define R_C0_ErrorEPC 30
  1895. #define R_C0_SelErrorEPC 0
  1896. #define C0_ERROR_EPC C0_ErrorEPC /* OBSOLETE - DO NOT USE IN NEW CODE */
  1897. /*
  1898. ************************************************************************
  1899. * D E S A V E R E G I S T E R ( 3 1 ) *
  1900. ************************************************************************
  1901. *
  1902. * 6 // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  1903. * 3 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  1904. * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1905. * | // EJTAG Register Save Value | DESAVE
  1906. * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1907. */
  1908. #define C0_DESAVE $31
  1909. #define R_C0_DESAVE 31
  1910. #define R_C0_SelDESAVE 0