Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

785 lines
21 KiB

  1. // TITLE("Wst Utility")
  2. //++
  3. // Copyright (c) 1992-1994, Microsoft Corporation.
  4. //
  5. // Description:
  6. // SaveAllRegs ()
  7. // - save all IA64 registers
  8. //
  9. // RestoreAllRegs ()
  10. // - restore all IA64 registers
  11. //
  12. //
  13. //--
  14. #include "ksia64.h"
  15. PublicFunction(c_penter)
  16. //--------------------------------------------------------------------
  17. // Routine:
  18. //
  19. // VOID
  20. // SaveAllRegs(
  21. // IN OUT PDWORDLONG pSaveBuffer)
  22. //
  23. // Description:
  24. //
  25. // This function saves the EM registers into the supplied buffer
  26. //
  27. // Input:
  28. //
  29. // a0: pSaveBuffer - Pointer CONTEXT buffer where the registers should be
  30. // saved.
  31. //
  32. // Output:
  33. //
  34. // Stores the registers in the supplied buffer.
  35. //
  36. // Return value:
  37. //
  38. // None
  39. //
  40. //
  41. //
  42. //--------------------------------------------------------------------
  43. LEAF_ENTRY(SaveAllRegs)
  44. //
  45. // Save all integer registers and flush the RSE
  46. //
  47. .prologue
  48. .regstk 1, 10, 0, 0
  49. rbsp = loc9
  50. rpfs = loc8
  51. rbrp = loc7
  52. rpr = loc6
  53. runat = loc4
  54. tmpbsp = t20
  55. alloc rpfs = ar.pfs, 1, 10, 0, 0
  56. add loc0 = CxIntGp, a0
  57. add loc1 = CxIntT8, a0
  58. ;;
  59. flushrs
  60. .save ar.unat, loc4
  61. mov runat = ar.unat
  62. mov rpr = pr
  63. PROLOGUE_END
  64. .mem.offset 0,0
  65. st8.spill.nta [loc0] = gp, CxIntT0 - CxIntGp
  66. .mem.offset 0,8
  67. st8.spill.nta [loc1] = t8, CxIntT9 - CxIntT8
  68. add loc2 = CxIntGp, a0
  69. ;;
  70. .mem.offset 0,0
  71. st8.spill.nta [loc0] = t0, CxIntT1 - CxIntT0
  72. .mem.offset 0,8
  73. st8.spill.nta [loc1] = t9, CxIntT10 - CxIntT9
  74. shr loc2 = loc2, 3
  75. ;;
  76. .mem.offset 0,0
  77. st8.spill.nta [loc0] = t1, CxIntS0 - CxIntT1
  78. .mem.offset 0,8
  79. st8.spill.nta [loc1] = t10, CxIntT11 - CxIntT10
  80. and t0 = 0x3f, loc2
  81. ;;
  82. .mem.offset 0,0
  83. st8.spill.nta [loc0] = s0, CxIntS1 - CxIntS0
  84. .mem.offset 0,8
  85. st8.spill.nta [loc1] = t11, CxIntT12 - CxIntT11
  86. cmp4.ge pt1, pt0 = 1, t0
  87. ;;
  88. .mem.offset 0,0
  89. st8.spill.nta [loc0] = s1, CxIntS2 - CxIntS1
  90. .mem.offset 0,8
  91. st8.spill.nta [loc1] = t12, CxIntT13 - CxIntT12
  92. (pt1) sub t1 = 1, t0
  93. ;;
  94. .mem.offset 0,0
  95. st8.spill.nta [loc0] = s2, CxIntS3 - CxIntS2
  96. .mem.offset 0,8
  97. st8.spill.nta [loc1] = t13, CxIntT14 - CxIntT13
  98. (pt0) add t1 = -1, t0
  99. ;;
  100. .mem.offset 0,0
  101. st8.spill.nta [loc0] = s3, CxIntV0 - CxIntS3
  102. .mem.offset 0,8
  103. st8.spill.nta [loc1] = t14, CxIntT15 - CxIntT14
  104. (pt0) sub t8 = 65, t0
  105. ;;
  106. .mem.offset 0,0
  107. st8.spill.nta [loc0] = v0, CxIntTeb - CxIntV0
  108. .mem.offset 0,8
  109. st8.spill.nta [loc1] = t15, CxIntT16 - CxIntT15
  110. nop.i 0
  111. ;;
  112. .mem.offset 0,0
  113. st8.spill.nta [loc0] = teb, CxIntT2 - CxIntTeb
  114. .mem.offset 0,8
  115. st8.spill.nta [loc1] = t16, CxIntT17 - CxIntT16
  116. mov rbrp = brp
  117. ;;
  118. .mem.offset 0,0
  119. st8.spill.nta [loc0] = t2, CxIntT3 - CxIntT2
  120. .mem.offset 0,8
  121. st8.spill.nta [loc1] = t17, CxIntT18 - CxIntT17
  122. mov t11 = bs0
  123. ;;
  124. .mem.offset 0,0
  125. st8.spill.nta [loc0] = t3, CxIntSp - CxIntT3
  126. .mem.offset 0,8
  127. st8.spill.nta [loc1] = t18, CxIntT19 - CxIntT18
  128. mov t12 = bs1
  129. ;;
  130. .mem.offset 0,0
  131. st8.spill.nta [loc0] = sp, CxIntT4 - CxIntSp
  132. .mem.offset 0,8
  133. st8.spill.nta [loc1] = t19, CxIntT20 - CxIntT19
  134. mov t13 = bs2
  135. ;;
  136. .mem.offset 0,0
  137. st8.spill.nta [loc0] = t4, CxIntT5 - CxIntT4
  138. .mem.offset 0,8
  139. st8.spill.nta [loc1] = t20, CxIntT21 - CxIntT20
  140. mov t14 = bs3
  141. ;;
  142. .mem.offset 0,0
  143. st8.spill.nta [loc0] = t5, CxIntT6 - CxIntT5
  144. .mem.offset 0,8
  145. st8.spill.nta [loc1] = t21, CxIntT22 - CxIntT21
  146. mov t15 = bs4
  147. ;;
  148. .mem.offset 0,0
  149. st8.spill.nta [loc0] = t6, CxIntT7 - CxIntT6
  150. .mem.offset 0,8
  151. st8.spill.nta [loc1] = t22, CxPreds - CxIntT22
  152. mov t16 = bt0
  153. ;;
  154. st8.spill.nta [loc0] = t7
  155. st8.nta [loc1] = rpr, CxIntNats - CxPreds // save predicates
  156. mov t17 = bt1
  157. ;;
  158. mov t9 = ar.unat
  159. mov t4 = ar.fpsr
  160. add loc2 = CxBrRp, a0
  161. ;;
  162. add loc3 = CxBrS3, a0
  163. (pt1) shl t9 = t9, t1
  164. (pt0) shr.u t2 = t9, t1
  165. ;;
  166. //
  167. // Save branch registers.
  168. //
  169. st8.nta [loc2] = rbrp, CxBrS0 - CxBrRp // save brp
  170. st8.nta [loc3] = t14, CxBrS4 - CxBrS3 // save bs3
  171. (pt0) shl t3 = t9, t8
  172. ;;
  173. st8.nta [loc2] = t11, CxBrS1 - CxBrS0 // save bs0
  174. st8.nta [loc3] = t15, CxBrT0 - CxBrS4 // save bs4
  175. (pt0) or t9 = t2, t3
  176. ;;
  177. st8.nta [loc2] = t12, CxBrS2 - CxBrS1 // save bs1
  178. st8.nta [loc3] = t16, CxBrT1 - CxBrT0 // save bt0
  179. add loc0 = CxStFPSR, a0
  180. ;;
  181. st8.nta [loc2] = t13 // save bs2
  182. st8.nta [loc3] = t17 // save bt1
  183. add loc2 = CxStFSR, a0
  184. ;;
  185. st8.nta [loc0] = t4 // save fpsr
  186. st8.nta [loc1] = t9 // save nat bits
  187. add loc1 = CxStFIR, a0
  188. ;;
  189. mov t0 = ar.fsr
  190. mov t1 = ar.fir
  191. mov t2 = ar.fdr
  192. ;;
  193. st8.nta [loc2] = t0, CxStFDR - CxStFSR
  194. st8.nta [loc1] = t1
  195. ;;
  196. st8.nta [loc2] = t2
  197. mov rbsp = ar.bsp
  198. add loc2 = CxFltS0, a0
  199. add loc3 = CxFltS1, a0
  200. ;;
  201. //
  202. // Save floating status and floating registers f0 - f127.
  203. //
  204. stf.spill.nta [loc2] = fs0, CxFltS2 - CxFltS0
  205. stf.spill.nta [loc3] = fs1, CxFltS3 - CxFltS1
  206. shr t0 = rpfs, 7
  207. ;;
  208. stf.spill.nta [loc2] = fs2, CxFltT0 - CxFltS2
  209. stf.spill.nta [loc3] = fs3, CxFltT1 - CxFltS3
  210. and t0 = 0x7f, t0
  211. ;;
  212. stf.spill.nta [loc2] = ft0, CxFltT2 - CxFltT0
  213. stf.spill.nta [loc3] = ft1, CxFltT3 - CxFltT1
  214. shr t1 = rbsp, 3
  215. ;;
  216. stf.spill.nta [loc2] = ft2, CxFltT4 - CxFltT2
  217. stf.spill.nta [loc3] = ft3, CxFltT5 - CxFltT3
  218. and t1 = 0x3f, t1
  219. ;;
  220. stf.spill.nta [loc2] = ft4, CxFltT6 - CxFltT4
  221. stf.spill.nta [loc3] = ft5, CxFltT7 - CxFltT5
  222. sub t2 = t0, t1
  223. ;;
  224. stf.spill.nta [loc2] = ft6, CxFltT8 - CxFltT6
  225. stf.spill.nta [loc3] = ft7, CxFltT9 - CxFltT7
  226. cmp4.le pt1, pt0 = t2, zero
  227. ;;
  228. stf.spill.nta [loc2] = ft8, CxFltS4 - CxFltT8
  229. stf.spill.nta [loc3] = ft9, CxFltS5 - CxFltT9
  230. (pt0) add t2 = -1, t2
  231. ;;
  232. stf.spill.nta [loc2] = fs4, CxFltS6 - CxFltS4
  233. stf.spill.nta [loc3] = fs5, CxFltS7 - CxFltS5
  234. (pt0) add t0 = 1, t0
  235. ;;
  236. stf.spill.nta [loc2] = fs6, CxFltS8 - CxFltS6
  237. stf.spill.nta [loc3] = fs7, CxFltS9 - CxFltS7
  238. (pt0) add t2 = -63, t2
  239. ;;
  240. stf.spill.nta [loc2] = fs8, CxFltS10 - CxFltS8
  241. stf.spill.nta [loc3] = fs9, CxFltS11 - CxFltS9
  242. (pt0) cmp4.ge.unc pt2, pt3 = t2, zero
  243. ;;
  244. stf.spill.nta [loc2] = fs10, CxFltS12 - CxFltS10
  245. stf.spill.nta [loc3] = fs11, CxFltS13 - CxFltS11
  246. (pt1) br.cond.spnt Rcc20
  247. ;;
  248. Rcc10:
  249. (pt2) add t0 = 1, t0
  250. (pt2) add t2 = -63, t2
  251. (pt3) br.cond.sptk Rcc20
  252. ;;
  253. cmp4.ge pt2, pt3 = t2, zero
  254. nop.m 0
  255. br Rcc10
  256. Rcc20:
  257. stf.spill.nta [loc2] = fs12, CxFltS14 - CxFltS12
  258. stf.spill.nta [loc3] = fs13, CxFltS15 - CxFltS13
  259. add tmpbsp = -8, rbsp
  260. ;;
  261. stf.spill.nta [loc2] = fs14, CxFltS16 - CxFltS14
  262. stf.spill.nta [loc3] = fs15, CxFltS17 - CxFltS15
  263. shl t0 = t0, 3
  264. ;;
  265. stf.spill.nta [loc2] = fs16, CxFltS18 - CxFltS16
  266. stf.spill.nta [loc3] = fs17, CxFltS19 - CxFltS17
  267. sub rbsp = rbsp, t0
  268. ;;
  269. stf.spill.nta [loc2] = fs18, CxFltF32 - CxFltS18
  270. stf.spill.nta [loc3] = fs19, CxFltF33 - CxFltS19
  271. nop.i 0
  272. ;;
  273. //
  274. // Save application registers, control information and set context flags.
  275. //
  276. User=pt0
  277. Krnl=pt1
  278. rdcr=t1
  279. mask=t2
  280. sol=t4
  281. rpsr=t5
  282. is=t6
  283. rccv=t7
  284. rlc=t8
  285. rec=t9
  286. rrsc=t10
  287. rrnat=t11
  288. flag=t16
  289. addr0=t17
  290. addr1=t18
  291. tmp=t19
  292. mov rrsc = ar.rsc
  293. tbit.nz Krnl, User = sp, 62 // bit 62 is 1 when
  294. mov rlc = ar.lc
  295. ;;
  296. mov ar.rsc = zero // put RSE in lazy mode
  297. mov rccv = ar.ccv
  298. mov rec = ar.ec
  299. ;; // in kernel
  300. (Krnl) mov rpsr = psr
  301. (User) mov rpsr = psr.um
  302. add addr0 = CxApUNAT, a0
  303. mov rrnat = ar.rnat
  304. add addr1 = CxApLC, a0
  305. (Krnl) mov rdcr = cr.dcr
  306. (Krnl) movl tmp = 1 << PSR_BN
  307. ;;
  308. st8.nta [addr0] = runat, CxApEC - CxApUNAT
  309. st8.nta [addr1] = rlc, CxApCCV - CxApLC
  310. (Krnl) or rpsr = tmp, rpsr
  311. ;;
  312. st8.nta [addr0] = rec, CxApDCR - CxApEC
  313. st8.nta [addr1] = rccv, CxRsPFS - CxApCCV
  314. mov tmp = 1
  315. ;;
  316. st8.nta [addr0] = rdcr, CxRsBSP - CxApDCR
  317. st8.nta [addr1] = rpfs, CxRsBSPSTORE - CxRsPFS
  318. shl tmp = tmp, 63
  319. ;;
  320. st8.nta [addr0] = rbsp, CxRsRSC - CxRsBSP
  321. st8.nta [addr1] = rbsp, CxRsRNAT - CxRsBSPSTORE
  322. or rpfs = rpfs, tmp // validate IFS
  323. ;;
  324. st8.nta [addr0] = rrsc, CxStIIP - CxRsRSC
  325. st8.nta [addr1] = rrnat, CxStIFS - CxRsRNAT
  326. mov mask = RNAT_ALIGNMENT
  327. ;;
  328. st8.nta [addr0] = rbrp, CxStIPSR - CxStIIP
  329. add tmp = CxContextFlags, a0
  330. mov flag = CONTEXT_FULL // full context saved.
  331. ;;
  332. st8.nta [addr0] = rpsr // save psr
  333. st8.nta [addr1] = rpfs
  334. or tmpbsp = tmpbsp, mask
  335. ;;
  336. mov ar.rsc = rrsc // restore RSC
  337. st4.nta [tmp] = flag
  338. mov ar.unat = runat // restore ar.unat
  339. st8.nta [tmpbsp] = rrnat
  340. (p0) br.ret.sptk brp // return to caller.
  341. LEAF_EXIT(SaveAllRegs)
  342. //++
  343. //
  344. // VOID
  345. // RestoreAllRegs (
  346. // IN PCONTEXT ContextRecord,
  347. // )
  348. //
  349. // Routine Description:
  350. //
  351. // This function restores the registers of the caller from the specified
  352. // context.
  353. //
  354. // N.B. The context record is assumed to be 16-byte aligned.
  355. //
  356. // Arguments:
  357. //
  358. // ContextRecord (a0) - Supplies the address of a context record.
  359. //
  360. // Return Value:
  361. //
  362. // None.
  363. //
  364. //--
  365. LEAF_ENTRY(RestoreAllRegs)
  366. dest1=t8
  367. dest2=t9
  368. rlc=t10
  369. rpreds=t11
  370. rbrp=t12
  371. rbsp=t13
  372. rpfs=t14
  373. runat=t15
  374. rpreds=t16
  375. rsp=t17
  376. rfpsr=t18
  377. jb=t19
  378. tmp=t20
  379. src1=t21
  380. src2=t22
  381. .regstk 2, 9, 2, 0
  382. alloc t4 = ar.pfs, 2, 11, 2, 0
  383. ARGPTR(a0)
  384. add src1 = CxIntNats, a0
  385. add src2 = CxPreds, a0
  386. add tmp = CxIntGp, a0
  387. ;;
  388. ld8.nt1 t17 = [src1], CxBrRp - CxIntNats
  389. ld8.nt1 t16 = [src2], CxBrS0 - CxPreds
  390. shr tmp = tmp, 3
  391. ;;
  392. ld8.nt1 t0 = [src1], CxBrS1 - CxBrRp
  393. ld8.nt1 t1 = [src2], CxBrS2 - CxBrS0
  394. and tmp = 0x3f, tmp
  395. ;;
  396. ld8.nt1 t2 = [src1], CxBrS3 - CxBrS1
  397. ld8.nt1 t3 = [src2], CxBrS4 - CxBrS2
  398. cmp4.ge pt1, pt0 = 1, tmp
  399. ;;
  400. ld8.nt1 t4 = [src1], CxBrT0 - CxBrS3
  401. ld8.nt1 t5 = [src2], CxBrT1 - CxBrS4
  402. (pt1) sub loc5 = 1, tmp
  403. ;;
  404. ld8.nt1 t6 = [src1], CxApUNAT - CxBrT0
  405. ld8.nt1 t7 = [src2], CxApLC - CxBrT1
  406. (pt0) add loc5 = -1, tmp
  407. ;;
  408. ld8.nt1 loc0 = [src1], CxApEC - CxApUNAT
  409. ld8.nt1 t8 = [src2], CxApCCV - CxApLC
  410. (pt0) sub loc6 = 65, tmp
  411. ;;
  412. ld8.nt1 t9 = [src1], CxApDCR - CxApEC
  413. ld8.nt1 t10 = [src2], CxRsPFS - CxApCCV
  414. (pt1) shr.u t17 = t17, loc5
  415. ;;
  416. ld8.nt1 loc1 = [src1], CxRsBSP - CxApDCR
  417. ld8.nt1 t11 = [src2], CxRsRSC - CxRsPFS
  418. (pt0) shl loc7 = t17, loc5
  419. ;;
  420. ld8.nt1 loc2 = [src1], CxStIIP - CxRsBSP
  421. ld8.nt1 loc3 = [src2], CxStIFS - CxRsRSC
  422. (pt0) shr.u loc8 = t17, loc6
  423. ;;
  424. ld8.nt1 loc9 = [src1]
  425. ld8.nt1 loc10 = [src2]
  426. (pt0) or t17 = loc7, loc8
  427. ;;
  428. mov ar.unat = t17
  429. add src1 = CxFltS0, a0
  430. shr t12 = loc2, 3
  431. ;;
  432. add src2 = CxFltS1, a0
  433. and t12 = 0x3f, t12 // current rnat save index
  434. and t13 = 0x7f, loc10 // total frame size
  435. ;;
  436. mov ar.ccv = t10
  437. add t14 = t13, t12
  438. mov ar.pfs = t11
  439. ;;
  440. Rrc20:
  441. cmp4.gt pt1, pt0 = 63, t14
  442. ;;
  443. (pt0) add t14 = -63, t14
  444. (pt0) add t13 = 1, t13
  445. ;;
  446. nop.m 0
  447. (pt1) shl t13 = t13, 3
  448. (pt0) br.cond.spnt Rrc20
  449. ;;
  450. add loc2 = loc2, t13
  451. nop.f 0
  452. mov pr = t16, -1
  453. ldf.fill.nt1 fs0 = [src1], CxFltS2 - CxFltS0
  454. ldf.fill.nt1 fs1 = [src2], CxFltS3 - CxFltS1
  455. mov brp = t0
  456. ;;
  457. ldf.fill.nt1 fs2 = [src1], CxFltT0 - CxFltS2
  458. ldf.fill.nt1 fs3 = [src2], CxFltT1 - CxFltS3
  459. mov bs0 = t1
  460. ;;
  461. ldf.fill.nt1 ft0 = [src1], CxFltT2 - CxFltT0
  462. ldf.fill.nt1 ft1 = [src2], CxFltT3 - CxFltT1
  463. mov bs1 = t2
  464. ;;
  465. ldf.fill.nt1 ft2 = [src1], CxFltT4 - CxFltT2
  466. ldf.fill.nt1 ft3 = [src2], CxFltT5 - CxFltT3
  467. mov bs2 = t3
  468. ;;
  469. ldf.fill.nt1 ft4 = [src1], CxFltT6 - CxFltT4
  470. ldf.fill.nt1 ft5 = [src2], CxFltT7 - CxFltT5
  471. mov bs3 = t4
  472. ;;
  473. ldf.fill.nt1 ft6 = [src1], CxFltT8 - CxFltT6
  474. ldf.fill.nt1 ft7 = [src2], CxFltT9 - CxFltT7
  475. mov bs4 = t5
  476. ;;
  477. ldf.fill.nt1 ft8 = [src1], CxFltS4 - CxFltT8
  478. ldf.fill.nt1 ft9 = [src2], CxFltS5 - CxFltT9
  479. mov bt0 = t6
  480. ;;
  481. ldf.fill.nt1 fs4 = [src1], CxFltS6 - CxFltS4
  482. ldf.fill.nt1 fs5 = [src2], CxFltS7 - CxFltS5
  483. mov bt1 = t7
  484. ;;
  485. ldf.fill.nt1 fs6 = [src1], CxFltS8 - CxFltS6
  486. ldf.fill.nt1 fs7 = [src2], CxFltS9 - CxFltS7
  487. mov ar.lc = t8
  488. ;;
  489. ldf.fill.nt1 fs8 = [src1], CxFltS10 - CxFltS8
  490. ldf.fill.nt1 fs9 = [src2], CxFltS11 - CxFltS9
  491. mov ar.ec = t9
  492. ;;
  493. ldf.fill.nt1 fs10 = [src1], CxFltS12 - CxFltS10
  494. ldf.fill.nt1 fs11 = [src2], CxFltS13 - CxFltS11
  495. nop.i 0
  496. ;;
  497. ldf.fill.nt1 fs12 = [src1], CxFltS14 - CxFltS12
  498. ldf.fill.nt1 fs13 = [src2], CxFltS15 - CxFltS13
  499. add loc6 = CxIntGp, a0
  500. ;;
  501. ldf.fill.nt1 fs14 = [src1], CxFltS16 - CxFltS14
  502. ldf.fill.nt1 fs15 = [src2], CxFltS17 - CxFltS15
  503. add loc7 = CxIntT0, a0
  504. ;;
  505. ldf.fill.nt1 fs16 = [src1], CxFltS18 - CxFltS16
  506. ldf.fill.nt1 fs17 = [src2], CxFltS19 - CxFltS17
  507. add t19 = CxRsRNAT, a0
  508. ;;
  509. ldf.fill.nt1 fs18 = [src1]
  510. ldf.fill.nt1 fs19 = [src2]
  511. add t7 = CxStFPSR, a0
  512. ;;
  513. ld8.nt1 loc8 = [t7] // load fpsr from context
  514. ld8.nt1 loc5 = [t19] // load rnat from context
  515. nop.i 0
  516. ld8.fill.nt1 gp = [loc6], CxIntT1 - CxIntGp
  517. ld8.fill.nt1 t0 = [loc7], CxIntS0 - CxIntT0
  518. ;;
  519. ld8.fill.nt1 t1 = [loc6], CxIntS1 - CxIntT1
  520. ld8.fill.nt1 s0 = [loc7], CxIntS2 - CxIntS0
  521. ;;
  522. ld8.fill.nt1 s1 = [loc6], CxIntS3 - CxIntS1
  523. ld8.fill.nt1 s2 = [loc7], CxIntV0 - CxIntS2
  524. ;;
  525. ld8.fill.nt1 s3 = [loc6], CxIntTeb - CxIntS3
  526. ld8.fill.nt1 v0 = [loc7], CxIntT2 - CxIntV0
  527. ;;
  528. ld8.fill.nt1 teb = [loc6], CxIntT3 - CxIntTeb
  529. ld8.fill.nt1 t2 = [loc7], CxIntSp - CxIntT2
  530. ;;
  531. ld8.fill.nt1 t3 = [loc6], CxIntT4 - CxIntT3
  532. ld8.fill.nt1 loc4 = [loc7], CxIntT5 - CxIntSp
  533. ;;
  534. ld8.fill.nt1 t4 = [loc6], CxIntT6 - CxIntT4
  535. ld8.fill.nt1 t5 = [loc7], CxIntT7 - CxIntT5
  536. ;;
  537. ld8.fill.nt1 t6 = [loc6], CxIntT8 - CxIntT6
  538. ld8.fill.nt1 t7 = [loc7], CxIntT9 - CxIntT7
  539. ;;
  540. ld8.fill.nt1 t8 = [loc6], CxIntT10 - CxIntT8
  541. ld8.fill.nt1 t9 = [loc7], CxIntT11 - CxIntT9
  542. ;;
  543. ld8.fill.nt1 t10 = [loc6], CxIntT12 - CxIntT10
  544. ld8.fill.nt1 t11 = [loc7], CxIntT13 - CxIntT11
  545. ;;
  546. ld8.fill.nt1 t12 = [loc6], CxIntT14 - CxIntT12
  547. ld8.fill.nt1 t13 = [loc7], CxIntT15 - CxIntT13
  548. ;;
  549. ld8.fill.nt1 t14 = [loc6], CxIntT16 - CxIntT14
  550. ld8.fill.nt1 t15 = [loc7], CxIntT17 - CxIntT15
  551. ;;
  552. ld8.fill.nt1 t16 = [loc6], CxIntT18 - CxIntT16
  553. ld8.fill.nt1 t17 = [loc7], CxIntT19 - CxIntT17
  554. ;;
  555. ld8.fill.nt1 t18 = [loc6], CxIntT20 - CxIntT18
  556. ld8.fill.nt1 t19 = [loc7], CxIntT21 - CxIntT19
  557. ;;
  558. ld8.fill.nt1 t20 = [loc6], CxIntT22 - CxIntT20
  559. ld8.fill.nt1 t21 = [loc7]
  560. ;;
  561. rsm 1 << PSR_I
  562. ld8.fill.nt1 t22 = [loc6]
  563. ;;
  564. rsm 1 << PSR_IC
  565. movl t0 = 1 << IFS_V
  566. ;;
  567. mov ar.fpsr = loc8 // set fpsr
  568. mov ar.unat = loc0
  569. ;;
  570. srlz.d
  571. or loc10 = t0, loc10 // set ifs valid bit
  572. ;;
  573. mov cr.iip = loc9
  574. mov cr.ifs = loc10
  575. bsw.0
  576. ;;
  577. mov cr.dcr = loc1
  578. mov r17 = loc2 // put BSP in a shadow reg
  579. or r16 = 0x3, loc3 // put RSE in eager mode
  580. mov ar.rsc = r0 // put RSE in enforced lazy
  581. nop.m 0
  582. add r20 = CxStIPSR, a0
  583. ;;
  584. ld8.nt1 r20 = [r20] // load IPSR
  585. mov r18 = loc4 // put SP in a shadow reg
  586. mov r19 = loc5 // put RNaTs in a shadow reg
  587. ;;
  588. alloc t0 = 0, 0, 0, 0
  589. mov cr.ipsr = r20
  590. mov sp = r18
  591. ;;
  592. loadrs
  593. ;;
  594. mov ar.bspstore = r17
  595. nop.i 0
  596. ;;
  597. mov ar.rnat = r19 // set rnat register
  598. mov ar.rsc = r16 // restore RSC
  599. bsw.1
  600. ;;
  601. LEAF_EXIT(RestoreAllRegs)
  602. //--------------------------------------------------------------------
  603. // Routine:
  604. //
  605. // VOID
  606. // penter(
  607. // VOID)
  608. //
  609. // Description:
  610. //
  611. // This function loads the return address and current address in to two
  612. // parameter registers, then calls the C version (c_penter)
  613. //
  614. // Input:
  615. //
  616. // None
  617. //
  618. // Output:
  619. //
  620. // None
  621. //
  622. // Return value:
  623. //
  624. // None
  625. //
  626. //
  627. //
  628. //--------------------------------------------------------------------
  629. LEAF_ENTRY(penter)
  630. .regstk 0, 1, 2, 0
  631. //
  632. // This to be filled in when the compiler implements /Gh switch
  633. //
  634. br.call.sptk brp = c_penter
  635. LEAF_EXIT(penter)