head.S 28 KB

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