ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / arch / arm / boot / compressed / head.S
1 /*
2  *  linux/arch/arm/boot/compressed/head.S
3  *
4  *  Copyright (C) 1996-2002 Russell King
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  */
10 #include <linux/config.h>
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
21 #if defined(CONFIG_DEBUG_DC21285_PORT)
22                 .macro  loadsp, rb
23                 mov     \rb, #0x42000000
24                 .endm
25                 .macro  writeb, rb
26                 str     \rb, [r3, #0x160]
27                 .endm
28 #elif defined(CONFIG_DEBUG_ICEDCC)
29                 .macro  loadsp, rb
30                 .endm
31                 .macro writeb, rb
32                 mcr     p14, 0, \rb, c0, c1, 0
33                 .endm
34 #elif defined(CONFIG_FOOTBRIDGE)
35                 .macro  loadsp, rb
36                 mov     \rb, #0x7c000000
37                 .endm
38                 .macro  writeb, rb
39                 strb    \rb, [r3, #0x3f8]
40                 .endm
41 #elif defined(CONFIG_ARCH_RPC)
42                 .macro  loadsp, rb
43                 mov     \rb, #0x03000000
44                 orr     \rb, \rb, #0x00010000
45                 .endm
46                 .macro  writeb, rb
47                 strb    \rb, [r3, #0x3f8 << 2]
48                 .endm
49 #elif defined(CONFIG_ARCH_INTEGRATOR)
50                 .macro  loadsp, rb
51                 mov     \rb, #0x16000000
52                 .endm
53                 .macro  writeb, rb
54                 strb    \rb, [r3, #0]
55                 .endm
56 #elif defined(CONFIG_ARCH_PXA) /* Xscale-type */
57                 .macro  loadsp, rb
58                 mov     \rb, #0x40000000
59                 orr     \rb, \rb, #0x00100000
60                 .endm
61                 .macro  writeb, rb
62                 strb    \rb, [r3, #0]
63                 .endm
64 #elif defined(CONFIG_ARCH_SA1100)
65                 .macro  loadsp, rb
66                 mov     \rb, #0x80000000        @ physical base address
67 #  if defined(CONFIG_DEBUG_LL_SER3)
68                 add     \rb, \rb, #0x00050000   @ Ser3
69 #  else
70                 add     \rb, \rb, #0x00010000   @ Ser1
71 #  endif
72                 .endm
73                 .macro  writeb, rb
74                 str     \rb, [r3, #0x14]        @ UTDR
75                 .endm
76 #elif defined(CONFIG_ARCH_LH7A40X)
77                 .macro  loadsp, rb
78                 ldr     \rb, =0x80000700        @ UART2 UARTBASE
79                 .endm
80                 .macro  writeb, rb
81                 strb    \rb, [r3, #0]
82                 .endm
83 #else
84 #error no serial architecture defined
85 #endif
86 #endif
87
88                 .macro  kputc,val
89                 mov     r0, \val
90                 bl      putc
91                 .endm
92
93                 .macro  kphex,val,len
94                 mov     r0, \val
95                 mov     r1, #\len
96                 bl      phex
97                 .endm
98
99                 .macro  debug_reloc_start
100 #ifdef DEBUG
101                 kputc   #'\n'
102                 kphex   r6, 8           /* processor id */
103                 kputc   #':'
104                 kphex   r7, 8           /* architecture id */
105                 kputc   #':'
106                 mrc     p15, 0, r0, c1, c0
107                 kphex   r0, 8           /* control reg */
108                 kputc   #'\n'
109                 kphex   r5, 8           /* decompressed kernel start */
110                 kputc   #'-'
111                 kphex   r8, 8           /* decompressed kernel end  */
112                 kputc   #'>'
113                 kphex   r4, 8           /* kernel execution address */
114                 kputc   #'\n'
115 #endif
116                 .endm
117
118                 .macro  debug_reloc_end
119 #ifdef DEBUG
120                 kphex   r5, 8           /* end of kernel */
121                 kputc   #'\n'
122                 mov     r0, r4
123                 bl      memdump         /* dump 256 bytes at start of kernel */
124 #endif
125                 .endm
126
127                 .section ".start", #alloc, #execinstr
128 /*
129  * sort out different calling conventions
130  */
131                 .align
132 start:
133                 .type   start,#function
134                 .rept   8
135                 mov     r0, r0
136                 .endr
137
138                 b       1f
139                 .word   0x016f2818              @ Magic numbers to help the loader
140                 .word   start                   @ absolute load/run zImage address
141                 .word   _edata                  @ zImage end address
142 1:              mov     r7, r1                  @ save architecture ID
143                 mov     r8, #0                  @ save r0
144
145 #ifndef __ARM_ARCH_2__
146                 /*
147                  * Booting from Angel - need to enter SVC mode and disable
148                  * FIQs/IRQs (numeric definitions from angel arm.h source).
149                  * We only do this if we were in user mode on entry.
150                  */
151                 mrs     r2, cpsr                @ get current mode
152                 tst     r2, #3                  @ not user?
153                 bne     not_angel
154                 mov     r0, #0x17               @ angel_SWIreason_EnterSVC
155                 swi     0x123456                @ angel_SWI_ARM
156 not_angel:
157                 mrs     r2, cpsr                @ turn off interrupts to
158                 orr     r2, r2, #0xc0           @ prevent angel from running
159                 msr     cpsr_c, r2
160 #else
161                 teqp    pc, #0x0c000003         @ turn off interrupts
162 #endif
163
164                 /*
165                  * Note that some cache flushing and other stuff may
166                  * be needed here - is there an Angel SWI call for this?
167                  */
168
169                 /*
170                  * some architecture specific code can be inserted
171                  * by the linker here, but it should preserve r7 and r8.
172                  */
173
174                 .text
175                 adr     r0, LC0
176                 ldmia   r0, {r1, r2, r3, r4, r5, r6, ip, sp}
177                 subs    r0, r0, r1              @ calculate the delta offset
178
179                                                 @ if delta is zero, we're
180                 beq     not_relocated           @ running at the address we
181                                                 @ were linked at.
182
183                 /*
184                  * We're running at a different address.  We need to fix
185                  * up various pointers:
186                  *   r5 - zImage base address
187                  *   r6 - GOT start
188                  *   ip - GOT end
189                  */
190                 add     r5, r5, r0
191                 add     r6, r6, r0
192                 add     ip, ip, r0
193
194 #ifndef CONFIG_ZBOOT_ROM
195                 /*
196                  * If we're running fully PIC === CONFIG_ZBOOT_ROM = n,
197                  * we need to fix up pointers into the BSS region.
198                  *   r2 - BSS start
199                  *   r3 - BSS end
200                  *   sp - stack pointer
201                  */
202                 add     r2, r2, r0
203                 add     r3, r3, r0
204                 add     sp, sp, r0
205
206                 /*
207                  * Relocate all entries in the GOT table.
208                  */
209 1:              ldr     r1, [r6, #0]            @ relocate entries in the GOT
210                 add     r1, r1, r0              @ table.  This fixes up the
211                 str     r1, [r6], #4            @ C references.
212                 cmp     r6, ip
213                 blo     1b
214 #else
215
216                 /*
217                  * Relocate entries in the GOT table.  We only relocate
218                  * the entries that are outside the (relocated) BSS region.
219                  */
220 1:              ldr     r1, [r6, #0]            @ relocate entries in the GOT
221                 cmp     r1, r2                  @ entry < bss_start ||
222                 cmphs   r3, r1                  @ _end < entry
223                 addlo   r1, r1, r0              @ table.  This fixes up the
224                 str     r1, [r6], #4            @ C references.
225                 cmp     r6, ip
226                 blo     1b
227 #endif
228
229 not_relocated:  mov     r0, #0
230 1:              str     r0, [r2], #4            @ clear bss
231                 str     r0, [r2], #4
232                 str     r0, [r2], #4
233                 str     r0, [r2], #4
234                 cmp     r2, r3
235                 blo     1b
236
237                 /*
238                  * The C runtime environment should now be setup
239                  * sufficiently.  Turn the cache on, set up some
240                  * pointers, and start decompressing.
241                  */
242                 bl      cache_on
243
244                 mov     r1, sp                  @ malloc space above stack
245                 add     r2, sp, #0x10000        @ 64k max
246
247 /*
248  * Check to see if we will overwrite ourselves.
249  *   r4 = final kernel address
250  *   r5 = start of this image
251  *   r2 = end of malloc space (and therefore this image)
252  * We basically want:
253  *   r4 >= r2 -> OK
254  *   r4 + image length <= r5 -> OK
255  */
256                 cmp     r4, r2
257                 bhs     wont_overwrite
258                 add     r0, r4, #4096*1024      @ 4MB largest kernel size
259                 cmp     r0, r5
260                 bls     wont_overwrite
261
262                 mov     r5, r2                  @ decompress after malloc space
263                 mov     r0, r5
264                 mov     r3, r7
265                 bl      decompress_kernel
266
267                 add     r0, r0, #127
268                 bic     r0, r0, #127            @ align the kernel length
269 /*
270  * r0     = decompressed kernel length
271  * r1-r3  = unused
272  * r4     = kernel execution address
273  * r5     = decompressed kernel start
274  * r6     = processor ID
275  * r7     = architecture ID
276  * r8-r14 = unused
277  */
278                 add     r1, r5, r0              @ end of decompressed kernel
279                 adr     r2, reloc_start
280                 ldr     r3, LC1
281                 add     r3, r2, r3
282 1:              ldmia   r2!, {r8 - r13}         @ copy relocation code
283                 stmia   r1!, {r8 - r13}
284                 ldmia   r2!, {r8 - r13}
285                 stmia   r1!, {r8 - r13}
286                 cmp     r2, r3
287                 blo     1b
288
289                 bl      cache_clean_flush
290                 add     pc, r5, r0              @ call relocation code
291
292 /*
293  * We're not in danger of overwriting ourselves.  Do this the simple way.
294  *
295  * r4     = kernel execution address
296  * r7     = architecture ID
297  */
298 wont_overwrite: mov     r0, r4
299                 mov     r3, r7
300                 bl      decompress_kernel
301                 b       call_kernel
302
303                 .type   LC0, #object
304 LC0:            .word   LC0                     @ r1
305                 .word   __bss_start             @ r2
306                 .word   _end                    @ r3
307                 .word   _load_addr              @ r4
308                 .word   _start                  @ r5
309                 .word   _got_start              @ r6
310                 .word   _got_end                @ ip
311                 .word   user_stack+4096         @ sp
312 LC1:            .word   reloc_end - reloc_start
313                 .size   LC0, . - LC0
314
315 /*
316  * Turn on the cache.  We need to setup some page tables so that we
317  * can have both the I and D caches on.
318  *
319  * We place the page tables 16k down from the kernel execution address,
320  * and we hope that nothing else is using it.  If we're using it, we
321  * will go pop!
322  *
323  * On entry,
324  *  r4 = kernel execution address
325  *  r6 = processor ID
326  *  r7 = architecture number
327  *  r8 = run-time address of "start"
328  * On exit,
329  *  r1, r2, r3, r8, r9, r12 corrupted
330  * This routine must preserve:
331  *  r4, r5, r6, r7
332  */
333                 .align  5
334 cache_on:       mov     r3, #8                  @ cache_on function
335                 b       call_cache_fn
336
337 __setup_mmu:    sub     r3, r4, #16384          @ Page directory size
338                 bic     r3, r3, #0xff           @ Align the pointer
339                 bic     r3, r3, #0x3f00
340 /*
341  * Initialise the page tables, turning on the cacheable and bufferable
342  * bits for the RAM area only.
343  */
344                 mov     r0, r3
345                 mov     r8, r0, lsr #18
346                 mov     r8, r8, lsl #18         @ start of RAM
347                 add     r9, r8, #0x10000000     @ a reasonable RAM size
348                 mov     r1, #0x12
349                 orr     r1, r1, #3 << 10
350                 add     r2, r3, #16384
351 1:              cmp     r1, r8                  @ if virt > start of RAM
352                 orrhs   r1, r1, #0x0c           @ set cacheable, bufferable
353                 cmp     r1, r9                  @ if virt > end of RAM
354                 bichs   r1, r1, #0x0c           @ clear cacheable, bufferable
355                 str     r1, [r0], #4            @ 1:1 mapping
356                 add     r1, r1, #1048576
357                 teq     r0, r2
358                 bne     1b
359 /*
360  * If ever we are running from Flash, then we surely want the cache
361  * to be enabled also for our execution instance...  We map 2MB of it
362  * so there is no map overlap problem for up to 1 MB compressed kernel.
363  * If the execution is in RAM then we would only be duplicating the above.
364  */
365                 mov     r1, #0x1e
366                 orr     r1, r1, #3 << 10
367                 mov     r2, pc, lsr #20
368                 orr     r1, r1, r2, lsl #20
369                 add     r0, r3, r2, lsl #2
370                 str     r1, [r0], #4
371                 add     r1, r1, #1048576
372                 str     r1, [r0]
373                 mov     pc, lr
374
375 __armv4_cache_on:
376                 mov     r12, lr
377                 bl      __setup_mmu
378                 mov     r0, #0
379                 mcr     p15, 0, r0, c7, c10, 4  @ drain write buffer
380                 mcr     p15, 0, r0, c8, c7, 0   @ flush I,D TLBs
381                 mrc     p15, 0, r0, c1, c0, 0   @ read control reg
382                 orr     r0, r0, #0x5000         @ I-cache enable, RR cache replacement
383                 orr     r0, r0, #0x0030
384                 bl      __common_cache_on
385                 mov     r0, #0
386                 mcr     p15, 0, r0, c8, c7, 0   @ flush I,D TLBs
387                 mov     pc, r12
388
389 __arm6_cache_on:
390                 mov     r12, lr
391                 bl      __setup_mmu
392                 mov     r0, #0
393                 mcr     p15, 0, r0, c7, c0, 0   @ invalidate whole cache v3
394                 mcr     p15, 0, r0, c5, c0, 0   @ invalidate whole TLB v3
395                 mov     r0, #0x30
396                 bl      __common_cache_on
397                 mov     r0, #0
398                 mcr     p15, 0, r0, c5, c0, 0   @ invalidate whole TLB v3
399                 mov     pc, r12
400
401 __common_cache_on:
402 #ifndef DEBUG
403                 orr     r0, r0, #0x000d         @ Write buffer, mmu
404 #endif
405                 mov     r1, #-1
406                 mcr     p15, 0, r3, c2, c0, 0   @ load page table pointer
407                 mcr     p15, 0, r1, c3, c0, 0   @ load domain access control
408                 mcr     p15, 0, r0, c1, c0, 0   @ load control register
409                 mov     pc, lr
410
411 /*
412  * All code following this line is relocatable.  It is relocated by
413  * the above code to the end of the decompressed kernel image and
414  * executed there.  During this time, we have no stacks.
415  *
416  * r0     = decompressed kernel length
417  * r1-r3  = unused
418  * r4     = kernel execution address
419  * r5     = decompressed kernel start
420  * r6     = processor ID
421  * r7     = architecture ID
422  * r8-r14 = unused
423  */
424                 .align  5
425 reloc_start:    add     r8, r5, r0
426                 debug_reloc_start
427                 mov     r1, r4
428 1:
429                 .rept   4
430                 ldmia   r5!, {r0, r2, r3, r9 - r13}     @ relocate kernel
431                 stmia   r1!, {r0, r2, r3, r9 - r13}
432                 .endr
433
434                 cmp     r5, r8
435                 blo     1b
436                 debug_reloc_end
437
438 call_kernel:    bl      cache_clean_flush
439                 bl      cache_off
440                 mov     r0, #0
441                 mov     r1, r7                  @ restore architecture number
442                 mov     pc, r4                  @ call kernel
443
444 /*
445  * Here follow the relocatable cache support functions for the
446  * various processors.  This is a generic hook for locating an
447  * entry and jumping to an instruction at the specified offset
448  * from the start of the block.  Please note this is all position
449  * independent code.
450  *
451  *  r1  = corrupted
452  *  r2  = corrupted
453  *  r3  = block offset
454  *  r6  = corrupted
455  *  r12 = corrupted
456  */
457
458 call_cache_fn:  adr     r12, proc_types
459                 mrc     p15, 0, r6, c0, c0      @ get processor ID
460 1:              ldr     r1, [r12, #0]           @ get value
461                 ldr     r2, [r12, #4]           @ get mask
462                 eor     r1, r1, r6              @ (real ^ match)
463                 tst     r1, r2                  @       & mask
464                 addeq   pc, r12, r3             @ call cache function
465                 add     r12, r12, #4*5
466                 b       1b
467
468 /*
469  * Table for cache operations.  This is basically:
470  *   - CPU ID match
471  *   - CPU ID mask
472  *   - 'cache on' method instruction
473  *   - 'cache off' method instruction
474  *   - 'cache flush' method instruction
475  *
476  * We match an entry using: ((real_id ^ match) & mask) == 0
477  *
478  * Writethrough caches generally only need 'on' and 'off'
479  * methods.  Writeback caches _must_ have the flush method
480  * defined.
481  */
482                 .type   proc_types,#object
483 proc_types:
484                 .word   0x41560600              @ ARM6/610
485                 .word   0xffffffe0
486                 b       __arm6_cache_off        @ works, but slow
487                 b       __arm6_cache_off
488                 mov     pc, lr
489 @               b       __arm6_cache_on         @ untested
490 @               b       __arm6_cache_off
491 @               b       __armv3_cache_flush
492
493                 .word   0x00000000              @ old ARM ID
494                 .word   0x0000f000
495                 mov     pc, lr
496                 mov     pc, lr
497                 mov     pc, lr
498
499                 .word   0x41007000              @ ARM7/710
500                 .word   0xfff8fe00
501                 b       __arm7_cache_off
502                 b       __arm7_cache_off
503                 mov     pc, lr
504
505                 .word   0x41807200              @ ARM720T (writethrough)
506                 .word   0xffffff00
507                 b       __armv4_cache_on
508                 b       __armv4_cache_off
509                 mov     pc, lr
510
511                 .word   0x00007000              @ ARM7 IDs
512                 .word   0x0000f000
513                 mov     pc, lr
514                 mov     pc, lr
515                 mov     pc, lr
516
517                 @ Everything from here on will be the new ID system.
518
519                 .word   0x4401a100              @ sa110 / sa1100
520                 .word   0xffffffe0
521                 b       __armv4_cache_on
522                 b       __armv4_cache_off
523                 b       __armv4_cache_flush
524
525                 .word   0x6901b110              @ sa1110
526                 .word   0xfffffff0
527                 b       __armv4_cache_on
528                 b       __armv4_cache_off
529                 b       __armv4_cache_flush
530
531                 @ These match on the architecture ID
532
533                 .word   0x00020000              @ ARMv4T
534                 .word   0x000f0000
535                 b       __armv4_cache_on
536                 b       __armv4_cache_off
537                 b       __armv4_cache_flush
538
539                 .word   0x00050000              @ ARMv5TE
540                 .word   0x000f0000
541                 b       __armv4_cache_on
542                 b       __armv4_cache_off
543                 b       __armv4_cache_flush
544
545                 .word   0x00060000              @ ARMv5TEJ
546                 .word   0x000f0000
547                 b       __armv4_cache_on
548                 b       __armv4_cache_off
549                 b       __armv4_cache_flush
550
551                 .word   0                       @ unrecognised type
552                 .word   0
553                 mov     pc, lr
554                 mov     pc, lr
555                 mov     pc, lr
556
557                 .size   proc_types, . - proc_types
558
559 /*
560  * Turn off the Cache and MMU.  ARMv3 does not support
561  * reading the control register, but ARMv4 does.
562  *
563  * On entry,  r6 = processor ID
564  * On exit,   r0, r1, r2, r3, r12 corrupted
565  * This routine must preserve: r4, r6, r7
566  */
567                 .align  5
568 cache_off:      mov     r3, #12                 @ cache_off function
569                 b       call_cache_fn
570
571 __armv4_cache_off:
572                 mrc     p15, 0, r0, c1, c0
573                 bic     r0, r0, #0x000d
574                 mcr     p15, 0, r0, c1, c0      @ turn MMU and cache off
575                 mov     r0, #0
576                 mcr     p15, 0, r0, c7, c7      @ invalidate whole cache v4
577                 mcr     p15, 0, r0, c8, c7      @ invalidate whole TLB v4
578                 mov     pc, lr
579
580 __arm6_cache_off:
581                 mov     r0, #0x00000030         @ ARM6 control reg.
582                 b       __armv3_cache_off
583
584 __arm7_cache_off:
585                 mov     r0, #0x00000070         @ ARM7 control reg.
586                 b       __armv3_cache_off
587
588 __armv3_cache_off:
589                 mcr     p15, 0, r0, c1, c0, 0   @ turn MMU and cache off
590                 mov     r0, #0
591                 mcr     p15, 0, r0, c7, c0, 0   @ invalidate whole cache v3
592                 mcr     p15, 0, r0, c5, c0, 0   @ invalidate whole TLB v3
593                 mov     pc, lr
594
595 /*
596  * Clean and flush the cache to maintain consistency.
597  *
598  * On entry,
599  *  r6 = processor ID
600  * On exit,
601  *  r1, r2, r3, r11, r12 corrupted
602  * This routine must preserve:
603  *  r0, r4, r5, r6, r7
604  */
605                 .align  5
606 cache_clean_flush:
607                 mov     r3, #16
608                 b       call_cache_fn
609
610 __armv4_cache_flush:
611                 mov     r2, #64*1024            @ default: 32K dcache size (*2)
612                 mov     r11, #32                @ default: 32 byte line size
613                 mrc     p15, 0, r3, c0, c0, 1   @ read cache type
614                 teq     r3, r6                  @ cache ID register present?
615                 beq     no_cache_id
616                 mov     r1, r3, lsr #18
617                 and     r1, r1, #7
618                 mov     r2, #1024
619                 mov     r2, r2, lsl r1          @ base dcache size *2
620                 tst     r3, #1 << 14            @ test M bit
621                 addne   r2, r2, r2, lsr #1      @ +1/2 size if M == 1
622                 mov     r3, r3, lsr #12
623                 and     r3, r3, #3
624                 mov     r11, #8
625                 mov     r11, r11, lsl r3        @ cache line size in bytes
626 no_cache_id:
627                 bic     r1, pc, #63             @ align to longest cache line
628                 add     r2, r1, r2
629 1:              ldr     r3, [r1], r11           @ s/w flush D cache
630                 teq     r1, r2
631                 bne     1b
632
633                 mcr     p15, 0, r1, c7, c5, 0   @ flush I cache
634                 mcr     p15, 0, r1, c7, c6, 0   @ flush D cache
635                 mcr     p15, 0, r1, c7, c10, 4  @ drain WB
636                 mov     pc, lr
637
638 __armv3_cache_flush:
639                 mov     r1, #0
640                 mcr     p15, 0, r0, c7, c0, 0   @ invalidate whole cache v3
641                 mov     pc, lr
642
643 /*
644  * Various debugging routines for printing hex characters and
645  * memory, which again must be relocatable.
646  */
647 #ifdef DEBUG
648                 .type   phexbuf,#object
649 phexbuf:        .space  12
650                 .size   phexbuf, . - phexbuf
651
652 phex:           adr     r3, phexbuf
653                 mov     r2, #0
654                 strb    r2, [r3, r1]
655 1:              subs    r1, r1, #1
656                 movmi   r0, r3
657                 bmi     puts
658                 and     r2, r0, #15
659                 mov     r0, r0, lsr #4
660                 cmp     r2, #10
661                 addge   r2, r2, #7
662                 add     r2, r2, #'0'
663                 strb    r2, [r3, r1]
664                 b       1b
665
666 puts:           loadsp  r3
667 1:              ldrb    r2, [r0], #1
668                 teq     r2, #0
669                 moveq   pc, lr
670 2:              writeb  r2
671                 mov     r1, #0x00020000
672 3:              subs    r1, r1, #1
673                 bne     3b
674                 teq     r2, #'\n'
675                 moveq   r2, #'\r'
676                 beq     2b
677                 teq     r0, #0
678                 bne     1b
679                 mov     pc, lr
680 putc:
681                 mov     r2, r0
682                 mov     r0, #0
683                 loadsp  r3
684                 b       2b
685
686 memdump:        mov     r12, r0
687                 mov     r10, lr
688                 mov     r11, #0
689 2:              mov     r0, r11, lsl #2
690                 add     r0, r0, r12
691                 mov     r1, #8
692                 bl      phex
693                 mov     r0, #':'
694                 bl      putc
695 1:              mov     r0, #' '
696                 bl      putc
697                 ldr     r0, [r12, r11, lsl #2]
698                 mov     r1, #8
699                 bl      phex
700                 and     r0, r11, #7
701                 teq     r0, #3
702                 moveq   r0, #' '
703                 bleq    putc
704                 and     r0, r11, #7
705                 add     r11, r11, #1
706                 teq     r0, #7
707                 bne     1b
708                 mov     r0, #'\n'
709                 bl      putc
710                 cmp     r11, #64
711                 blt     2b
712                 mov     pc, r10
713 #endif
714
715 reloc_end:
716
717                 .align
718                 .section ".stack", "w"
719 user_stack:     .space  4096