First Support on Ginger and OMAP TI
[linux-ginger.git] / arch / arm / kernel / relocate_kernel.S
blob61930eb0902941030e3e180aca40f6f82697e39e
1 /*
2  * relocate_kernel.S - put the kernel image in place to boot
3  */
5 #include <asm/kexec.h>
7         .globl relocate_new_kernel
8 relocate_new_kernel:
10         ldr     r0,kexec_indirection_page
11         ldr     r1,kexec_start_address
14 0:      /* top, read another word for the indirection page */
15         ldr     r3, [r0],#4
17         /* Is it a destination page. Put destination address to r4 */
18         tst     r3,#1,0
19         beq     1f
20         bic     r4,r3,#1
21         b       0b
23         /* Is it an indirection page */
24         tst     r3,#2,0
25         beq     1f
26         bic     r0,r3,#2
27         b       0b
30         /* are we done ? */
31         tst     r3,#4,0
32         beq     1f
33         b       2f
36         /* is it source ? */
37         tst     r3,#8,0
38         beq     0b
39         bic r3,r3,#8
40         mov r6,#1024
42         ldr r5,[r3],#4
43         str r5,[r4],#4
44         subs r6,r6,#1
45         bne 9b
46         b 0b
49         /* Jump to relocated kernel */
50         mov lr,r1
51         mov r0,#0
52         ldr r1,kexec_mach_type
53         ldr r2,kexec_boot_atags
54         mov pc,lr
56         .globl kexec_start_address
57 kexec_start_address:
58         .long   0x0
60         .globl kexec_indirection_page
61 kexec_indirection_page:
62         .long   0x0
64         .globl kexec_mach_type
65 kexec_mach_type:
66         .long   0x0
68         /* phy addr of the atags for the new kernel */
69         .globl kexec_boot_atags
70 kexec_boot_atags:
71         .long   0x0
73 relocate_new_kernel_end:
75         .globl relocate_new_kernel_size
76 relocate_new_kernel_size:
77         .long relocate_new_kernel_end - relocate_new_kernel