2 * relocate_kernel.S for kexec
3 * Created by <nschichan@corp.free.fr> on Thu Oct 12 17:49:57 2006
5 * This source code is licensed under the GNU General Public License,
6 * Version 2. See the file COPYING for more details.
10 #include <asm/asmmacro.h>
11 #include <asm/regdef.h>
12 #include <asm/mipsregs.h>
13 #include <asm/stackframe.h>
14 #include <asm/addrspace.h>
16 LEAF(relocate_new_kernel)
22 PTR_L s0, kexec_indirection_page
23 PTR_L s1, kexec_start_address
29 /* destination page */
32 and s4, s2, ~0x1 /* store destination addr in s4 */
36 /* indirection page, update s0 */
50 beq s3, zero, process_entry
52 li s6, (1 << _PAGE_SHIFT) / SZREG
55 /* copy page word by word */
61 beq s6, zero, process_entry
67 /* kexec_flag reset is signal to other CPUs what kernel
68 was moved to it's location. Note - we need relocated address
80 #ifdef CONFIG_CPU_CAVIUM_OCTEON
81 /* We need to flush I-cache before jumping to new kernel.
82 * Unfortunatelly, this code is cpu-specific.
93 /* jump to kexec_start_address */
95 END(relocate_new_kernel)
99 * Other CPUs should wait until code is relocated and
100 * then start at entry (?) point.
107 PTR_L s1, kexec_start_address
109 /* Non-relocated address works for args and kexec_start_address ( old
110 * kernel is not overwritten). But we need relocated address of
124 #ifdef CONFIG_CPU_CAVIUM_OCTEON
137 /* all PTR's must be aligned to 8 byte in 64-bit mode */
141 /* All parameters to new kernel are passed in registers a0-a3.
142 * kexec_args[0..3] are uses to prepare register values.
151 .size kexec_args,PTRSIZE*4
155 * Secondary CPUs may have different kernel parameters in
156 * their registers a0-a3. secondary_kexec_args[0..3] are used
157 * to prepare register values.
159 secondary_kexec_args:
160 EXPORT(secondary_kexec_args)
165 .size secondary_kexec_args,PTRSIZE*4
172 EXPORT(kexec_start_address)
174 .size kexec_start_address, PTRSIZE
176 kexec_indirection_page:
177 EXPORT(kexec_indirection_page)
179 .size kexec_indirection_page, PTRSIZE
181 relocate_new_kernel_end:
183 relocate_new_kernel_size:
184 EXPORT(relocate_new_kernel_size)
185 PTR relocate_new_kernel_end - relocate_new_kernel
186 .size relocate_new_kernel_size, PTRSIZE