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