]> git.zerfleddert.de Git - ms2-kexec/blob - relocate_kernel.S
61930eb0902941030e3e180aca40f6f82697e39e
[ms2-kexec] / relocate_kernel.S
1 /*
2 * relocate_kernel.S - put the kernel image in place to boot
3 */
4
5 #include <asm/kexec.h>
6
7 .globl relocate_new_kernel
8 relocate_new_kernel:
9
10 ldr r0,kexec_indirection_page
11 ldr r1,kexec_start_address
12
13
14 0: /* top, read another word for the indirection page */
15 ldr r3, [r0],#4
16
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
22 1:
23 /* Is it an indirection page */
24 tst r3,#2,0
25 beq 1f
26 bic r0,r3,#2
27 b 0b
28 1:
29
30 /* are we done ? */
31 tst r3,#4,0
32 beq 1f
33 b 2f
34
35 1:
36 /* is it source ? */
37 tst r3,#8,0
38 beq 0b
39 bic r3,r3,#8
40 mov r6,#1024
41 9:
42 ldr r5,[r3],#4
43 str r5,[r4],#4
44 subs r6,r6,#1
45 bne 9b
46 b 0b
47
48 2:
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
55
56 .globl kexec_start_address
57 kexec_start_address:
58 .long 0x0
59
60 .globl kexec_indirection_page
61 kexec_indirection_page:
62 .long 0x0
63
64 .globl kexec_mach_type
65 kexec_mach_type:
66 .long 0x0
67
68 /* phy addr of the atags for the new kernel */
69 .globl kexec_boot_atags
70 kexec_boot_atags:
71 .long 0x0
72
73 relocate_new_kernel_end:
74
75 .globl relocate_new_kernel_size
76 relocate_new_kernel_size:
77 .long relocate_new_kernel_end - relocate_new_kernel
78
79
Impressum, Datenschutz