head.S 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203
  1. /*
  2. * linux/arch/arm/boot/compressed/head.S
  3. *
  4. * Copyright (C) 1996-2002 Russell King
  5. * Copyright (C) 2004 Hyok S. Choi (MPU support)
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #include <linux/linkage.h>
  12. /*
  13. * Debugging stuff
  14. *
  15. * Note that these macros must not contain any code which is not
  16. * 100% relocatable. Any attempt to do so will result in a crash.
  17. * Please select one of the following when turning on debugging.
  18. */
  19. #ifdef DEBUG
  20. #if defined(CONFIG_DEBUG_ICEDCC)
  21. #if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K) || defined(CONFIG_CPU_V7)
  22. .macro loadsp, rb, tmp
  23. .endm
  24. .macro writeb, ch, rb
  25. mcr p14, 0, \ch, c0, c5, 0
  26. .endm
  27. #elif defined(CONFIG_CPU_XSCALE)
  28. .macro loadsp, rb, tmp
  29. .endm
  30. .macro writeb, ch, rb
  31. mcr p14, 0, \ch, c8, c0, 0
  32. .endm
  33. #else
  34. .macro loadsp, rb, tmp
  35. .endm
  36. .macro writeb, ch, rb
  37. mcr p14, 0, \ch, c1, c0, 0
  38. .endm
  39. #endif
  40. #else
  41. #include <mach/debug-macro.S>
  42. .macro writeb, ch, rb
  43. senduart \ch, \rb
  44. .endm
  45. #if defined(CONFIG_ARCH_SA1100)
  46. .macro loadsp, rb, tmp
  47. mov \rb, #0x80000000 @ physical base address
  48. #ifdef CONFIG_DEBUG_LL_SER3
  49. add \rb, \rb, #0x00050000 @ Ser3
  50. #else
  51. add \rb, \rb, #0x00010000 @ Ser1
  52. #endif
  53. .endm
  54. #elif defined(CONFIG_ARCH_S3C24XX)
  55. .macro loadsp, rb, tmp
  56. mov \rb, #0x50000000
  57. add \rb, \rb, #0x4000 * CONFIG_S3C_LOWLEVEL_UART_PORT
  58. .endm
  59. #else
  60. .macro loadsp, rb, tmp
  61. addruart \rb, \tmp
  62. .endm
  63. #endif
  64. #endif
  65. #endif
  66. .macro kputc,val
  67. mov r0, \val
  68. bl putc
  69. .endm
  70. .macro kphex,val,len
  71. mov r0, \val
  72. mov r1, #\len
  73. bl phex
  74. .endm
  75. .macro debug_reloc_start
  76. #ifdef DEBUG
  77. kputc #'\n'
  78. kphex r6, 8 /* processor id */
  79. kputc #':'
  80. kphex r7, 8 /* architecture id */
  81. #ifdef CONFIG_CPU_CP15
  82. kputc #':'
  83. mrc p15, 0, r0, c1, c0
  84. kphex r0, 8 /* control reg */
  85. #endif
  86. kputc #'\n'
  87. kphex r5, 8 /* decompressed kernel start */
  88. kputc #'-'
  89. kphex r9, 8 /* decompressed kernel end */
  90. kputc #'>'
  91. kphex r4, 8 /* kernel execution address */
  92. kputc #'\n'
  93. #endif
  94. .endm
  95. .macro debug_reloc_end
  96. #ifdef DEBUG
  97. kphex r5, 8 /* end of kernel */
  98. kputc #'\n'
  99. mov r0, r4
  100. bl memdump /* dump 256 bytes at start of kernel */
  101. #endif
  102. .endm
  103. .section ".start", #alloc, #execinstr
  104. /*
  105. * sort out different calling conventions
  106. */
  107. .align
  108. .arm @ Always enter in ARM state
  109. start:
  110. .type start,#function
  111. .rept 7
  112. mov r0, r0
  113. .endr
  114. ARM( mov r0, r0 )
  115. ARM( b 1f )
  116. THUMB( adr r12, BSYM(1f) )
  117. THUMB( bx r12 )
  118. .word 0x016f2818 @ Magic numbers to help the loader
  119. .word start @ absolute load/run zImage address
  120. .word _edata @ zImage end address
  121. THUMB( .thumb )
  122. 1: mov r7, r1 @ save architecture ID
  123. mov r8, r2 @ save atags pointer
  124. #ifndef __ARM_ARCH_2__
  125. /*
  126. * Booting from Angel - need to enter SVC mode and disable
  127. * FIQs/IRQs (numeric definitions from angel arm.h source).
  128. * We only do this if we were in user mode on entry.
  129. */
  130. mrs r2, cpsr @ get current mode
  131. tst r2, #3 @ not user?
  132. bne not_angel
  133. mov r0, #0x17 @ angel_SWIreason_EnterSVC
  134. ARM( swi 0x123456 ) @ angel_SWI_ARM
  135. THUMB( svc 0xab ) @ angel_SWI_THUMB
  136. not_angel:
  137. mrs r2, cpsr @ turn off interrupts to
  138. orr r2, r2, #0xc0 @ prevent angel from running
  139. msr cpsr_c, r2
  140. #else
  141. teqp pc, #0x0c000003 @ turn off interrupts
  142. #endif
  143. /*
  144. * Note that some cache flushing and other stuff may
  145. * be needed here - is there an Angel SWI call for this?
  146. */
  147. /*
  148. * some architecture specific code can be inserted
  149. * by the linker here, but it should preserve r7, r8, and r9.
  150. */
  151. .text
  152. #ifdef CONFIG_AUTO_ZRELADDR
  153. @ determine final kernel image address
  154. mov r4, pc
  155. and r4, r4, #0xf8000000
  156. add r4, r4, #TEXT_OFFSET
  157. #else
  158. ldr r4, =zreladdr
  159. #endif
  160. bl cache_on
  161. restart: adr r0, LC0
  162. ldmia r0, {r1, r2, r3, r6, r10, r11, r12}
  163. ldr sp, [r0, #28]
  164. /*
  165. * We might be running at a different address. We need
  166. * to fix up various pointers.
  167. */
  168. sub r0, r0, r1 @ calculate the delta offset
  169. add r6, r6, r0 @ _edata
  170. add r10, r10, r0 @ inflated kernel size location
  171. /*
  172. * The kernel build system appends the size of the
  173. * decompressed kernel at the end of the compressed data
  174. * in little-endian form.
  175. */
  176. ldrb r9, [r10, #0]
  177. ldrb lr, [r10, #1]
  178. orr r9, r9, lr, lsl #8
  179. ldrb lr, [r10, #2]
  180. ldrb r10, [r10, #3]
  181. orr r9, r9, lr, lsl #16
  182. orr r9, r9, r10, lsl #24
  183. #ifndef CONFIG_ZBOOT_ROM
  184. /* malloc space is above the relocated stack (64k max) */
  185. add sp, sp, r0
  186. add r10, sp, #0x10000
  187. #else
  188. /*
  189. * With ZBOOT_ROM the bss/stack is non relocatable,
  190. * but someone could still run this code from RAM,
  191. * in which case our reference is _edata.
  192. */
  193. mov r10, r6
  194. #endif
  195. mov r5, #0 @ init dtb size to 0
  196. #ifdef CONFIG_ARM_APPENDED_DTB
  197. /*
  198. * r0 = delta
  199. * r2 = BSS start
  200. * r3 = BSS end
  201. * r4 = final kernel address
  202. * r5 = appended dtb size (still unknown)
  203. * r6 = _edata
  204. * r7 = architecture ID
  205. * r8 = atags/device tree pointer
  206. * r9 = size of decompressed image
  207. * r10 = end of this image, including bss/stack/malloc space if non XIP
  208. * r11 = GOT start
  209. * r12 = GOT end
  210. * sp = stack pointer
  211. *
  212. * if there are device trees (dtb) appended to zImage, advance r10 so that the
  213. * dtb data will get relocated along with the kernel if necessary.
  214. */
  215. ldr lr, [r6, #0]
  216. #ifndef __ARMEB__
  217. ldr r1, =0xedfe0dd0 @ sig is 0xd00dfeed big endian
  218. #else
  219. ldr r1, =0xd00dfeed
  220. #endif
  221. cmp lr, r1
  222. bne dtb_check_done @ not found
  223. #ifdef CONFIG_ARM_ATAG_DTB_COMPAT
  224. /*
  225. * OK... Let's do some funky business here.
  226. * If we do have a DTB appended to zImage, and we do have
  227. * an ATAG list around, we want the later to be translated
  228. * and folded into the former here. To be on the safe side,
  229. * let's temporarily move the stack away into the malloc
  230. * area. No GOT fixup has occurred yet, but none of the
  231. * code we're about to call uses any global variable.
  232. */
  233. add sp, sp, #0x10000
  234. stmfd sp!, {r0-r3, ip, lr}
  235. mov r0, r8
  236. mov r1, r6
  237. sub r2, sp, r6
  238. bl atags_to_fdt
  239. /*
  240. * If returned value is 1, there is no ATAG at the location
  241. * pointed by r8. Try the typical 0x100 offset from start
  242. * of RAM and hope for the best.
  243. */
  244. cmp r0, #1
  245. sub r0, r4, #TEXT_OFFSET
  246. add r0, r0, #0x100
  247. mov r1, r6
  248. sub r2, sp, r6
  249. bleq atags_to_fdt
  250. ldmfd sp!, {r0-r3, ip, lr}
  251. sub sp, sp, #0x10000
  252. #endif
  253. mov r8, r6 @ use the appended device tree
  254. /*
  255. * Make sure that the DTB doesn't end up in the final
  256. * kernel's .bss area. To do so, we adjust the decompressed
  257. * kernel size to compensate if that .bss size is larger
  258. * than the relocated code.
  259. */
  260. ldr r5, =_kernel_bss_size
  261. adr r1, wont_overwrite
  262. sub r1, r6, r1
  263. subs r1, r5, r1
  264. addhi r9, r9, r1
  265. /* Get the dtb's size */
  266. ldr r5, [r6, #4]
  267. #ifndef __ARMEB__
  268. /* convert r5 (dtb size) to little endian */
  269. eor r1, r5, r5, ror #16
  270. bic r1, r1, #0x00ff0000
  271. mov r5, r5, ror #8
  272. eor r5, r5, r1, lsr #8
  273. #endif
  274. /* preserve 64-bit alignment */
  275. add r5, r5, #7
  276. bic r5, r5, #7
  277. /* relocate some pointers past the appended dtb */
  278. add r6, r6, r5
  279. add r10, r10, r5
  280. add sp, sp, r5
  281. dtb_check_done:
  282. #endif
  283. /*
  284. * Check to see if we will overwrite ourselves.
  285. * r4 = final kernel address
  286. * r9 = size of decompressed image
  287. * r10 = end of this image, including bss/stack/malloc space if non XIP
  288. * We basically want:
  289. * r4 - 16k page directory >= r10 -> OK
  290. * r4 + image length <= address of wont_overwrite -> OK
  291. */
  292. add r10, r10, #16384
  293. cmp r4, r10
  294. bhs wont_overwrite
  295. add r10, r4, r9
  296. adr r9, wont_overwrite
  297. cmp r10, r9
  298. bls wont_overwrite
  299. /*
  300. * Relocate ourselves past the end of the decompressed kernel.
  301. * r6 = _edata
  302. * r10 = end of the decompressed kernel
  303. * Because we always copy ahead, we need to do it from the end and go
  304. * backward in case the source and destination overlap.
  305. */
  306. /*
  307. * Bump to the next 256-byte boundary with the size of
  308. * the relocation code added. This avoids overwriting
  309. * ourself when the offset is small.
  310. */
  311. add r10, r10, #((reloc_code_end - restart + 256) & ~255)
  312. bic r10, r10, #255
  313. /* Get start of code we want to copy and align it down. */
  314. adr r5, restart
  315. bic r5, r5, #31
  316. sub r9, r6, r5 @ size to copy
  317. add r9, r9, #31 @ rounded up to a multiple
  318. bic r9, r9, #31 @ ... of 32 bytes
  319. add r6, r9, r5
  320. add r9, r9, r10
  321. 1: ldmdb r6!, {r0 - r3, r10 - r12, lr}
  322. cmp r6, r5
  323. stmdb r9!, {r0 - r3, r10 - r12, lr}
  324. bhi 1b
  325. /* Preserve offset to relocated code. */
  326. sub r6, r9, r6
  327. #ifndef CONFIG_ZBOOT_ROM
  328. /* cache_clean_flush may use the stack, so relocate it */
  329. add sp, sp, r6
  330. #endif
  331. bl cache_clean_flush
  332. adr r0, BSYM(restart)
  333. add r0, r0, r6
  334. mov pc, r0
  335. wont_overwrite:
  336. /*
  337. * If delta is zero, we are running at the address we were linked at.
  338. * r0 = delta
  339. * r2 = BSS start
  340. * r3 = BSS end
  341. * r4 = kernel execution address
  342. * r5 = appended dtb size (0 if not present)
  343. * r7 = architecture ID
  344. * r8 = atags pointer
  345. * r11 = GOT start
  346. * r12 = GOT end
  347. * sp = stack pointer
  348. */
  349. orrs r1, r0, r5
  350. beq not_relocated
  351. add r11, r11, r0
  352. add r12, r12, r0
  353. #ifndef CONFIG_ZBOOT_ROM
  354. /*
  355. * If we're running fully PIC === CONFIG_ZBOOT_ROM = n,
  356. * we need to fix up pointers into the BSS region.
  357. * Note that the stack pointer has already been fixed up.
  358. */
  359. add r2, r2, r0
  360. add r3, r3, r0
  361. /*
  362. * Relocate all entries in the GOT table.
  363. * Bump bss entries to _edata + dtb size
  364. */
  365. 1: ldr r1, [r11, #0] @ relocate entries in the GOT
  366. add r1, r1, r0 @ This fixes up C references
  367. cmp r1, r2 @ if entry >= bss_start &&
  368. cmphs r3, r1 @ bss_end > entry
  369. addhi r1, r1, r5 @ entry += dtb size
  370. str r1, [r11], #4 @ next entry
  371. cmp r11, r12
  372. blo 1b
  373. /* bump our bss pointers too */
  374. add r2, r2, r5
  375. add r3, r3, r5
  376. #else
  377. /*
  378. * Relocate entries in the GOT table. We only relocate
  379. * the entries that are outside the (relocated) BSS region.
  380. */
  381. 1: ldr r1, [r11, #0] @ relocate entries in the GOT
  382. cmp r1, r2 @ entry < bss_start ||
  383. cmphs r3, r1 @ _end < entry
  384. addlo r1, r1, r0 @ table. This fixes up the
  385. str r1, [r11], #4 @ C references.
  386. cmp r11, r12
  387. blo 1b
  388. #endif
  389. not_relocated: mov r0, #0
  390. 1: str r0, [r2], #4 @ clear bss
  391. str r0, [r2], #4
  392. str r0, [r2], #4
  393. str r0, [r2], #4
  394. cmp r2, r3
  395. blo 1b
  396. /*
  397. * The C runtime environment should now be setup sufficiently.
  398. * Set up some pointers, and start decompressing.
  399. * r4 = kernel execution address
  400. * r7 = architecture ID
  401. * r8 = atags pointer
  402. */
  403. mov r0, r4
  404. mov r1, sp @ malloc space above stack
  405. add r2, sp, #0x10000 @ 64k max
  406. mov r3, r7
  407. bl decompress_kernel
  408. bl cache_clean_flush
  409. bl cache_off
  410. mov r0, #0 @ must be zero
  411. mov r1, r7 @ restore architecture number
  412. mov r2, r8 @ restore atags pointer
  413. ARM( mov pc, r4 ) @ call kernel
  414. THUMB( bx r4 ) @ entry point is always ARM
  415. .align 2
  416. .type LC0, #object
  417. LC0: .word LC0 @ r1
  418. .word __bss_start @ r2
  419. .word _end @ r3
  420. .word _edata @ r6
  421. .word input_data_end - 4 @ r10 (inflated size location)
  422. .word _got_start @ r11
  423. .word _got_end @ ip
  424. .word .L_user_stack_end @ sp
  425. .size LC0, . - LC0
  426. #ifdef CONFIG_ARCH_RPC
  427. .globl params
  428. params: ldr r0, =0x10000100 @ params_phys for RPC
  429. mov pc, lr
  430. .ltorg
  431. .align
  432. #endif
  433. /*
  434. * Turn on the cache. We need to setup some page tables so that we
  435. * can have both the I and D caches on.
  436. *
  437. * We place the page tables 16k down from the kernel execution address,
  438. * and we hope that nothing else is using it. If we're using it, we
  439. * will go pop!
  440. *
  441. * On entry,
  442. * r4 = kernel execution address
  443. * r7 = architecture number
  444. * r8 = atags pointer
  445. * On exit,
  446. * r0, r1, r2, r3, r9, r10, r12 corrupted
  447. * This routine must preserve:
  448. * r4, r7, r8
  449. */
  450. .align 5
  451. cache_on: mov r3, #8 @ cache_on function
  452. b call_cache_fn
  453. /*
  454. * Initialize the highest priority protection region, PR7
  455. * to cover all 32bit address and cacheable and bufferable.
  456. */
  457. __armv4_mpu_cache_on:
  458. mov r0, #0x3f @ 4G, the whole
  459. mcr p15, 0, r0, c6, c7, 0 @ PR7 Area Setting
  460. mcr p15, 0, r0, c6, c7, 1
  461. mov r0, #0x80 @ PR7
  462. mcr p15, 0, r0, c2, c0, 0 @ D-cache on
  463. mcr p15, 0, r0, c2, c0, 1 @ I-cache on
  464. mcr p15, 0, r0, c3, c0, 0 @ write-buffer on
  465. mov r0, #0xc000
  466. mcr p15, 0, r0, c5, c0, 1 @ I-access permission
  467. mcr p15, 0, r0, c5, c0, 0 @ D-access permission
  468. mov r0, #0
  469. mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
  470. mcr p15, 0, r0, c7, c5, 0 @ flush(inval) I-Cache
  471. mcr p15, 0, r0, c7, c6, 0 @ flush(inval) D-Cache
  472. mrc p15, 0, r0, c1, c0, 0 @ read control reg
  473. @ ...I .... ..D. WC.M
  474. orr r0, r0, #0x002d @ .... .... ..1. 11.1
  475. orr r0, r0, #0x1000 @ ...1 .... .... ....
  476. mcr p15, 0, r0, c1, c0, 0 @ write control reg
  477. mov r0, #0
  478. mcr p15, 0, r0, c7, c5, 0 @ flush(inval) I-Cache
  479. mcr p15, 0, r0, c7, c6, 0 @ flush(inval) D-Cache
  480. mov pc, lr
  481. __armv3_mpu_cache_on:
  482. mov r0, #0x3f @ 4G, the whole
  483. mcr p15, 0, r0, c6, c7, 0 @ PR7 Area Setting
  484. mov r0, #0x80 @ PR7
  485. mcr p15, 0, r0, c2, c0, 0 @ cache on
  486. mcr p15, 0, r0, c3, c0, 0 @ write-buffer on
  487. mov r0, #0xc000
  488. mcr p15, 0, r0, c5, c0, 0 @ access permission
  489. mov r0, #0
  490. mcr p15, 0, r0, c7, c0, 0 @ invalidate whole cache v3
  491. /*
  492. * ?? ARMv3 MMU does not allow reading the control register,
  493. * does this really work on ARMv3 MPU?
  494. */
  495. mrc p15, 0, r0, c1, c0, 0 @ read control reg
  496. @ .... .... .... WC.M
  497. orr r0, r0, #0x000d @ .... .... .... 11.1
  498. /* ?? this overwrites the value constructed above? */
  499. mov r0, #0
  500. mcr p15, 0, r0, c1, c0, 0 @ write control reg
  501. /* ?? invalidate for the second time? */
  502. mcr p15, 0, r0, c7, c0, 0 @ invalidate whole cache v3
  503. mov pc, lr
  504. #ifdef CONFIG_CPU_DCACHE_WRITETHROUGH
  505. #define CB_BITS 0x08
  506. #else
  507. #define CB_BITS 0x0c
  508. #endif
  509. __setup_mmu: sub r3, r4, #16384 @ Page directory size
  510. bic r3, r3, #0xff @ Align the pointer
  511. bic r3, r3, #0x3f00
  512. /*
  513. * Initialise the page tables, turning on the cacheable and bufferable
  514. * bits for the RAM area only.
  515. */
  516. mov r0, r3
  517. mov r9, r0, lsr #18
  518. mov r9, r9, lsl #18 @ start of RAM
  519. add r10, r9, #0x10000000 @ a reasonable RAM size
  520. mov r1, #0x12 @ XN|U + section mapping
  521. orr r1, r1, #3 << 10 @ AP=11
  522. add r2, r3, #16384
  523. 1: cmp r1, r9 @ if virt > start of RAM
  524. cmphs r10, r1 @ && end of RAM > virt
  525. bic r1, r1, #0x1c @ clear XN|U + C + B
  526. orrlo r1, r1, #0x10 @ Set XN|U for non-RAM
  527. orrhs r1, r1, r6 @ set RAM section settings
  528. str r1, [r0], #4 @ 1:1 mapping
  529. add r1, r1, #1048576
  530. teq r0, r2
  531. bne 1b
  532. /*
  533. * If ever we are running from Flash, then we surely want the cache
  534. * to be enabled also for our execution instance... We map 2MB of it
  535. * so there is no map overlap problem for up to 1 MB compressed kernel.
  536. * If the execution is in RAM then we would only be duplicating the above.
  537. */
  538. orr r1, r6, #0x04 @ ensure B is set for this
  539. orr r1, r1, #3 << 10
  540. mov r2, pc
  541. mov r2, r2, lsr #20
  542. orr r1, r1, r2, lsl #20
  543. add r0, r3, r2, lsl #2
  544. str r1, [r0], #4
  545. add r1, r1, #1048576
  546. str r1, [r0]
  547. mov pc, lr
  548. ENDPROC(__setup_mmu)
  549. __arm926ejs_mmu_cache_on:
  550. #ifdef CONFIG_CPU_DCACHE_WRITETHROUGH
  551. mov r0, #4 @ put dcache in WT mode
  552. mcr p15, 7, r0, c15, c0, 0
  553. #endif
  554. __armv4_mmu_cache_on:
  555. mov r12, lr
  556. #ifdef CONFIG_MMU
  557. mov r6, #CB_BITS | 0x12 @ U
  558. bl __setup_mmu
  559. mov r0, #0
  560. mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
  561. mcr p15, 0, r0, c8, c7, 0 @ flush I,D TLBs
  562. mrc p15, 0, r0, c1, c0, 0 @ read control reg
  563. orr r0, r0, #0x5000 @ I-cache enable, RR cache replacement
  564. orr r0, r0, #0x0030
  565. #ifdef CONFIG_CPU_ENDIAN_BE8
  566. orr r0, r0, #1 << 25 @ big-endian page tables
  567. #endif
  568. bl __common_mmu_cache_on
  569. mov r0, #0
  570. mcr p15, 0, r0, c8, c7, 0 @ flush I,D TLBs
  571. #endif
  572. mov pc, r12
  573. __armv7_mmu_cache_on:
  574. mov r12, lr
  575. #ifdef CONFIG_MMU
  576. mrc p15, 0, r11, c0, c1, 4 @ read ID_MMFR0
  577. tst r11, #0xf @ VMSA
  578. movne r6, #CB_BITS | 0x02 @ !XN
  579. blne __setup_mmu
  580. mov r0, #0
  581. mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
  582. tst r11, #0xf @ VMSA
  583. mcrne p15, 0, r0, c8, c7, 0 @ flush I,D TLBs
  584. #endif
  585. mrc p15, 0, r0, c1, c0, 0 @ read control reg
  586. orr r0, r0, #0x5000 @ I-cache enable, RR cache replacement
  587. orr r0, r0, #0x003c @ write buffer
  588. #ifdef CONFIG_MMU
  589. #ifdef CONFIG_CPU_ENDIAN_BE8
  590. orr r0, r0, #1 << 25 @ big-endian page tables
  591. #endif
  592. mrcne p15, 0, r6, c2, c0, 2 @ read ttb control reg
  593. orrne r0, r0, #1 @ MMU enabled
  594. movne r1, #0xfffffffd @ domain 0 = client
  595. bic r6, r6, #1 << 31 @ 32-bit translation system
  596. bic r6, r6, #3 << 0 @ use only ttbr0
  597. mcrne p15, 0, r3, c2, c0, 0 @ load page table pointer
  598. mcrne p15, 0, r1, c3, c0, 0 @ load domain access control
  599. mcrne p15, 0, r6, c2, c0, 2 @ load ttb control
  600. #endif
  601. mcr p15, 0, r0, c7, c5, 4 @ ISB
  602. mcr p15, 0, r0, c1, c0, 0 @ load control register
  603. mrc p15, 0, r0, c1, c0, 0 @ and read it back
  604. mov r0, #0
  605. mcr p15, 0, r0, c7, c5, 4 @ ISB
  606. mov pc, r12
  607. __fa526_cache_on:
  608. mov r12, lr
  609. mov r6, #CB_BITS | 0x12 @ U
  610. bl __setup_mmu
  611. mov r0, #0
  612. mcr p15, 0, r0, c7, c7, 0 @ Invalidate whole cache
  613. mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
  614. mcr p15, 0, r0, c8, c7, 0 @ flush UTLB
  615. mrc p15, 0, r0, c1, c0, 0 @ read control reg
  616. orr r0, r0, #0x1000 @ I-cache enable
  617. bl __common_mmu_cache_on
  618. mov r0, #0
  619. mcr p15, 0, r0, c8, c7, 0 @ flush UTLB
  620. mov pc, r12
  621. __common_mmu_cache_on:
  622. #ifndef CONFIG_THUMB2_KERNEL
  623. #ifndef DEBUG
  624. orr r0, r0, #0x000d @ Write buffer, mmu
  625. #endif
  626. mov r1, #-1
  627. mcr p15, 0, r3, c2, c0, 0 @ load page table pointer
  628. mcr p15, 0, r1, c3, c0, 0 @ load domain access control
  629. b 1f
  630. .align 5 @ cache line aligned
  631. 1: mcr p15, 0, r0, c1, c0, 0 @ load control register
  632. mrc p15, 0, r0, c1, c0, 0 @ and read it back to
  633. sub pc, lr, r0, lsr #32 @ properly flush pipeline
  634. #endif
  635. #define PROC_ENTRY_SIZE (4*5)
  636. /*
  637. * Here follow the relocatable cache support functions for the
  638. * various processors. This is a generic hook for locating an
  639. * entry and jumping to an instruction at the specified offset
  640. * from the start of the block. Please note this is all position
  641. * independent code.
  642. *
  643. * r1 = corrupted
  644. * r2 = corrupted
  645. * r3 = block offset
  646. * r9 = corrupted
  647. * r12 = corrupted
  648. */
  649. call_cache_fn: adr r12, proc_types
  650. #ifdef CONFIG_CPU_CP15
  651. mrc p15, 0, r9, c0, c0 @ get processor ID
  652. #else
  653. ldr r9, =CONFIG_PROCESSOR_ID
  654. #endif
  655. 1: ldr r1, [r12, #0] @ get value
  656. ldr r2, [r12, #4] @ get mask
  657. eor r1, r1, r9 @ (real ^ match)
  658. tst r1, r2 @ & mask
  659. ARM( addeq pc, r12, r3 ) @ call cache function
  660. THUMB( addeq r12, r3 )
  661. THUMB( moveq pc, r12 ) @ call cache function
  662. add r12, r12, #PROC_ENTRY_SIZE
  663. b 1b
  664. /*
  665. * Table for cache operations. This is basically:
  666. * - CPU ID match
  667. * - CPU ID mask
  668. * - 'cache on' method instruction
  669. * - 'cache off' method instruction
  670. * - 'cache flush' method instruction
  671. *
  672. * We match an entry using: ((real_id ^ match) & mask) == 0
  673. *
  674. * Writethrough caches generally only need 'on' and 'off'
  675. * methods. Writeback caches _must_ have the flush method
  676. * defined.
  677. */
  678. .align 2
  679. .type proc_types,#object
  680. proc_types:
  681. .word 0x00000000 @ old ARM ID
  682. .word 0x0000f000
  683. mov pc, lr
  684. THUMB( nop )
  685. mov pc, lr
  686. THUMB( nop )
  687. mov pc, lr
  688. THUMB( nop )
  689. .word 0x41007000 @ ARM7/710
  690. .word 0xfff8fe00
  691. mov pc, lr
  692. THUMB( nop )
  693. mov pc, lr
  694. THUMB( nop )
  695. mov pc, lr
  696. THUMB( nop )
  697. .word 0x41807200 @ ARM720T (writethrough)
  698. .word 0xffffff00
  699. W(b) __armv4_mmu_cache_on
  700. W(b) __armv4_mmu_cache_off
  701. mov pc, lr
  702. THUMB( nop )
  703. .word 0x41007400 @ ARM74x
  704. .word 0xff00ff00
  705. W(b) __armv3_mpu_cache_on
  706. W(b) __armv3_mpu_cache_off
  707. W(b) __armv3_mpu_cache_flush
  708. .word 0x41009400 @ ARM94x
  709. .word 0xff00ff00
  710. W(b) __armv4_mpu_cache_on
  711. W(b) __armv4_mpu_cache_off
  712. W(b) __armv4_mpu_cache_flush
  713. .word 0x41069260 @ ARM926EJ-S (v5TEJ)
  714. .word 0xff0ffff0
  715. W(b) __arm926ejs_mmu_cache_on
  716. W(b) __armv4_mmu_cache_off
  717. W(b) __armv5tej_mmu_cache_flush
  718. .word 0x00007000 @ ARM7 IDs
  719. .word 0x0000f000
  720. mov pc, lr
  721. THUMB( nop )
  722. mov pc, lr
  723. THUMB( nop )
  724. mov pc, lr
  725. THUMB( nop )
  726. @ Everything from here on will be the new ID system.
  727. .word 0x4401a100 @ sa110 / sa1100
  728. .word 0xffffffe0
  729. W(b) __armv4_mmu_cache_on
  730. W(b) __armv4_mmu_cache_off
  731. W(b) __armv4_mmu_cache_flush
  732. .word 0x6901b110 @ sa1110
  733. .word 0xfffffff0
  734. W(b) __armv4_mmu_cache_on
  735. W(b) __armv4_mmu_cache_off
  736. W(b) __armv4_mmu_cache_flush
  737. .word 0x56056900
  738. .word 0xffffff00 @ PXA9xx
  739. W(b) __armv4_mmu_cache_on
  740. W(b) __armv4_mmu_cache_off
  741. W(b) __armv4_mmu_cache_flush
  742. .word 0x56158000 @ PXA168
  743. .word 0xfffff000
  744. W(b) __armv4_mmu_cache_on
  745. W(b) __armv4_mmu_cache_off
  746. W(b) __armv5tej_mmu_cache_flush
  747. .word 0x56050000 @ Feroceon
  748. .word 0xff0f0000
  749. W(b) __armv4_mmu_cache_on
  750. W(b) __armv4_mmu_cache_off
  751. W(b) __armv5tej_mmu_cache_flush
  752. #ifdef CONFIG_CPU_FEROCEON_OLD_ID
  753. /* this conflicts with the standard ARMv5TE entry */
  754. .long 0x41009260 @ Old Feroceon
  755. .long 0xff00fff0
  756. b __armv4_mmu_cache_on
  757. b __armv4_mmu_cache_off
  758. b __armv5tej_mmu_cache_flush
  759. #endif
  760. .word 0x66015261 @ FA526
  761. .word 0xff01fff1
  762. W(b) __fa526_cache_on
  763. W(b) __armv4_mmu_cache_off
  764. W(b) __fa526_cache_flush
  765. @ These match on the architecture ID
  766. .word 0x00020000 @ ARMv4T
  767. .word 0x000f0000
  768. W(b) __armv4_mmu_cache_on
  769. W(b) __armv4_mmu_cache_off
  770. W(b) __armv4_mmu_cache_flush
  771. .word 0x00050000 @ ARMv5TE
  772. .word 0x000f0000
  773. W(b) __armv4_mmu_cache_on
  774. W(b) __armv4_mmu_cache_off
  775. W(b) __armv4_mmu_cache_flush
  776. .word 0x00060000 @ ARMv5TEJ
  777. .word 0x000f0000
  778. W(b) __armv4_mmu_cache_on
  779. W(b) __armv4_mmu_cache_off
  780. W(b) __armv5tej_mmu_cache_flush
  781. .word 0x0007b000 @ ARMv6
  782. .word 0x000ff000
  783. W(b) __armv4_mmu_cache_on
  784. W(b) __armv4_mmu_cache_off
  785. W(b) __armv6_mmu_cache_flush
  786. .word 0x000f0000 @ new CPU Id
  787. .word 0x000f0000
  788. W(b) __armv7_mmu_cache_on
  789. W(b) __armv7_mmu_cache_off
  790. W(b) __armv7_mmu_cache_flush
  791. .word 0 @ unrecognised type
  792. .word 0
  793. mov pc, lr
  794. THUMB( nop )
  795. mov pc, lr
  796. THUMB( nop )
  797. mov pc, lr
  798. THUMB( nop )
  799. .size proc_types, . - proc_types
  800. /*
  801. * If you get a "non-constant expression in ".if" statement"
  802. * error from the assembler on this line, check that you have
  803. * not accidentally written a "b" instruction where you should
  804. * have written W(b).
  805. */
  806. .if (. - proc_types) % PROC_ENTRY_SIZE != 0
  807. .error "The size of one or more proc_types entries is wrong."
  808. .endif
  809. /*
  810. * Turn off the Cache and MMU. ARMv3 does not support
  811. * reading the control register, but ARMv4 does.
  812. *
  813. * On exit,
  814. * r0, r1, r2, r3, r9, r12 corrupted
  815. * This routine must preserve:
  816. * r4, r7, r8
  817. */
  818. .align 5
  819. cache_off: mov r3, #12 @ cache_off function
  820. b call_cache_fn
  821. __armv4_mpu_cache_off:
  822. mrc p15, 0, r0, c1, c0
  823. bic r0, r0, #0x000d
  824. mcr p15, 0, r0, c1, c0 @ turn MPU and cache off
  825. mov r0, #0
  826. mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
  827. mcr p15, 0, r0, c7, c6, 0 @ flush D-Cache
  828. mcr p15, 0, r0, c7, c5, 0 @ flush I-Cache
  829. mov pc, lr
  830. __armv3_mpu_cache_off:
  831. mrc p15, 0, r0, c1, c0
  832. bic r0, r0, #0x000d
  833. mcr p15, 0, r0, c1, c0, 0 @ turn MPU and cache off
  834. mov r0, #0
  835. mcr p15, 0, r0, c7, c0, 0 @ invalidate whole cache v3
  836. mov pc, lr
  837. __armv4_mmu_cache_off:
  838. #ifdef CONFIG_MMU
  839. mrc p15, 0, r0, c1, c0
  840. bic r0, r0, #0x000d
  841. mcr p15, 0, r0, c1, c0 @ turn MMU and cache off
  842. mov r0, #0
  843. mcr p15, 0, r0, c7, c7 @ invalidate whole cache v4
  844. mcr p15, 0, r0, c8, c7 @ invalidate whole TLB v4
  845. #endif
  846. mov pc, lr
  847. __armv7_mmu_cache_off:
  848. mrc p15, 0, r0, c1, c0
  849. #ifdef CONFIG_MMU
  850. bic r0, r0, #0x000d
  851. #else
  852. bic r0, r0, #0x000c
  853. #endif
  854. mcr p15, 0, r0, c1, c0 @ turn MMU and cache off
  855. mov r12, lr
  856. bl __armv7_mmu_cache_flush
  857. mov r0, #0
  858. #ifdef CONFIG_MMU
  859. mcr p15, 0, r0, c8, c7, 0 @ invalidate whole TLB
  860. #endif
  861. mcr p15, 0, r0, c7, c5, 6 @ invalidate BTC
  862. mcr p15, 0, r0, c7, c10, 4 @ DSB
  863. mcr p15, 0, r0, c7, c5, 4 @ ISB
  864. mov pc, r12
  865. /*
  866. * Clean and flush the cache to maintain consistency.
  867. *
  868. * On exit,
  869. * r1, r2, r3, r9, r10, r11, r12 corrupted
  870. * This routine must preserve:
  871. * r4, r6, r7, r8
  872. */
  873. .align 5
  874. cache_clean_flush:
  875. mov r3, #16
  876. b call_cache_fn
  877. __armv4_mpu_cache_flush:
  878. mov r2, #1
  879. mov r3, #0
  880. mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache
  881. mov r1, #7 << 5 @ 8 segments
  882. 1: orr r3, r1, #63 << 26 @ 64 entries
  883. 2: mcr p15, 0, r3, c7, c14, 2 @ clean & invalidate D index
  884. subs r3, r3, #1 << 26
  885. bcs 2b @ entries 63 to 0
  886. subs r1, r1, #1 << 5
  887. bcs 1b @ segments 7 to 0
  888. teq r2, #0
  889. mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache
  890. mcr p15, 0, ip, c7, c10, 4 @ drain WB
  891. mov pc, lr
  892. __fa526_cache_flush:
  893. mov r1, #0
  894. mcr p15, 0, r1, c7, c14, 0 @ clean and invalidate D cache
  895. mcr p15, 0, r1, c7, c5, 0 @ flush I cache
  896. mcr p15, 0, r1, c7, c10, 4 @ drain WB
  897. mov pc, lr
  898. __armv6_mmu_cache_flush:
  899. mov r1, #0
  900. mcr p15, 0, r1, c7, c14, 0 @ clean+invalidate D
  901. mcr p15, 0, r1, c7, c5, 0 @ invalidate I+BTB
  902. mcr p15, 0, r1, c7, c15, 0 @ clean+invalidate unified
  903. mcr p15, 0, r1, c7, c10, 4 @ drain WB
  904. mov pc, lr
  905. __armv7_mmu_cache_flush:
  906. mrc p15, 0, r10, c0, c1, 5 @ read ID_MMFR1
  907. tst r10, #0xf << 16 @ hierarchical cache (ARMv7)
  908. mov r10, #0
  909. beq hierarchical
  910. mcr p15, 0, r10, c7, c14, 0 @ clean+invalidate D
  911. b iflush
  912. hierarchical:
  913. mcr p15, 0, r10, c7, c10, 5 @ DMB
  914. stmfd sp!, {r0-r7, r9-r11}
  915. mrc p15, 1, r0, c0, c0, 1 @ read clidr
  916. ands r3, r0, #0x7000000 @ extract loc from clidr
  917. mov r3, r3, lsr #23 @ left align loc bit field
  918. beq finished @ if loc is 0, then no need to clean
  919. mov r10, #0 @ start clean at cache level 0
  920. loop1:
  921. add r2, r10, r10, lsr #1 @ work out 3x current cache level
  922. mov r1, r0, lsr r2 @ extract cache type bits from clidr
  923. and r1, r1, #7 @ mask of the bits for current cache only
  924. cmp r1, #2 @ see what cache we have at this level
  925. blt skip @ skip if no cache, or just i-cache
  926. mcr p15, 2, r10, c0, c0, 0 @ select current cache level in cssr
  927. mcr p15, 0, r10, c7, c5, 4 @ isb to sych the new cssr&csidr
  928. mrc p15, 1, r1, c0, c0, 0 @ read the new csidr
  929. and r2, r1, #7 @ extract the length of the cache lines
  930. add r2, r2, #4 @ add 4 (line length offset)
  931. ldr r4, =0x3ff
  932. ands r4, r4, r1, lsr #3 @ find maximum number on the way size
  933. clz r5, r4 @ find bit position of way size increment
  934. ldr r7, =0x7fff
  935. ands r7, r7, r1, lsr #13 @ extract max number of the index size
  936. loop2:
  937. mov r9, r4 @ create working copy of max way size
  938. loop3:
  939. ARM( orr r11, r10, r9, lsl r5 ) @ factor way and cache number into r11
  940. ARM( orr r11, r11, r7, lsl r2 ) @ factor index number into r11
  941. THUMB( lsl r6, r9, r5 )
  942. THUMB( orr r11, r10, r6 ) @ factor way and cache number into r11
  943. THUMB( lsl r6, r7, r2 )
  944. THUMB( orr r11, r11, r6 ) @ factor index number into r11
  945. mcr p15, 0, r11, c7, c14, 2 @ clean & invalidate by set/way
  946. subs r9, r9, #1 @ decrement the way
  947. bge loop3
  948. subs r7, r7, #1 @ decrement the index
  949. bge loop2
  950. skip:
  951. add r10, r10, #2 @ increment cache number
  952. cmp r3, r10
  953. bgt loop1
  954. finished:
  955. ldmfd sp!, {r0-r7, r9-r11}
  956. mov r10, #0 @ swith back to cache level 0
  957. mcr p15, 2, r10, c0, c0, 0 @ select current cache level in cssr
  958. iflush:
  959. mcr p15, 0, r10, c7, c10, 4 @ DSB
  960. mcr p15, 0, r10, c7, c5, 0 @ invalidate I+BTB
  961. mcr p15, 0, r10, c7, c10, 4 @ DSB
  962. mcr p15, 0, r10, c7, c5, 4 @ ISB
  963. mov pc, lr
  964. __armv5tej_mmu_cache_flush:
  965. 1: mrc p15, 0, r15, c7, c14, 3 @ test,clean,invalidate D cache
  966. bne 1b
  967. mcr p15, 0, r0, c7, c5, 0 @ flush I cache
  968. mcr p15, 0, r0, c7, c10, 4 @ drain WB
  969. mov pc, lr
  970. __armv4_mmu_cache_flush:
  971. mov r2, #64*1024 @ default: 32K dcache size (*2)
  972. mov r11, #32 @ default: 32 byte line size
  973. mrc p15, 0, r3, c0, c0, 1 @ read cache type
  974. teq r3, r9 @ cache ID register present?
  975. beq no_cache_id
  976. mov r1, r3, lsr #18
  977. and r1, r1, #7
  978. mov r2, #1024
  979. mov r2, r2, lsl r1 @ base dcache size *2
  980. tst r3, #1 << 14 @ test M bit
  981. addne r2, r2, r2, lsr #1 @ +1/2 size if M == 1
  982. mov r3, r3, lsr #12
  983. and r3, r3, #3
  984. mov r11, #8
  985. mov r11, r11, lsl r3 @ cache line size in bytes
  986. no_cache_id:
  987. mov r1, pc
  988. bic r1, r1, #63 @ align to longest cache line
  989. add r2, r1, r2
  990. 1:
  991. ARM( ldr r3, [r1], r11 ) @ s/w flush D cache
  992. THUMB( ldr r3, [r1] ) @ s/w flush D cache
  993. THUMB( add r1, r1, r11 )
  994. teq r1, r2
  995. bne 1b
  996. mcr p15, 0, r1, c7, c5, 0 @ flush I cache
  997. mcr p15, 0, r1, c7, c6, 0 @ flush D cache
  998. mcr p15, 0, r1, c7, c10, 4 @ drain WB
  999. mov pc, lr
  1000. __armv3_mmu_cache_flush:
  1001. __armv3_mpu_cache_flush:
  1002. mov r1, #0
  1003. mcr p15, 0, r1, c7, c0, 0 @ invalidate whole cache v3
  1004. mov pc, lr
  1005. /*
  1006. * Various debugging routines for printing hex characters and
  1007. * memory, which again must be relocatable.
  1008. */
  1009. #ifdef DEBUG
  1010. .align 2
  1011. .type phexbuf,#object
  1012. phexbuf: .space 12
  1013. .size phexbuf, . - phexbuf
  1014. @ phex corrupts {r0, r1, r2, r3}
  1015. phex: adr r3, phexbuf
  1016. mov r2, #0
  1017. strb r2, [r3, r1]
  1018. 1: subs r1, r1, #1
  1019. movmi r0, r3
  1020. bmi puts
  1021. and r2, r0, #15
  1022. mov r0, r0, lsr #4
  1023. cmp r2, #10
  1024. addge r2, r2, #7
  1025. add r2, r2, #'0'
  1026. strb r2, [r3, r1]
  1027. b 1b
  1028. @ puts corrupts {r0, r1, r2, r3}
  1029. puts: loadsp r3, r1
  1030. 1: ldrb r2, [r0], #1
  1031. teq r2, #0
  1032. moveq pc, lr
  1033. 2: writeb r2, r3
  1034. mov r1, #0x00020000
  1035. 3: subs r1, r1, #1
  1036. bne 3b
  1037. teq r2, #'\n'
  1038. moveq r2, #'\r'
  1039. beq 2b
  1040. teq r0, #0
  1041. bne 1b
  1042. mov pc, lr
  1043. @ putc corrupts {r0, r1, r2, r3}
  1044. putc:
  1045. mov r2, r0
  1046. mov r0, #0
  1047. loadsp r3, r1
  1048. b 2b
  1049. @ memdump corrupts {r0, r1, r2, r3, r10, r11, r12, lr}
  1050. memdump: mov r12, r0
  1051. mov r10, lr
  1052. mov r11, #0
  1053. 2: mov r0, r11, lsl #2
  1054. add r0, r0, r12
  1055. mov r1, #8
  1056. bl phex
  1057. mov r0, #':'
  1058. bl putc
  1059. 1: mov r0, #' '
  1060. bl putc
  1061. ldr r0, [r12, r11, lsl #2]
  1062. mov r1, #8
  1063. bl phex
  1064. and r0, r11, #7
  1065. teq r0, #3
  1066. moveq r0, #' '
  1067. bleq putc
  1068. and r0, r11, #7
  1069. add r11, r11, #1
  1070. teq r0, #7
  1071. bne 1b
  1072. mov r0, #'\n'
  1073. bl putc
  1074. cmp r11, #64
  1075. blt 2b
  1076. mov pc, r10
  1077. #endif
  1078. .ltorg
  1079. reloc_code_end:
  1080. .align
  1081. .section ".stack", "aw", %nobits
  1082. .L_user_stack: .space 4096
  1083. .L_user_stack_end: