head.S 28 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Here is where the ball gets rolling as far as the kernel is concerned.
  4. * When control is transferred to _start, the bootload has already
  5. * loaded us to the correct address. All that's left to do here is
  6. * to set up the kernel's global pointer and jump to the kernel
  7. * entry point.
  8. *
  9. * Copyright (C) 1998-2001, 2003, 2005 Hewlett-Packard Co
  10. * David Mosberger-Tang <davidm@hpl.hp.com>
  11. * Stephane Eranian <eranian@hpl.hp.com>
  12. * Copyright (C) 1999 VA Linux Systems
  13. * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
  14. * Copyright (C) 1999 Intel Corp.
  15. * Copyright (C) 1999 Asit Mallick <Asit.K.Mallick@intel.com>
  16. * Copyright (C) 1999 Don Dugger <Don.Dugger@intel.com>
  17. * Copyright (C) 2002 Fenghua Yu <fenghua.yu@intel.com>
  18. * -Optimize __ia64_save_fpu() and __ia64_load_fpu() for Itanium 2.
  19. * Copyright (C) 2004 Ashok Raj <ashok.raj@intel.com>
  20. * Support for CPU Hotplug
  21. */
  22. #include <asm/asmmacro.h>
  23. #include <asm/fpu.h>
  24. #include <asm/kregs.h>
  25. #include <asm/mmu_context.h>
  26. #include <asm/asm-offsets.h>
  27. #include <asm/pal.h>
  28. #include <asm/pgtable.h>
  29. #include <asm/processor.h>
  30. #include <asm/ptrace.h>
  31. #include <asm/mca_asm.h>
  32. #include <linux/init.h>
  33. #include <linux/linkage.h>
  34. #include <asm/export.h>
  35. #ifdef CONFIG_HOTPLUG_CPU
  36. #define SAL_PSR_BITS_TO_SET \
  37. (IA64_PSR_AC | IA64_PSR_BN | IA64_PSR_MFH | IA64_PSR_MFL)
  38. #define SAVE_FROM_REG(src, ptr, dest) \
  39. mov dest=src;; \
  40. st8 [ptr]=dest,0x08
  41. #define RESTORE_REG(reg, ptr, _tmp) \
  42. ld8 _tmp=[ptr],0x08;; \
  43. mov reg=_tmp
  44. #define SAVE_BREAK_REGS(ptr, _idx, _breg, _dest)\
  45. mov ar.lc=IA64_NUM_DBG_REGS-1;; \
  46. mov _idx=0;; \
  47. 1: \
  48. SAVE_FROM_REG(_breg[_idx], ptr, _dest);; \
  49. add _idx=1,_idx;; \
  50. br.cloop.sptk.many 1b
  51. #define RESTORE_BREAK_REGS(ptr, _idx, _breg, _tmp, _lbl)\
  52. mov ar.lc=IA64_NUM_DBG_REGS-1;; \
  53. mov _idx=0;; \
  54. _lbl: RESTORE_REG(_breg[_idx], ptr, _tmp);; \
  55. add _idx=1, _idx;; \
  56. br.cloop.sptk.many _lbl
  57. #define SAVE_ONE_RR(num, _reg, _tmp) \
  58. movl _tmp=(num<<61);; \
  59. mov _reg=rr[_tmp]
  60. #define SAVE_REGION_REGS(_tmp, _r0, _r1, _r2, _r3, _r4, _r5, _r6, _r7) \
  61. SAVE_ONE_RR(0,_r0, _tmp);; \
  62. SAVE_ONE_RR(1,_r1, _tmp);; \
  63. SAVE_ONE_RR(2,_r2, _tmp);; \
  64. SAVE_ONE_RR(3,_r3, _tmp);; \
  65. SAVE_ONE_RR(4,_r4, _tmp);; \
  66. SAVE_ONE_RR(5,_r5, _tmp);; \
  67. SAVE_ONE_RR(6,_r6, _tmp);; \
  68. SAVE_ONE_RR(7,_r7, _tmp);;
  69. #define STORE_REGION_REGS(ptr, _r0, _r1, _r2, _r3, _r4, _r5, _r6, _r7) \
  70. st8 [ptr]=_r0, 8;; \
  71. st8 [ptr]=_r1, 8;; \
  72. st8 [ptr]=_r2, 8;; \
  73. st8 [ptr]=_r3, 8;; \
  74. st8 [ptr]=_r4, 8;; \
  75. st8 [ptr]=_r5, 8;; \
  76. st8 [ptr]=_r6, 8;; \
  77. st8 [ptr]=_r7, 8;;
  78. #define RESTORE_REGION_REGS(ptr, _idx1, _idx2, _tmp) \
  79. mov ar.lc=0x08-1;; \
  80. movl _idx1=0x00;; \
  81. RestRR: \
  82. dep.z _idx2=_idx1,61,3;; \
  83. ld8 _tmp=[ptr],8;; \
  84. mov rr[_idx2]=_tmp;; \
  85. srlz.d;; \
  86. add _idx1=1,_idx1;; \
  87. br.cloop.sptk.few RestRR
  88. #define SET_AREA_FOR_BOOTING_CPU(reg1, reg2) \
  89. movl reg1=sal_state_for_booting_cpu;; \
  90. ld8 reg2=[reg1];;
  91. /*
  92. * Adjust region registers saved before starting to save
  93. * break regs and rest of the states that need to be preserved.
  94. */
  95. #define SAL_TO_OS_BOOT_HANDOFF_STATE_SAVE(_reg1,_reg2,_pred) \
  96. SAVE_FROM_REG(b0,_reg1,_reg2);; \
  97. SAVE_FROM_REG(b1,_reg1,_reg2);; \
  98. SAVE_FROM_REG(b2,_reg1,_reg2);; \
  99. SAVE_FROM_REG(b3,_reg1,_reg2);; \
  100. SAVE_FROM_REG(b4,_reg1,_reg2);; \
  101. SAVE_FROM_REG(b5,_reg1,_reg2);; \
  102. st8 [_reg1]=r1,0x08;; \
  103. st8 [_reg1]=r12,0x08;; \
  104. st8 [_reg1]=r13,0x08;; \
  105. SAVE_FROM_REG(ar.fpsr,_reg1,_reg2);; \
  106. SAVE_FROM_REG(ar.pfs,_reg1,_reg2);; \
  107. SAVE_FROM_REG(ar.rnat,_reg1,_reg2);; \
  108. SAVE_FROM_REG(ar.unat,_reg1,_reg2);; \
  109. SAVE_FROM_REG(ar.bspstore,_reg1,_reg2);; \
  110. SAVE_FROM_REG(cr.dcr,_reg1,_reg2);; \
  111. SAVE_FROM_REG(cr.iva,_reg1,_reg2);; \
  112. SAVE_FROM_REG(cr.pta,_reg1,_reg2);; \
  113. SAVE_FROM_REG(cr.itv,_reg1,_reg2);; \
  114. SAVE_FROM_REG(cr.pmv,_reg1,_reg2);; \
  115. SAVE_FROM_REG(cr.cmcv,_reg1,_reg2);; \
  116. SAVE_FROM_REG(cr.lrr0,_reg1,_reg2);; \
  117. SAVE_FROM_REG(cr.lrr1,_reg1,_reg2);; \
  118. st8 [_reg1]=r4,0x08;; \
  119. st8 [_reg1]=r5,0x08;; \
  120. st8 [_reg1]=r6,0x08;; \
  121. st8 [_reg1]=r7,0x08;; \
  122. st8 [_reg1]=_pred,0x08;; \
  123. SAVE_FROM_REG(ar.lc, _reg1, _reg2);; \
  124. stf.spill.nta [_reg1]=f2,16;; \
  125. stf.spill.nta [_reg1]=f3,16;; \
  126. stf.spill.nta [_reg1]=f4,16;; \
  127. stf.spill.nta [_reg1]=f5,16;; \
  128. stf.spill.nta [_reg1]=f16,16;; \
  129. stf.spill.nta [_reg1]=f17,16;; \
  130. stf.spill.nta [_reg1]=f18,16;; \
  131. stf.spill.nta [_reg1]=f19,16;; \
  132. stf.spill.nta [_reg1]=f20,16;; \
  133. stf.spill.nta [_reg1]=f21,16;; \
  134. stf.spill.nta [_reg1]=f22,16;; \
  135. stf.spill.nta [_reg1]=f23,16;; \
  136. stf.spill.nta [_reg1]=f24,16;; \
  137. stf.spill.nta [_reg1]=f25,16;; \
  138. stf.spill.nta [_reg1]=f26,16;; \
  139. stf.spill.nta [_reg1]=f27,16;; \
  140. stf.spill.nta [_reg1]=f28,16;; \
  141. stf.spill.nta [_reg1]=f29,16;; \
  142. stf.spill.nta [_reg1]=f30,16;; \
  143. stf.spill.nta [_reg1]=f31,16;;
  144. #else
  145. #define SET_AREA_FOR_BOOTING_CPU(a1, a2)
  146. #define SAL_TO_OS_BOOT_HANDOFF_STATE_SAVE(a1,a2, a3)
  147. #define SAVE_REGION_REGS(_tmp, _r0, _r1, _r2, _r3, _r4, _r5, _r6, _r7)
  148. #define STORE_REGION_REGS(ptr, _r0, _r1, _r2, _r3, _r4, _r5, _r6, _r7)
  149. #endif
  150. #define SET_ONE_RR(num, pgsize, _tmp1, _tmp2, vhpt) \
  151. movl _tmp1=(num << 61);; \
  152. mov _tmp2=((ia64_rid(IA64_REGION_ID_KERNEL, (num<<61)) << 8) | (pgsize << 2) | vhpt);; \
  153. mov rr[_tmp1]=_tmp2
  154. __PAGE_ALIGNED_DATA
  155. .global empty_zero_page
  156. EXPORT_DATA_SYMBOL_GPL(empty_zero_page)
  157. empty_zero_page:
  158. .skip PAGE_SIZE
  159. .global swapper_pg_dir
  160. swapper_pg_dir:
  161. .skip PAGE_SIZE
  162. .rodata
  163. halt_msg:
  164. stringz "Halting kernel\n"
  165. __REF
  166. .global start_ap
  167. /*
  168. * Start the kernel. When the bootloader passes control to _start(), r28
  169. * points to the address of the boot parameter area. Execution reaches
  170. * here in physical mode.
  171. */
  172. GLOBAL_ENTRY(_start)
  173. start_ap:
  174. .prologue
  175. .save rp, r0 // terminate unwind chain with a NULL rp
  176. .body
  177. rsm psr.i | psr.ic
  178. ;;
  179. srlz.i
  180. ;;
  181. {
  182. flushrs // must be first insn in group
  183. srlz.i
  184. }
  185. ;;
  186. /*
  187. * Save the region registers, predicate before they get clobbered
  188. */
  189. SAVE_REGION_REGS(r2, r8,r9,r10,r11,r12,r13,r14,r15);
  190. mov r25=pr;;
  191. /*
  192. * Initialize kernel region registers:
  193. * rr[0]: VHPT enabled, page size = PAGE_SHIFT
  194. * rr[1]: VHPT enabled, page size = PAGE_SHIFT
  195. * rr[2]: VHPT enabled, page size = PAGE_SHIFT
  196. * rr[3]: VHPT enabled, page size = PAGE_SHIFT
  197. * rr[4]: VHPT enabled, page size = PAGE_SHIFT
  198. * rr[5]: VHPT enabled, page size = PAGE_SHIFT
  199. * rr[6]: VHPT disabled, page size = IA64_GRANULE_SHIFT
  200. * rr[7]: VHPT disabled, page size = IA64_GRANULE_SHIFT
  201. * We initialize all of them to prevent inadvertently assuming
  202. * something about the state of address translation early in boot.
  203. */
  204. SET_ONE_RR(0, PAGE_SHIFT, r2, r16, 1);;
  205. SET_ONE_RR(1, PAGE_SHIFT, r2, r16, 1);;
  206. SET_ONE_RR(2, PAGE_SHIFT, r2, r16, 1);;
  207. SET_ONE_RR(3, PAGE_SHIFT, r2, r16, 1);;
  208. SET_ONE_RR(4, PAGE_SHIFT, r2, r16, 1);;
  209. SET_ONE_RR(5, PAGE_SHIFT, r2, r16, 1);;
  210. SET_ONE_RR(6, IA64_GRANULE_SHIFT, r2, r16, 0);;
  211. SET_ONE_RR(7, IA64_GRANULE_SHIFT, r2, r16, 0);;
  212. /*
  213. * Now pin mappings into the TLB for kernel text and data
  214. */
  215. mov r18=KERNEL_TR_PAGE_SHIFT<<2
  216. movl r17=KERNEL_START
  217. ;;
  218. mov cr.itir=r18
  219. mov cr.ifa=r17
  220. mov r16=IA64_TR_KERNEL
  221. mov r3=ip
  222. movl r18=PAGE_KERNEL
  223. ;;
  224. dep r2=0,r3,0,KERNEL_TR_PAGE_SHIFT
  225. ;;
  226. or r18=r2,r18
  227. ;;
  228. srlz.i
  229. ;;
  230. itr.i itr[r16]=r18
  231. ;;
  232. itr.d dtr[r16]=r18
  233. ;;
  234. srlz.i
  235. /*
  236. * Switch into virtual mode:
  237. */
  238. movl r16=(IA64_PSR_IT|IA64_PSR_IC|IA64_PSR_DT|IA64_PSR_RT|IA64_PSR_DFH|IA64_PSR_BN \
  239. |IA64_PSR_DI)
  240. ;;
  241. mov cr.ipsr=r16
  242. movl r17=1f
  243. ;;
  244. mov cr.iip=r17
  245. mov cr.ifs=r0
  246. ;;
  247. rfi
  248. ;;
  249. 1: // now we are in virtual mode
  250. SET_AREA_FOR_BOOTING_CPU(r2, r16);
  251. STORE_REGION_REGS(r16, r8,r9,r10,r11,r12,r13,r14,r15);
  252. SAL_TO_OS_BOOT_HANDOFF_STATE_SAVE(r16,r17,r25)
  253. ;;
  254. // set IVT entry point---can't access I/O ports without it
  255. movl r3=ia64_ivt
  256. ;;
  257. mov cr.iva=r3
  258. movl r2=FPSR_DEFAULT
  259. ;;
  260. srlz.i
  261. movl gp=__gp
  262. mov ar.fpsr=r2
  263. ;;
  264. #define isAP p2 // are we an Application Processor?
  265. #define isBP p3 // are we the Bootstrap Processor?
  266. #ifdef CONFIG_SMP
  267. /*
  268. * Find the init_task for the currently booting CPU. At poweron, and in
  269. * UP mode, task_for_booting_cpu is NULL.
  270. */
  271. movl r3=task_for_booting_cpu
  272. ;;
  273. ld8 r3=[r3]
  274. movl r2=init_task
  275. ;;
  276. cmp.eq isBP,isAP=r3,r0
  277. ;;
  278. (isAP) mov r2=r3
  279. #else
  280. movl r2=init_task
  281. cmp.eq isBP,isAP=r0,r0
  282. #endif
  283. ;;
  284. tpa r3=r2 // r3 == phys addr of task struct
  285. mov r16=-1
  286. (isBP) br.cond.dpnt .load_current // BP stack is on region 5 --- no need to map it
  287. // load mapping for stack (virtaddr in r2, physaddr in r3)
  288. rsm psr.ic
  289. movl r17=PAGE_KERNEL
  290. ;;
  291. srlz.d
  292. dep r18=0,r3,0,12
  293. ;;
  294. or r18=r17,r18
  295. dep r2=-1,r3,61,3 // IMVA of task
  296. ;;
  297. mov r17=rr[r2]
  298. shr.u r16=r3,IA64_GRANULE_SHIFT
  299. ;;
  300. dep r17=0,r17,8,24
  301. ;;
  302. mov cr.itir=r17
  303. mov cr.ifa=r2
  304. mov r19=IA64_TR_CURRENT_STACK
  305. ;;
  306. itr.d dtr[r19]=r18
  307. ;;
  308. ssm psr.ic
  309. srlz.d
  310. ;;
  311. .load_current:
  312. // load the "current" pointer (r13) and ar.k6 with the current task
  313. mov IA64_KR(CURRENT)=r2 // virtual address
  314. mov IA64_KR(CURRENT_STACK)=r16
  315. mov r13=r2
  316. /*
  317. * Reserve space at the top of the stack for "struct pt_regs". Kernel
  318. * threads don't store interesting values in that structure, but the space
  319. * still needs to be there because time-critical stuff such as the context
  320. * switching can be implemented more efficiently (for example, __switch_to()
  321. * always sets the psr.dfh bit of the task it is switching to).
  322. */
  323. addl r12=IA64_STK_OFFSET-IA64_PT_REGS_SIZE-16,r2
  324. addl r2=IA64_RBS_OFFSET,r2 // initialize the RSE
  325. mov ar.rsc=0 // place RSE in enforced lazy mode
  326. ;;
  327. loadrs // clear the dirty partition
  328. movl r19=__phys_per_cpu_start
  329. mov r18=PERCPU_PAGE_SIZE
  330. ;;
  331. #ifndef CONFIG_SMP
  332. add r19=r19,r18
  333. ;;
  334. #else
  335. (isAP) br.few 2f
  336. movl r20=__cpu0_per_cpu
  337. ;;
  338. shr.u r18=r18,3
  339. 1:
  340. ld8 r21=[r19],8;;
  341. st8[r20]=r21,8
  342. adds r18=-1,r18;;
  343. cmp4.lt p7,p6=0,r18
  344. (p7) br.cond.dptk.few 1b
  345. mov r19=r20
  346. ;;
  347. 2:
  348. #endif
  349. tpa r19=r19
  350. ;;
  351. .pred.rel.mutex isBP,isAP
  352. (isBP) mov IA64_KR(PER_CPU_DATA)=r19 // per-CPU base for cpu0
  353. (isAP) mov IA64_KR(PER_CPU_DATA)=r0 // clear physical per-CPU base
  354. ;;
  355. mov ar.bspstore=r2 // establish the new RSE stack
  356. ;;
  357. mov ar.rsc=0x3 // place RSE in eager mode
  358. (isBP) dep r28=-1,r28,61,3 // make address virtual
  359. (isBP) movl r2=ia64_boot_param
  360. ;;
  361. (isBP) st8 [r2]=r28 // save the address of the boot param area passed by the bootloader
  362. #ifdef CONFIG_SMP
  363. (isAP) br.call.sptk.many rp=start_secondary
  364. .ret0:
  365. (isAP) br.cond.sptk self
  366. #endif
  367. // This is executed by the bootstrap processor (bsp) only:
  368. #ifdef CONFIG_IA64_FW_EMU
  369. // initialize PAL & SAL emulator:
  370. br.call.sptk.many rp=sys_fw_init
  371. .ret1:
  372. #endif
  373. br.call.sptk.many rp=start_kernel
  374. .ret2: addl r3=@ltoff(halt_msg),gp
  375. ;;
  376. alloc r2=ar.pfs,8,0,2,0
  377. ;;
  378. ld8 out0=[r3]
  379. br.call.sptk.many b0=console_print
  380. self: hint @pause
  381. br.sptk.many self // endless loop
  382. END(_start)
  383. .text
  384. GLOBAL_ENTRY(ia64_save_debug_regs)
  385. alloc r16=ar.pfs,1,0,0,0
  386. mov r20=ar.lc // preserve ar.lc
  387. mov ar.lc=IA64_NUM_DBG_REGS-1
  388. mov r18=0
  389. add r19=IA64_NUM_DBG_REGS*8,in0
  390. ;;
  391. 1: mov r16=dbr[r18]
  392. #ifdef CONFIG_ITANIUM
  393. ;;
  394. srlz.d
  395. #endif
  396. mov r17=ibr[r18]
  397. add r18=1,r18
  398. ;;
  399. st8.nta [in0]=r16,8
  400. st8.nta [r19]=r17,8
  401. br.cloop.sptk.many 1b
  402. ;;
  403. mov ar.lc=r20 // restore ar.lc
  404. br.ret.sptk.many rp
  405. END(ia64_save_debug_regs)
  406. GLOBAL_ENTRY(ia64_load_debug_regs)
  407. alloc r16=ar.pfs,1,0,0,0
  408. lfetch.nta [in0]
  409. mov r20=ar.lc // preserve ar.lc
  410. add r19=IA64_NUM_DBG_REGS*8,in0
  411. mov ar.lc=IA64_NUM_DBG_REGS-1
  412. mov r18=-1
  413. ;;
  414. 1: ld8.nta r16=[in0],8
  415. ld8.nta r17=[r19],8
  416. add r18=1,r18
  417. ;;
  418. mov dbr[r18]=r16
  419. #ifdef CONFIG_ITANIUM
  420. ;;
  421. srlz.d // Errata 132 (NoFix status)
  422. #endif
  423. mov ibr[r18]=r17
  424. br.cloop.sptk.many 1b
  425. ;;
  426. mov ar.lc=r20 // restore ar.lc
  427. br.ret.sptk.many rp
  428. END(ia64_load_debug_regs)
  429. GLOBAL_ENTRY(__ia64_save_fpu)
  430. alloc r2=ar.pfs,1,4,0,0
  431. adds loc0=96*16-16,in0
  432. adds loc1=96*16-16-128,in0
  433. ;;
  434. stf.spill.nta [loc0]=f127,-256
  435. stf.spill.nta [loc1]=f119,-256
  436. ;;
  437. stf.spill.nta [loc0]=f111,-256
  438. stf.spill.nta [loc1]=f103,-256
  439. ;;
  440. stf.spill.nta [loc0]=f95,-256
  441. stf.spill.nta [loc1]=f87,-256
  442. ;;
  443. stf.spill.nta [loc0]=f79,-256
  444. stf.spill.nta [loc1]=f71,-256
  445. ;;
  446. stf.spill.nta [loc0]=f63,-256
  447. stf.spill.nta [loc1]=f55,-256
  448. adds loc2=96*16-32,in0
  449. ;;
  450. stf.spill.nta [loc0]=f47,-256
  451. stf.spill.nta [loc1]=f39,-256
  452. adds loc3=96*16-32-128,in0
  453. ;;
  454. stf.spill.nta [loc2]=f126,-256
  455. stf.spill.nta [loc3]=f118,-256
  456. ;;
  457. stf.spill.nta [loc2]=f110,-256
  458. stf.spill.nta [loc3]=f102,-256
  459. ;;
  460. stf.spill.nta [loc2]=f94,-256
  461. stf.spill.nta [loc3]=f86,-256
  462. ;;
  463. stf.spill.nta [loc2]=f78,-256
  464. stf.spill.nta [loc3]=f70,-256
  465. ;;
  466. stf.spill.nta [loc2]=f62,-256
  467. stf.spill.nta [loc3]=f54,-256
  468. adds loc0=96*16-48,in0
  469. ;;
  470. stf.spill.nta [loc2]=f46,-256
  471. stf.spill.nta [loc3]=f38,-256
  472. adds loc1=96*16-48-128,in0
  473. ;;
  474. stf.spill.nta [loc0]=f125,-256
  475. stf.spill.nta [loc1]=f117,-256
  476. ;;
  477. stf.spill.nta [loc0]=f109,-256
  478. stf.spill.nta [loc1]=f101,-256
  479. ;;
  480. stf.spill.nta [loc0]=f93,-256
  481. stf.spill.nta [loc1]=f85,-256
  482. ;;
  483. stf.spill.nta [loc0]=f77,-256
  484. stf.spill.nta [loc1]=f69,-256
  485. ;;
  486. stf.spill.nta [loc0]=f61,-256
  487. stf.spill.nta [loc1]=f53,-256
  488. adds loc2=96*16-64,in0
  489. ;;
  490. stf.spill.nta [loc0]=f45,-256
  491. stf.spill.nta [loc1]=f37,-256
  492. adds loc3=96*16-64-128,in0
  493. ;;
  494. stf.spill.nta [loc2]=f124,-256
  495. stf.spill.nta [loc3]=f116,-256
  496. ;;
  497. stf.spill.nta [loc2]=f108,-256
  498. stf.spill.nta [loc3]=f100,-256
  499. ;;
  500. stf.spill.nta [loc2]=f92,-256
  501. stf.spill.nta [loc3]=f84,-256
  502. ;;
  503. stf.spill.nta [loc2]=f76,-256
  504. stf.spill.nta [loc3]=f68,-256
  505. ;;
  506. stf.spill.nta [loc2]=f60,-256
  507. stf.spill.nta [loc3]=f52,-256
  508. adds loc0=96*16-80,in0
  509. ;;
  510. stf.spill.nta [loc2]=f44,-256
  511. stf.spill.nta [loc3]=f36,-256
  512. adds loc1=96*16-80-128,in0
  513. ;;
  514. stf.spill.nta [loc0]=f123,-256
  515. stf.spill.nta [loc1]=f115,-256
  516. ;;
  517. stf.spill.nta [loc0]=f107,-256
  518. stf.spill.nta [loc1]=f99,-256
  519. ;;
  520. stf.spill.nta [loc0]=f91,-256
  521. stf.spill.nta [loc1]=f83,-256
  522. ;;
  523. stf.spill.nta [loc0]=f75,-256
  524. stf.spill.nta [loc1]=f67,-256
  525. ;;
  526. stf.spill.nta [loc0]=f59,-256
  527. stf.spill.nta [loc1]=f51,-256
  528. adds loc2=96*16-96,in0
  529. ;;
  530. stf.spill.nta [loc0]=f43,-256
  531. stf.spill.nta [loc1]=f35,-256
  532. adds loc3=96*16-96-128,in0
  533. ;;
  534. stf.spill.nta [loc2]=f122,-256
  535. stf.spill.nta [loc3]=f114,-256
  536. ;;
  537. stf.spill.nta [loc2]=f106,-256
  538. stf.spill.nta [loc3]=f98,-256
  539. ;;
  540. stf.spill.nta [loc2]=f90,-256
  541. stf.spill.nta [loc3]=f82,-256
  542. ;;
  543. stf.spill.nta [loc2]=f74,-256
  544. stf.spill.nta [loc3]=f66,-256
  545. ;;
  546. stf.spill.nta [loc2]=f58,-256
  547. stf.spill.nta [loc3]=f50,-256
  548. adds loc0=96*16-112,in0
  549. ;;
  550. stf.spill.nta [loc2]=f42,-256
  551. stf.spill.nta [loc3]=f34,-256
  552. adds loc1=96*16-112-128,in0
  553. ;;
  554. stf.spill.nta [loc0]=f121,-256
  555. stf.spill.nta [loc1]=f113,-256
  556. ;;
  557. stf.spill.nta [loc0]=f105,-256
  558. stf.spill.nta [loc1]=f97,-256
  559. ;;
  560. stf.spill.nta [loc0]=f89,-256
  561. stf.spill.nta [loc1]=f81,-256
  562. ;;
  563. stf.spill.nta [loc0]=f73,-256
  564. stf.spill.nta [loc1]=f65,-256
  565. ;;
  566. stf.spill.nta [loc0]=f57,-256
  567. stf.spill.nta [loc1]=f49,-256
  568. adds loc2=96*16-128,in0
  569. ;;
  570. stf.spill.nta [loc0]=f41,-256
  571. stf.spill.nta [loc1]=f33,-256
  572. adds loc3=96*16-128-128,in0
  573. ;;
  574. stf.spill.nta [loc2]=f120,-256
  575. stf.spill.nta [loc3]=f112,-256
  576. ;;
  577. stf.spill.nta [loc2]=f104,-256
  578. stf.spill.nta [loc3]=f96,-256
  579. ;;
  580. stf.spill.nta [loc2]=f88,-256
  581. stf.spill.nta [loc3]=f80,-256
  582. ;;
  583. stf.spill.nta [loc2]=f72,-256
  584. stf.spill.nta [loc3]=f64,-256
  585. ;;
  586. stf.spill.nta [loc2]=f56,-256
  587. stf.spill.nta [loc3]=f48,-256
  588. ;;
  589. stf.spill.nta [loc2]=f40
  590. stf.spill.nta [loc3]=f32
  591. br.ret.sptk.many rp
  592. END(__ia64_save_fpu)
  593. GLOBAL_ENTRY(__ia64_load_fpu)
  594. alloc r2=ar.pfs,1,2,0,0
  595. adds r3=128,in0
  596. adds r14=256,in0
  597. adds r15=384,in0
  598. mov loc0=512
  599. mov loc1=-1024+16
  600. ;;
  601. ldf.fill.nta f32=[in0],loc0
  602. ldf.fill.nta f40=[ r3],loc0
  603. ldf.fill.nta f48=[r14],loc0
  604. ldf.fill.nta f56=[r15],loc0
  605. ;;
  606. ldf.fill.nta f64=[in0],loc0
  607. ldf.fill.nta f72=[ r3],loc0
  608. ldf.fill.nta f80=[r14],loc0
  609. ldf.fill.nta f88=[r15],loc0
  610. ;;
  611. ldf.fill.nta f96=[in0],loc1
  612. ldf.fill.nta f104=[ r3],loc1
  613. ldf.fill.nta f112=[r14],loc1
  614. ldf.fill.nta f120=[r15],loc1
  615. ;;
  616. ldf.fill.nta f33=[in0],loc0
  617. ldf.fill.nta f41=[ r3],loc0
  618. ldf.fill.nta f49=[r14],loc0
  619. ldf.fill.nta f57=[r15],loc0
  620. ;;
  621. ldf.fill.nta f65=[in0],loc0
  622. ldf.fill.nta f73=[ r3],loc0
  623. ldf.fill.nta f81=[r14],loc0
  624. ldf.fill.nta f89=[r15],loc0
  625. ;;
  626. ldf.fill.nta f97=[in0],loc1
  627. ldf.fill.nta f105=[ r3],loc1
  628. ldf.fill.nta f113=[r14],loc1
  629. ldf.fill.nta f121=[r15],loc1
  630. ;;
  631. ldf.fill.nta f34=[in0],loc0
  632. ldf.fill.nta f42=[ r3],loc0
  633. ldf.fill.nta f50=[r14],loc0
  634. ldf.fill.nta f58=[r15],loc0
  635. ;;
  636. ldf.fill.nta f66=[in0],loc0
  637. ldf.fill.nta f74=[ r3],loc0
  638. ldf.fill.nta f82=[r14],loc0
  639. ldf.fill.nta f90=[r15],loc0
  640. ;;
  641. ldf.fill.nta f98=[in0],loc1
  642. ldf.fill.nta f106=[ r3],loc1
  643. ldf.fill.nta f114=[r14],loc1
  644. ldf.fill.nta f122=[r15],loc1
  645. ;;
  646. ldf.fill.nta f35=[in0],loc0
  647. ldf.fill.nta f43=[ r3],loc0
  648. ldf.fill.nta f51=[r14],loc0
  649. ldf.fill.nta f59=[r15],loc0
  650. ;;
  651. ldf.fill.nta f67=[in0],loc0
  652. ldf.fill.nta f75=[ r3],loc0
  653. ldf.fill.nta f83=[r14],loc0
  654. ldf.fill.nta f91=[r15],loc0
  655. ;;
  656. ldf.fill.nta f99=[in0],loc1
  657. ldf.fill.nta f107=[ r3],loc1
  658. ldf.fill.nta f115=[r14],loc1
  659. ldf.fill.nta f123=[r15],loc1
  660. ;;
  661. ldf.fill.nta f36=[in0],loc0
  662. ldf.fill.nta f44=[ r3],loc0
  663. ldf.fill.nta f52=[r14],loc0
  664. ldf.fill.nta f60=[r15],loc0
  665. ;;
  666. ldf.fill.nta f68=[in0],loc0
  667. ldf.fill.nta f76=[ r3],loc0
  668. ldf.fill.nta f84=[r14],loc0
  669. ldf.fill.nta f92=[r15],loc0
  670. ;;
  671. ldf.fill.nta f100=[in0],loc1
  672. ldf.fill.nta f108=[ r3],loc1
  673. ldf.fill.nta f116=[r14],loc1
  674. ldf.fill.nta f124=[r15],loc1
  675. ;;
  676. ldf.fill.nta f37=[in0],loc0
  677. ldf.fill.nta f45=[ r3],loc0
  678. ldf.fill.nta f53=[r14],loc0
  679. ldf.fill.nta f61=[r15],loc0
  680. ;;
  681. ldf.fill.nta f69=[in0],loc0
  682. ldf.fill.nta f77=[ r3],loc0
  683. ldf.fill.nta f85=[r14],loc0
  684. ldf.fill.nta f93=[r15],loc0
  685. ;;
  686. ldf.fill.nta f101=[in0],loc1
  687. ldf.fill.nta f109=[ r3],loc1
  688. ldf.fill.nta f117=[r14],loc1
  689. ldf.fill.nta f125=[r15],loc1
  690. ;;
  691. ldf.fill.nta f38 =[in0],loc0
  692. ldf.fill.nta f46 =[ r3],loc0
  693. ldf.fill.nta f54 =[r14],loc0
  694. ldf.fill.nta f62 =[r15],loc0
  695. ;;
  696. ldf.fill.nta f70 =[in0],loc0
  697. ldf.fill.nta f78 =[ r3],loc0
  698. ldf.fill.nta f86 =[r14],loc0
  699. ldf.fill.nta f94 =[r15],loc0
  700. ;;
  701. ldf.fill.nta f102=[in0],loc1
  702. ldf.fill.nta f110=[ r3],loc1
  703. ldf.fill.nta f118=[r14],loc1
  704. ldf.fill.nta f126=[r15],loc1
  705. ;;
  706. ldf.fill.nta f39 =[in0],loc0
  707. ldf.fill.nta f47 =[ r3],loc0
  708. ldf.fill.nta f55 =[r14],loc0
  709. ldf.fill.nta f63 =[r15],loc0
  710. ;;
  711. ldf.fill.nta f71 =[in0],loc0
  712. ldf.fill.nta f79 =[ r3],loc0
  713. ldf.fill.nta f87 =[r14],loc0
  714. ldf.fill.nta f95 =[r15],loc0
  715. ;;
  716. ldf.fill.nta f103=[in0]
  717. ldf.fill.nta f111=[ r3]
  718. ldf.fill.nta f119=[r14]
  719. ldf.fill.nta f127=[r15]
  720. br.ret.sptk.many rp
  721. END(__ia64_load_fpu)
  722. GLOBAL_ENTRY(__ia64_init_fpu)
  723. stf.spill [sp]=f0 // M3
  724. mov f32=f0 // F
  725. nop.b 0
  726. ldfps f33,f34=[sp] // M0
  727. ldfps f35,f36=[sp] // M1
  728. mov f37=f0 // F
  729. ;;
  730. setf.s f38=r0 // M2
  731. setf.s f39=r0 // M3
  732. mov f40=f0 // F
  733. ldfps f41,f42=[sp] // M0
  734. ldfps f43,f44=[sp] // M1
  735. mov f45=f0 // F
  736. setf.s f46=r0 // M2
  737. setf.s f47=r0 // M3
  738. mov f48=f0 // F
  739. ldfps f49,f50=[sp] // M0
  740. ldfps f51,f52=[sp] // M1
  741. mov f53=f0 // F
  742. setf.s f54=r0 // M2
  743. setf.s f55=r0 // M3
  744. mov f56=f0 // F
  745. ldfps f57,f58=[sp] // M0
  746. ldfps f59,f60=[sp] // M1
  747. mov f61=f0 // F
  748. setf.s f62=r0 // M2
  749. setf.s f63=r0 // M3
  750. mov f64=f0 // F
  751. ldfps f65,f66=[sp] // M0
  752. ldfps f67,f68=[sp] // M1
  753. mov f69=f0 // F
  754. setf.s f70=r0 // M2
  755. setf.s f71=r0 // M3
  756. mov f72=f0 // F
  757. ldfps f73,f74=[sp] // M0
  758. ldfps f75,f76=[sp] // M1
  759. mov f77=f0 // F
  760. setf.s f78=r0 // M2
  761. setf.s f79=r0 // M3
  762. mov f80=f0 // F
  763. ldfps f81,f82=[sp] // M0
  764. ldfps f83,f84=[sp] // M1
  765. mov f85=f0 // F
  766. setf.s f86=r0 // M2
  767. setf.s f87=r0 // M3
  768. mov f88=f0 // F
  769. /*
  770. * When the instructions are cached, it would be faster to initialize
  771. * the remaining registers with simply mov instructions (F-unit).
  772. * This gets the time down to ~29 cycles. However, this would use up
  773. * 33 bundles, whereas continuing with the above pattern yields
  774. * 10 bundles and ~30 cycles.
  775. */
  776. ldfps f89,f90=[sp] // M0
  777. ldfps f91,f92=[sp] // M1
  778. mov f93=f0 // F
  779. setf.s f94=r0 // M2
  780. setf.s f95=r0 // M3
  781. mov f96=f0 // F
  782. ldfps f97,f98=[sp] // M0
  783. ldfps f99,f100=[sp] // M1
  784. mov f101=f0 // F
  785. setf.s f102=r0 // M2
  786. setf.s f103=r0 // M3
  787. mov f104=f0 // F
  788. ldfps f105,f106=[sp] // M0
  789. ldfps f107,f108=[sp] // M1
  790. mov f109=f0 // F
  791. setf.s f110=r0 // M2
  792. setf.s f111=r0 // M3
  793. mov f112=f0 // F
  794. ldfps f113,f114=[sp] // M0
  795. ldfps f115,f116=[sp] // M1
  796. mov f117=f0 // F
  797. setf.s f118=r0 // M2
  798. setf.s f119=r0 // M3
  799. mov f120=f0 // F
  800. ldfps f121,f122=[sp] // M0
  801. ldfps f123,f124=[sp] // M1
  802. mov f125=f0 // F
  803. setf.s f126=r0 // M2
  804. setf.s f127=r0 // M3
  805. br.ret.sptk.many rp // F
  806. END(__ia64_init_fpu)
  807. /*
  808. * Switch execution mode from virtual to physical
  809. *
  810. * Inputs:
  811. * r16 = new psr to establish
  812. * Output:
  813. * r19 = old virtual address of ar.bsp
  814. * r20 = old virtual address of sp
  815. *
  816. * Note: RSE must already be in enforced lazy mode
  817. */
  818. GLOBAL_ENTRY(ia64_switch_mode_phys)
  819. {
  820. rsm psr.i | psr.ic // disable interrupts and interrupt collection
  821. mov r15=ip
  822. }
  823. ;;
  824. {
  825. flushrs // must be first insn in group
  826. srlz.i
  827. }
  828. ;;
  829. mov cr.ipsr=r16 // set new PSR
  830. add r3=1f-ia64_switch_mode_phys,r15
  831. mov r19=ar.bsp
  832. mov r20=sp
  833. mov r14=rp // get return address into a general register
  834. ;;
  835. // going to physical mode, use tpa to translate virt->phys
  836. tpa r17=r19
  837. tpa r3=r3
  838. tpa sp=sp
  839. tpa r14=r14
  840. ;;
  841. mov r18=ar.rnat // save ar.rnat
  842. mov ar.bspstore=r17 // this steps on ar.rnat
  843. mov cr.iip=r3
  844. mov cr.ifs=r0
  845. ;;
  846. mov ar.rnat=r18 // restore ar.rnat
  847. rfi // must be last insn in group
  848. ;;
  849. 1: mov rp=r14
  850. br.ret.sptk.many rp
  851. END(ia64_switch_mode_phys)
  852. /*
  853. * Switch execution mode from physical to virtual
  854. *
  855. * Inputs:
  856. * r16 = new psr to establish
  857. * r19 = new bspstore to establish
  858. * r20 = new sp to establish
  859. *
  860. * Note: RSE must already be in enforced lazy mode
  861. */
  862. GLOBAL_ENTRY(ia64_switch_mode_virt)
  863. {
  864. rsm psr.i | psr.ic // disable interrupts and interrupt collection
  865. mov r15=ip
  866. }
  867. ;;
  868. {
  869. flushrs // must be first insn in group
  870. srlz.i
  871. }
  872. ;;
  873. mov cr.ipsr=r16 // set new PSR
  874. add r3=1f-ia64_switch_mode_virt,r15
  875. mov r14=rp // get return address into a general register
  876. ;;
  877. // going to virtual
  878. // - for code addresses, set upper bits of addr to KERNEL_START
  879. // - for stack addresses, copy from input argument
  880. movl r18=KERNEL_START
  881. dep r3=0,r3,KERNEL_TR_PAGE_SHIFT,64-KERNEL_TR_PAGE_SHIFT
  882. dep r14=0,r14,KERNEL_TR_PAGE_SHIFT,64-KERNEL_TR_PAGE_SHIFT
  883. mov sp=r20
  884. ;;
  885. or r3=r3,r18
  886. or r14=r14,r18
  887. ;;
  888. mov r18=ar.rnat // save ar.rnat
  889. mov ar.bspstore=r19 // this steps on ar.rnat
  890. mov cr.iip=r3
  891. mov cr.ifs=r0
  892. ;;
  893. mov ar.rnat=r18 // restore ar.rnat
  894. rfi // must be last insn in group
  895. ;;
  896. 1: mov rp=r14
  897. br.ret.sptk.many rp
  898. END(ia64_switch_mode_virt)
  899. GLOBAL_ENTRY(ia64_delay_loop)
  900. .prologue
  901. { nop 0 // work around GAS unwind info generation bug...
  902. .save ar.lc,r2
  903. mov r2=ar.lc
  904. .body
  905. ;;
  906. mov ar.lc=r32
  907. }
  908. ;;
  909. // force loop to be 32-byte aligned (GAS bug means we cannot use .align
  910. // inside function body without corrupting unwind info).
  911. { nop 0 }
  912. 1: br.cloop.sptk.few 1b
  913. ;;
  914. mov ar.lc=r2
  915. br.ret.sptk.many rp
  916. END(ia64_delay_loop)
  917. /*
  918. * Return a CPU-local timestamp in nano-seconds. This timestamp is
  919. * NOT synchronized across CPUs its return value must never be
  920. * compared against the values returned on another CPU. The usage in
  921. * kernel/sched/core.c ensures that.
  922. *
  923. * The return-value of sched_clock() is NOT supposed to wrap-around.
  924. * If it did, it would cause some scheduling hiccups (at the worst).
  925. * Fortunately, with a 64-bit cycle-counter ticking at 100GHz, even
  926. * that would happen only once every 5+ years.
  927. *
  928. * The code below basically calculates:
  929. *
  930. * (ia64_get_itc() * local_cpu_data->nsec_per_cyc) >> IA64_NSEC_PER_CYC_SHIFT
  931. *
  932. * except that the multiplication and the shift are done with 128-bit
  933. * intermediate precision so that we can produce a full 64-bit result.
  934. */
  935. GLOBAL_ENTRY(ia64_native_sched_clock)
  936. addl r8=THIS_CPU(ia64_cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0
  937. mov.m r9=ar.itc // fetch cycle-counter (35 cyc)
  938. ;;
  939. ldf8 f8=[r8]
  940. ;;
  941. setf.sig f9=r9 // certain to stall, so issue it _after_ ldf8...
  942. ;;
  943. xmpy.lu f10=f9,f8 // calculate low 64 bits of 128-bit product (4 cyc)
  944. xmpy.hu f11=f9,f8 // calculate high 64 bits of 128-bit product
  945. ;;
  946. getf.sig r8=f10 // (5 cyc)
  947. getf.sig r9=f11
  948. ;;
  949. shrp r8=r9,r8,IA64_NSEC_PER_CYC_SHIFT
  950. br.ret.sptk.many rp
  951. END(ia64_native_sched_clock)
  952. #ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
  953. GLOBAL_ENTRY(cycle_to_nsec)
  954. alloc r16=ar.pfs,1,0,0,0
  955. addl r8=THIS_CPU(ia64_cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0
  956. ;;
  957. ldf8 f8=[r8]
  958. ;;
  959. setf.sig f9=r32
  960. ;;
  961. xmpy.lu f10=f9,f8 // calculate low 64 bits of 128-bit product (4 cyc)
  962. xmpy.hu f11=f9,f8 // calculate high 64 bits of 128-bit product
  963. ;;
  964. getf.sig r8=f10 // (5 cyc)
  965. getf.sig r9=f11
  966. ;;
  967. shrp r8=r9,r8,IA64_NSEC_PER_CYC_SHIFT
  968. br.ret.sptk.many rp
  969. END(cycle_to_nsec)
  970. #endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */
  971. #ifdef CONFIG_IA64_BRL_EMU
  972. /*
  973. * Assembly routines used by brl_emu.c to set preserved register state.
  974. */
  975. #define SET_REG(reg) \
  976. GLOBAL_ENTRY(ia64_set_##reg); \
  977. alloc r16=ar.pfs,1,0,0,0; \
  978. mov reg=r32; \
  979. ;; \
  980. br.ret.sptk.many rp; \
  981. END(ia64_set_##reg)
  982. SET_REG(b1);
  983. SET_REG(b2);
  984. SET_REG(b3);
  985. SET_REG(b4);
  986. SET_REG(b5);
  987. #endif /* CONFIG_IA64_BRL_EMU */
  988. #ifdef CONFIG_SMP
  989. #ifdef CONFIG_HOTPLUG_CPU
  990. GLOBAL_ENTRY(ia64_jump_to_sal)
  991. alloc r16=ar.pfs,1,0,0,0;;
  992. rsm psr.i | psr.ic
  993. {
  994. flushrs
  995. srlz.i
  996. }
  997. tpa r25=in0
  998. movl r18=tlb_purge_done;;
  999. DATA_VA_TO_PA(r18);;
  1000. mov b1=r18 // Return location
  1001. movl r18=ia64_do_tlb_purge;;
  1002. DATA_VA_TO_PA(r18);;
  1003. mov b2=r18 // doing tlb_flush work
  1004. mov ar.rsc=0 // Put RSE in enforced lazy, LE mode
  1005. movl r17=1f;;
  1006. DATA_VA_TO_PA(r17);;
  1007. mov cr.iip=r17
  1008. movl r16=SAL_PSR_BITS_TO_SET;;
  1009. mov cr.ipsr=r16
  1010. mov cr.ifs=r0;;
  1011. rfi;; // note: this unmask MCA/INIT (psr.mc)
  1012. 1:
  1013. /*
  1014. * Invalidate all TLB data/inst
  1015. */
  1016. br.sptk.many b2;; // jump to tlb purge code
  1017. tlb_purge_done:
  1018. RESTORE_REGION_REGS(r25, r17,r18,r19);;
  1019. RESTORE_REG(b0, r25, r17);;
  1020. RESTORE_REG(b1, r25, r17);;
  1021. RESTORE_REG(b2, r25, r17);;
  1022. RESTORE_REG(b3, r25, r17);;
  1023. RESTORE_REG(b4, r25, r17);;
  1024. RESTORE_REG(b5, r25, r17);;
  1025. ld8 r1=[r25],0x08;;
  1026. ld8 r12=[r25],0x08;;
  1027. ld8 r13=[r25],0x08;;
  1028. RESTORE_REG(ar.fpsr, r25, r17);;
  1029. RESTORE_REG(ar.pfs, r25, r17);;
  1030. RESTORE_REG(ar.rnat, r25, r17);;
  1031. RESTORE_REG(ar.unat, r25, r17);;
  1032. RESTORE_REG(ar.bspstore, r25, r17);;
  1033. RESTORE_REG(cr.dcr, r25, r17);;
  1034. RESTORE_REG(cr.iva, r25, r17);;
  1035. RESTORE_REG(cr.pta, r25, r17);;
  1036. srlz.d;; // required not to violate RAW dependency
  1037. RESTORE_REG(cr.itv, r25, r17);;
  1038. RESTORE_REG(cr.pmv, r25, r17);;
  1039. RESTORE_REG(cr.cmcv, r25, r17);;
  1040. RESTORE_REG(cr.lrr0, r25, r17);;
  1041. RESTORE_REG(cr.lrr1, r25, r17);;
  1042. ld8 r4=[r25],0x08;;
  1043. ld8 r5=[r25],0x08;;
  1044. ld8 r6=[r25],0x08;;
  1045. ld8 r7=[r25],0x08;;
  1046. ld8 r17=[r25],0x08;;
  1047. mov pr=r17,-1;;
  1048. RESTORE_REG(ar.lc, r25, r17);;
  1049. /*
  1050. * Now Restore floating point regs
  1051. */
  1052. ldf.fill.nta f2=[r25],16;;
  1053. ldf.fill.nta f3=[r25],16;;
  1054. ldf.fill.nta f4=[r25],16;;
  1055. ldf.fill.nta f5=[r25],16;;
  1056. ldf.fill.nta f16=[r25],16;;
  1057. ldf.fill.nta f17=[r25],16;;
  1058. ldf.fill.nta f18=[r25],16;;
  1059. ldf.fill.nta f19=[r25],16;;
  1060. ldf.fill.nta f20=[r25],16;;
  1061. ldf.fill.nta f21=[r25],16;;
  1062. ldf.fill.nta f22=[r25],16;;
  1063. ldf.fill.nta f23=[r25],16;;
  1064. ldf.fill.nta f24=[r25],16;;
  1065. ldf.fill.nta f25=[r25],16;;
  1066. ldf.fill.nta f26=[r25],16;;
  1067. ldf.fill.nta f27=[r25],16;;
  1068. ldf.fill.nta f28=[r25],16;;
  1069. ldf.fill.nta f29=[r25],16;;
  1070. ldf.fill.nta f30=[r25],16;;
  1071. ldf.fill.nta f31=[r25],16;;
  1072. /*
  1073. * Now that we have done all the register restores
  1074. * we are now ready for the big DIVE to SAL Land
  1075. */
  1076. ssm psr.ic;;
  1077. srlz.d;;
  1078. br.ret.sptk.many b0;;
  1079. END(ia64_jump_to_sal)
  1080. #endif /* CONFIG_HOTPLUG_CPU */
  1081. #endif /* CONFIG_SMP */