head.S 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. /*
  2. * linux/arch/arm/kernel/head.S
  3. *
  4. * Copyright (C) 1994-2002 Russell King
  5. * Copyright (c) 2003 ARM Limited
  6. * All Rights Reserved
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. * Kernel startup code for all 32-bit CPUs
  13. */
  14. #include <linux/linkage.h>
  15. #include <linux/init.h>
  16. #include <asm/assembler.h>
  17. #include <asm/cp15.h>
  18. #include <asm/domain.h>
  19. #include <asm/ptrace.h>
  20. #include <asm/asm-offsets.h>
  21. #include <asm/memory.h>
  22. #include <asm/thread_info.h>
  23. #include <asm/pgtable.h>
  24. #ifdef CONFIG_DEBUG_LL
  25. #include <mach/debug-macro.S>
  26. #endif
  27. /*
  28. * swapper_pg_dir is the virtual address of the initial page table.
  29. * We place the page tables 16K below KERNEL_RAM_VADDR. Therefore, we must
  30. * make sure that KERNEL_RAM_VADDR is correctly set. Currently, we expect
  31. * the least significant 16 bits to be 0x8000, but we could probably
  32. * relax this restriction to KERNEL_RAM_VADDR >= PAGE_OFFSET + 0x4000.
  33. */
  34. #define KERNEL_RAM_VADDR (PAGE_OFFSET + TEXT_OFFSET)
  35. #if (KERNEL_RAM_VADDR & 0xffff) != 0x8000
  36. #error KERNEL_RAM_VADDR must start at 0xXXXX8000
  37. #endif
  38. #ifdef CONFIG_ARM_LPAE
  39. /* LPAE requires an additional page for the PGD */
  40. #define PG_DIR_SIZE 0x5000
  41. #define PMD_ORDER 3
  42. #else
  43. #define PG_DIR_SIZE 0x4000
  44. #define PMD_ORDER 2
  45. #endif
  46. .globl swapper_pg_dir
  47. .equ swapper_pg_dir, KERNEL_RAM_VADDR - PG_DIR_SIZE
  48. .macro pgtbl, rd, phys
  49. add \rd, \phys, #TEXT_OFFSET - PG_DIR_SIZE
  50. .endm
  51. /*
  52. * Kernel startup entry point.
  53. * ---------------------------
  54. *
  55. * This is normally called from the decompressor code. The requirements
  56. * are: MMU = off, D-cache = off, I-cache = dont care, r0 = 0,
  57. * r1 = machine nr, r2 = atags or dtb pointer.
  58. *
  59. * This code is mostly position independent, so if you link the kernel at
  60. * 0xc0008000, you call this at __pa(0xc0008000).
  61. *
  62. * See linux/arch/arm/tools/mach-types for the complete list of machine
  63. * numbers for r1.
  64. *
  65. * We're trying to keep crap to a minimum; DO NOT add any machine specific
  66. * crap here - that's what the boot loader (or in extreme, well justified
  67. * circumstances, zImage) is for.
  68. */
  69. .arm
  70. __HEAD
  71. ENTRY(stext)
  72. THUMB( adr r9, BSYM(1f) ) @ Kernel is always entered in ARM.
  73. THUMB( bx r9 ) @ If this is a Thumb-2 kernel,
  74. THUMB( .thumb ) @ switch to Thumb now.
  75. THUMB(1: )
  76. setmode PSR_F_BIT | PSR_I_BIT | SVC_MODE, r9 @ ensure svc mode
  77. @ and irqs disabled
  78. mrc p15, 0, r9, c0, c0 @ get processor id
  79. bl __lookup_processor_type @ r5=procinfo r9=cpuid
  80. movs r10, r5 @ invalid processor (r5=0)?
  81. THUMB( it eq ) @ force fixup-able long branch encoding
  82. beq __error_p @ yes, error 'p'
  83. #ifdef CONFIG_ARM_LPAE
  84. mrc p15, 0, r3, c0, c1, 4 @ read ID_MMFR0
  85. and r3, r3, #0xf @ extract VMSA support
  86. cmp r3, #5 @ long-descriptor translation table format?
  87. THUMB( it lo ) @ force fixup-able long branch encoding
  88. blo __error_p @ only classic page table format
  89. #endif
  90. #ifndef CONFIG_XIP_KERNEL
  91. adr r3, 2f
  92. ldmia r3, {r4, r8}
  93. sub r4, r3, r4 @ (PHYS_OFFSET - PAGE_OFFSET)
  94. add r8, r8, r4 @ PHYS_OFFSET
  95. #else
  96. ldr r8, =PHYS_OFFSET @ always constant in this case
  97. #endif
  98. /*
  99. * r1 = machine no, r2 = atags or dtb,
  100. * r8 = phys_offset, r9 = cpuid, r10 = procinfo
  101. */
  102. bl __vet_atags
  103. #ifdef CONFIG_SMP_ON_UP
  104. bl __fixup_smp
  105. #endif
  106. #ifdef CONFIG_ARM_PATCH_PHYS_VIRT
  107. bl __fixup_pv_table
  108. #endif
  109. bl __create_page_tables
  110. /*
  111. * The following calls CPU specific code in a position independent
  112. * manner. See arch/arm/mm/proc-*.S for details. r10 = base of
  113. * xxx_proc_info structure selected by __lookup_processor_type
  114. * above. On return, the CPU will be ready for the MMU to be
  115. * turned on, and r0 will hold the CPU control register value.
  116. */
  117. ldr r13, =__mmap_switched @ address to jump to after
  118. @ mmu has been enabled
  119. adr lr, BSYM(1f) @ return (PIC) address
  120. mov r8, r4 @ set TTBR1 to swapper_pg_dir
  121. ARM( add pc, r10, #PROCINFO_INITFUNC )
  122. THUMB( add r12, r10, #PROCINFO_INITFUNC )
  123. THUMB( mov pc, r12 )
  124. 1: b __enable_mmu
  125. ENDPROC(stext)
  126. .ltorg
  127. #ifndef CONFIG_XIP_KERNEL
  128. 2: .long .
  129. .long PAGE_OFFSET
  130. #endif
  131. /*
  132. * Setup the initial page tables. We only setup the barest
  133. * amount which are required to get the kernel running, which
  134. * generally means mapping in the kernel code.
  135. *
  136. * r8 = phys_offset, r9 = cpuid, r10 = procinfo
  137. *
  138. * Returns:
  139. * r0, r3, r5-r7 corrupted
  140. * r4 = physical page table address
  141. */
  142. __create_page_tables:
  143. pgtbl r4, r8 @ page table address
  144. /*
  145. * Clear the swapper page table
  146. */
  147. mov r0, r4
  148. mov r3, #0
  149. add r6, r0, #PG_DIR_SIZE
  150. 1: str r3, [r0], #4
  151. str r3, [r0], #4
  152. str r3, [r0], #4
  153. str r3, [r0], #4
  154. teq r0, r6
  155. bne 1b
  156. #ifdef CONFIG_ARM_LPAE
  157. /*
  158. * Build the PGD table (first level) to point to the PMD table. A PGD
  159. * entry is 64-bit wide.
  160. */
  161. mov r0, r4
  162. add r3, r4, #0x1000 @ first PMD table address
  163. orr r3, r3, #3 @ PGD block type
  164. mov r6, #4 @ PTRS_PER_PGD
  165. mov r7, #1 << (55 - 32) @ L_PGD_SWAPPER
  166. 1: str r3, [r0], #4 @ set bottom PGD entry bits
  167. str r7, [r0], #4 @ set top PGD entry bits
  168. add r3, r3, #0x1000 @ next PMD table
  169. subs r6, r6, #1
  170. bne 1b
  171. add r4, r4, #0x1000 @ point to the PMD tables
  172. #endif
  173. ldr r7, [r10, #PROCINFO_MM_MMUFLAGS] @ mm_mmuflags
  174. /*
  175. * Create identity mapping to cater for __enable_mmu.
  176. * This identity mapping will be removed by paging_init().
  177. */
  178. adr r0, __turn_mmu_on_loc
  179. ldmia r0, {r3, r5, r6}
  180. sub r0, r0, r3 @ virt->phys offset
  181. add r5, r5, r0 @ phys __turn_mmu_on
  182. add r6, r6, r0 @ phys __turn_mmu_on_end
  183. mov r5, r5, lsr #SECTION_SHIFT
  184. mov r6, r6, lsr #SECTION_SHIFT
  185. 1: orr r3, r7, r5, lsl #SECTION_SHIFT @ flags + kernel base
  186. str r3, [r4, r5, lsl #PMD_ORDER] @ identity mapping
  187. cmp r5, r6
  188. addlo r5, r5, #1 @ next section
  189. blo 1b
  190. /*
  191. * Map our RAM from the start to the end of the kernel .bss section.
  192. */
  193. add r0, r4, #PAGE_OFFSET >> (SECTION_SHIFT - PMD_ORDER)
  194. ldr r6, =(_end - 1)
  195. orr r3, r8, r7
  196. add r6, r4, r6, lsr #(SECTION_SHIFT - PMD_ORDER)
  197. 1: str r3, [r0], #1 << PMD_ORDER
  198. add r3, r3, #1 << SECTION_SHIFT
  199. cmp r0, r6
  200. bls 1b
  201. #ifdef CONFIG_XIP_KERNEL
  202. /*
  203. * Map the kernel image separately as it is not located in RAM.
  204. */
  205. #define XIP_START XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR)
  206. mov r3, pc
  207. mov r3, r3, lsr #SECTION_SHIFT
  208. orr r3, r7, r3, lsl #SECTION_SHIFT
  209. add r0, r4, #(XIP_START & 0xff000000) >> (SECTION_SHIFT - PMD_ORDER)
  210. str r3, [r0, #((XIP_START & 0x00f00000) >> SECTION_SHIFT) << PMD_ORDER]!
  211. ldr r6, =(_edata_loc - 1)
  212. add r0, r0, #1 << PMD_ORDER
  213. add r6, r4, r6, lsr #(SECTION_SHIFT - PMD_ORDER)
  214. 1: cmp r0, r6
  215. add r3, r3, #1 << SECTION_SHIFT
  216. strls r3, [r0], #1 << PMD_ORDER
  217. bls 1b
  218. #endif
  219. /*
  220. * Then map boot params address in r2 if specified.
  221. */
  222. mov r0, r2, lsr #SECTION_SHIFT
  223. movs r0, r0, lsl #SECTION_SHIFT
  224. subne r3, r0, r8
  225. addne r3, r3, #PAGE_OFFSET
  226. addne r3, r4, r3, lsr #(SECTION_SHIFT - PMD_ORDER)
  227. orrne r6, r7, r0
  228. strne r6, [r3]
  229. #ifdef CONFIG_DEBUG_LL
  230. #if !defined(CONFIG_DEBUG_ICEDCC) && !defined(CONFIG_DEBUG_SEMIHOSTING)
  231. /*
  232. * Map in IO space for serial debugging.
  233. * This allows debug messages to be output
  234. * via a serial console before paging_init.
  235. */
  236. addruart r7, r3, r0
  237. mov r3, r3, lsr #SECTION_SHIFT
  238. mov r3, r3, lsl #PMD_ORDER
  239. add r0, r4, r3
  240. mov r3, r7, lsr #SECTION_SHIFT
  241. ldr r7, [r10, #PROCINFO_IO_MMUFLAGS] @ io_mmuflags
  242. orr r3, r7, r3, lsl #SECTION_SHIFT
  243. #ifdef CONFIG_ARM_LPAE
  244. mov r7, #1 << (54 - 32) @ XN
  245. #else
  246. orr r3, r3, #PMD_SECT_XN
  247. #endif
  248. str r3, [r0], #4
  249. #ifdef CONFIG_ARM_LPAE
  250. str r7, [r0], #4
  251. #endif
  252. #else /* CONFIG_DEBUG_ICEDCC || CONFIG_DEBUG_SEMIHOSTING */
  253. /* we don't need any serial debugging mappings */
  254. ldr r7, [r10, #PROCINFO_IO_MMUFLAGS] @ io_mmuflags
  255. #endif
  256. #if defined(CONFIG_ARCH_NETWINDER) || defined(CONFIG_ARCH_CATS)
  257. /*
  258. * If we're using the NetWinder or CATS, we also need to map
  259. * in the 16550-type serial port for the debug messages
  260. */
  261. add r0, r4, #0xff000000 >> (SECTION_SHIFT - PMD_ORDER)
  262. orr r3, r7, #0x7c000000
  263. str r3, [r0]
  264. #endif
  265. #ifdef CONFIG_ARCH_RPC
  266. /*
  267. * Map in screen at 0x02000000 & SCREEN2_BASE
  268. * Similar reasons here - for debug. This is
  269. * only for Acorn RiscPC architectures.
  270. */
  271. add r0, r4, #0x02000000 >> (SECTION_SHIFT - PMD_ORDER)
  272. orr r3, r7, #0x02000000
  273. str r3, [r0]
  274. add r0, r4, #0xd8000000 >> (SECTION_SHIFT - PMD_ORDER)
  275. str r3, [r0]
  276. #endif
  277. #endif
  278. #ifdef CONFIG_ARM_LPAE
  279. sub r4, r4, #0x1000 @ point to the PGD table
  280. #endif
  281. mov pc, lr
  282. ENDPROC(__create_page_tables)
  283. .ltorg
  284. .align
  285. __turn_mmu_on_loc:
  286. .long .
  287. .long __turn_mmu_on
  288. .long __turn_mmu_on_end
  289. #if defined(CONFIG_SMP)
  290. __CPUINIT
  291. ENTRY(secondary_startup)
  292. /*
  293. * Common entry point for secondary CPUs.
  294. *
  295. * Ensure that we're in SVC mode, and IRQs are disabled. Lookup
  296. * the processor type - there is no need to check the machine type
  297. * as it has already been validated by the primary processor.
  298. */
  299. setmode PSR_F_BIT | PSR_I_BIT | SVC_MODE, r9
  300. mrc p15, 0, r9, c0, c0 @ get processor id
  301. bl __lookup_processor_type
  302. movs r10, r5 @ invalid processor?
  303. moveq r0, #'p' @ yes, error 'p'
  304. THUMB( it eq ) @ force fixup-able long branch encoding
  305. beq __error_p
  306. /*
  307. * Use the page tables supplied from __cpu_up.
  308. */
  309. adr r4, __secondary_data
  310. ldmia r4, {r5, r7, r12} @ address to jump to after
  311. sub lr, r4, r5 @ mmu has been enabled
  312. ldr r4, [r7, lr] @ get secondary_data.pgdir
  313. add r7, r7, #4
  314. ldr r8, [r7, lr] @ get secondary_data.swapper_pg_dir
  315. adr lr, BSYM(__enable_mmu) @ return address
  316. mov r13, r12 @ __secondary_switched address
  317. ARM( add pc, r10, #PROCINFO_INITFUNC ) @ initialise processor
  318. @ (return control reg)
  319. THUMB( add r12, r10, #PROCINFO_INITFUNC )
  320. THUMB( mov pc, r12 )
  321. ENDPROC(secondary_startup)
  322. /*
  323. * r6 = &secondary_data
  324. */
  325. ENTRY(__secondary_switched)
  326. ldr sp, [r7, #4] @ get secondary_data.stack
  327. mov fp, #0
  328. b secondary_start_kernel
  329. ENDPROC(__secondary_switched)
  330. .align
  331. .type __secondary_data, %object
  332. __secondary_data:
  333. .long .
  334. .long secondary_data
  335. .long __secondary_switched
  336. #endif /* defined(CONFIG_SMP) */
  337. /*
  338. * Setup common bits before finally enabling the MMU. Essentially
  339. * this is just loading the page table pointer and domain access
  340. * registers.
  341. *
  342. * r0 = cp#15 control register
  343. * r1 = machine ID
  344. * r2 = atags or dtb pointer
  345. * r4 = page table pointer
  346. * r9 = processor ID
  347. * r13 = *virtual* address to jump to upon completion
  348. */
  349. __enable_mmu:
  350. #if defined(CONFIG_ALIGNMENT_TRAP) && __LINUX_ARM_ARCH__ < 6
  351. orr r0, r0, #CR_A
  352. #else
  353. bic r0, r0, #CR_A
  354. #endif
  355. #ifdef CONFIG_CPU_DCACHE_DISABLE
  356. bic r0, r0, #CR_C
  357. #endif
  358. #ifdef CONFIG_CPU_BPREDICT_DISABLE
  359. bic r0, r0, #CR_Z
  360. #endif
  361. #ifdef CONFIG_CPU_ICACHE_DISABLE
  362. bic r0, r0, #CR_I
  363. #endif
  364. #ifdef CONFIG_ARM_LPAE
  365. mov r5, #0
  366. mcrr p15, 0, r4, r5, c2 @ load TTBR0
  367. #else
  368. mov r5, #(domain_val(DOMAIN_USER, DOMAIN_MANAGER) | \
  369. domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \
  370. domain_val(DOMAIN_TABLE, DOMAIN_MANAGER) | \
  371. domain_val(DOMAIN_IO, DOMAIN_CLIENT))
  372. mcr p15, 0, r5, c3, c0, 0 @ load domain access register
  373. mcr p15, 0, r4, c2, c0, 0 @ load page table pointer
  374. #endif
  375. b __turn_mmu_on
  376. ENDPROC(__enable_mmu)
  377. /*
  378. * Enable the MMU. This completely changes the structure of the visible
  379. * memory space. You will not be able to trace execution through this.
  380. * If you have an enquiry about this, *please* check the linux-arm-kernel
  381. * mailing list archives BEFORE sending another post to the list.
  382. *
  383. * r0 = cp#15 control register
  384. * r1 = machine ID
  385. * r2 = atags or dtb pointer
  386. * r9 = processor ID
  387. * r13 = *virtual* address to jump to upon completion
  388. *
  389. * other registers depend on the function called upon completion
  390. */
  391. .align 5
  392. .pushsection .idmap.text, "ax"
  393. ENTRY(__turn_mmu_on)
  394. mov r0, r0
  395. instr_sync
  396. mcr p15, 0, r0, c1, c0, 0 @ write control reg
  397. mrc p15, 0, r3, c0, c0, 0 @ read id reg
  398. instr_sync
  399. mov r3, r3
  400. mov r3, r13
  401. mov pc, r3
  402. __turn_mmu_on_end:
  403. ENDPROC(__turn_mmu_on)
  404. .popsection
  405. #ifdef CONFIG_SMP_ON_UP
  406. __INIT
  407. __fixup_smp:
  408. and r3, r9, #0x000f0000 @ architecture version
  409. teq r3, #0x000f0000 @ CPU ID supported?
  410. bne __fixup_smp_on_up @ no, assume UP
  411. bic r3, r9, #0x00ff0000
  412. bic r3, r3, #0x0000000f @ mask 0xff00fff0
  413. mov r4, #0x41000000
  414. orr r4, r4, #0x0000b000
  415. orr r4, r4, #0x00000020 @ val 0x4100b020
  416. teq r3, r4 @ ARM 11MPCore?
  417. moveq pc, lr @ yes, assume SMP
  418. mrc p15, 0, r0, c0, c0, 5 @ read MPIDR
  419. and r0, r0, #0xc0000000 @ multiprocessing extensions and
  420. teq r0, #0x80000000 @ not part of a uniprocessor system?
  421. moveq pc, lr @ yes, assume SMP
  422. __fixup_smp_on_up:
  423. adr r0, 1f
  424. ldmia r0, {r3 - r5}
  425. sub r3, r0, r3
  426. add r4, r4, r3
  427. add r5, r5, r3
  428. b __do_fixup_smp_on_up
  429. ENDPROC(__fixup_smp)
  430. .align
  431. 1: .word .
  432. .word __smpalt_begin
  433. .word __smpalt_end
  434. .pushsection .data
  435. .globl smp_on_up
  436. smp_on_up:
  437. ALT_SMP(.long 1)
  438. ALT_UP(.long 0)
  439. .popsection
  440. #endif
  441. .text
  442. __do_fixup_smp_on_up:
  443. cmp r4, r5
  444. movhs pc, lr
  445. ldmia r4!, {r0, r6}
  446. ARM( str r6, [r0, r3] )
  447. THUMB( add r0, r0, r3 )
  448. #ifdef __ARMEB__
  449. THUMB( mov r6, r6, ror #16 ) @ Convert word order for big-endian.
  450. #endif
  451. THUMB( strh r6, [r0], #2 ) @ For Thumb-2, store as two halfwords
  452. THUMB( mov r6, r6, lsr #16 ) @ to be robust against misaligned r3.
  453. THUMB( strh r6, [r0] )
  454. b __do_fixup_smp_on_up
  455. ENDPROC(__do_fixup_smp_on_up)
  456. ENTRY(fixup_smp)
  457. stmfd sp!, {r4 - r6, lr}
  458. mov r4, r0
  459. add r5, r0, r1
  460. mov r3, #0
  461. bl __do_fixup_smp_on_up
  462. ldmfd sp!, {r4 - r6, pc}
  463. ENDPROC(fixup_smp)
  464. #ifdef CONFIG_ARM_PATCH_PHYS_VIRT
  465. /* __fixup_pv_table - patch the stub instructions with the delta between
  466. * PHYS_OFFSET and PAGE_OFFSET, which is assumed to be 16MiB aligned and
  467. * can be expressed by an immediate shifter operand. The stub instruction
  468. * has a form of '(add|sub) rd, rn, #imm'.
  469. */
  470. __HEAD
  471. __fixup_pv_table:
  472. adr r0, 1f
  473. ldmia r0, {r3-r5, r7}
  474. sub r3, r0, r3 @ PHYS_OFFSET - PAGE_OFFSET
  475. add r4, r4, r3 @ adjust table start address
  476. add r5, r5, r3 @ adjust table end address
  477. add r7, r7, r3 @ adjust __pv_phys_offset address
  478. str r8, [r7] @ save computed PHYS_OFFSET to __pv_phys_offset
  479. mov r6, r3, lsr #24 @ constant for add/sub instructions
  480. teq r3, r6, lsl #24 @ must be 16MiB aligned
  481. THUMB( it ne @ cross section branch )
  482. bne __error
  483. str r6, [r7, #4] @ save to __pv_offset
  484. b __fixup_a_pv_table
  485. ENDPROC(__fixup_pv_table)
  486. .align
  487. 1: .long .
  488. .long __pv_table_begin
  489. .long __pv_table_end
  490. 2: .long __pv_phys_offset
  491. .text
  492. __fixup_a_pv_table:
  493. #ifdef CONFIG_THUMB2_KERNEL
  494. lsls r6, #24
  495. beq 2f
  496. clz r7, r6
  497. lsr r6, #24
  498. lsl r6, r7
  499. bic r6, #0x0080
  500. lsrs r7, #1
  501. orrcs r6, #0x0080
  502. orr r6, r6, r7, lsl #12
  503. orr r6, #0x4000
  504. b 2f
  505. 1: add r7, r3
  506. ldrh ip, [r7, #2]
  507. and ip, 0x8f00
  508. orr ip, r6 @ mask in offset bits 31-24
  509. strh ip, [r7, #2]
  510. 2: cmp r4, r5
  511. ldrcc r7, [r4], #4 @ use branch for delay slot
  512. bcc 1b
  513. bx lr
  514. #else
  515. b 2f
  516. 1: ldr ip, [r7, r3]
  517. bic ip, ip, #0x000000ff
  518. orr ip, ip, r6 @ mask in offset bits 31-24
  519. str ip, [r7, r3]
  520. 2: cmp r4, r5
  521. ldrcc r7, [r4], #4 @ use branch for delay slot
  522. bcc 1b
  523. mov pc, lr
  524. #endif
  525. ENDPROC(__fixup_a_pv_table)
  526. ENTRY(fixup_pv_table)
  527. stmfd sp!, {r4 - r7, lr}
  528. ldr r2, 2f @ get address of __pv_phys_offset
  529. mov r3, #0 @ no offset
  530. mov r4, r0 @ r0 = table start
  531. add r5, r0, r1 @ r1 = table size
  532. ldr r6, [r2, #4] @ get __pv_offset
  533. bl __fixup_a_pv_table
  534. ldmfd sp!, {r4 - r7, pc}
  535. ENDPROC(fixup_pv_table)
  536. .align
  537. 2: .long __pv_phys_offset
  538. .data
  539. .globl __pv_phys_offset
  540. .type __pv_phys_offset, %object
  541. __pv_phys_offset:
  542. .long 0
  543. .size __pv_phys_offset, . - __pv_phys_offset
  544. __pv_offset:
  545. .long 0
  546. #endif
  547. #include "head-common.S"