]> git.zerfleddert.de Git - ms2-kexec/blob - relocate_kernel.S
update offsets to new european GB kernel, set software booting from USB
[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 /* Disable MMU */
10 mov ip, #0
11 #ifdef CONFIG_MMU
12 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
13 #endif
14 mrc p15, 0, ip, c1, c0, 0 @ ctrl register
15 bic ip, ip, #0x000f @ ............wcam
16 bic ip, ip, #0x1100 @ ...i...s........
17 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
18
19 ldr r0,kexec_indirection_page
20 ldr r1,kexec_start_address
21
22 /*
23 * If there is no indirection page (we are doing crashdumps)
24 * skip any relocation.
25 */
26 cmp r0, #0
27 beq 2f
28
29 0: /* top, read another word for the indirection page */
30 ldr r3, [r0],#4
31
32 /* Is it a destination page. Put destination address to r4 */
33 tst r3,#1,0
34 beq 1f
35 bic r4,r3,#1
36 b 0b
37 1:
38 /* Is it an indirection page */
39 tst r3,#2,0
40 beq 1f
41 bic r0,r3,#2
42 b 0b
43 1:
44
45 /* are we done ? */
46 tst r3,#4,0
47 beq 1f
48 b 2f
49
50 1:
51 /* is it source ? */
52 tst r3,#8,0
53 beq 0b
54 bic r3,r3,#8
55 mov r6,#1024
56 9:
57 ldr r5,[r3],#4
58 str r5,[r4],#4
59 subs r6,r6,#1
60 bne 9b
61 b 0b
62
63 2:
64 /* Jump to relocated kernel */
65 mov lr,r1
66 mov r0,#0
67 ldr r1,kexec_mach_type
68 ldr r2,kexec_boot_atags
69 mov pc,lr
70
71 .align
72
73 .globl kexec_start_address
74 kexec_start_address:
75 .long 0x0
76
77 .globl kexec_indirection_page
78 kexec_indirection_page:
79 .long 0x0
80
81 .globl kexec_mach_type
82 kexec_mach_type:
83 .long 0x0
84
85 /* phy addr of the atags for the new kernel */
86 .globl kexec_boot_atags
87 kexec_boot_atags:
88 .long 0x0
89
90 relocate_new_kernel_end:
91
92 .globl relocate_new_kernel_size
93 relocate_new_kernel_size:
94 .long relocate_new_kernel_end - relocate_new_kernel
95
96
Impressum, Datenschutz