diff options
Diffstat (limited to 'arch/mips/kernel/relocate_kernel.S')
-rw-r--r-- | arch/mips/kernel/relocate_kernel.S | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/arch/mips/kernel/relocate_kernel.S b/arch/mips/kernel/relocate_kernel.S new file mode 100644 index 000000000000..a3f0d00c1334 --- /dev/null +++ b/arch/mips/kernel/relocate_kernel.S | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | * relocate_kernel.S for kexec | ||
3 | * Created by <nschichan@corp.free.fr> on Thu Oct 12 17:49:57 2006 | ||
4 | * | ||
5 | * This source code is licensed under the GNU General Public License, | ||
6 | * Version 2. See the file COPYING for more details. | ||
7 | */ | ||
8 | |||
9 | #include <asm/asm.h> | ||
10 | #include <asm/asmmacro.h> | ||
11 | #include <asm/regdef.h> | ||
12 | #include <asm/page.h> | ||
13 | #include <asm/mipsregs.h> | ||
14 | #include <asm/stackframe.h> | ||
15 | #include <asm/addrspace.h> | ||
16 | |||
17 | .globl relocate_new_kernel | ||
18 | relocate_new_kernel: | ||
19 | |||
20 | PTR_L s0, kexec_indirection_page | ||
21 | PTR_L s1, kexec_start_address | ||
22 | |||
23 | process_entry: | ||
24 | PTR_L s2, (s0) | ||
25 | PTR_ADD s0, s0, SZREG | ||
26 | |||
27 | /* destination page */ | ||
28 | and s3, s2, 0x1 | ||
29 | beq s3, zero, 1f | ||
30 | and s4, s2, ~0x1 /* store destination addr in s4 */ | ||
31 | move a0, s4 | ||
32 | b process_entry | ||
33 | |||
34 | 1: | ||
35 | /* indirection page, update s0 */ | ||
36 | and s3, s2, 0x2 | ||
37 | beq s3, zero, 1f | ||
38 | and s0, s2, ~0x2 | ||
39 | b process_entry | ||
40 | |||
41 | 1: | ||
42 | /* done page */ | ||
43 | and s3, s2, 0x4 | ||
44 | beq s3, zero, 1f | ||
45 | b done | ||
46 | 1: | ||
47 | /* source page */ | ||
48 | and s3, s2, 0x8 | ||
49 | beq s3, zero, process_entry | ||
50 | and s2, s2, ~0x8 | ||
51 | li s6, (1 << PAGE_SHIFT) / SZREG | ||
52 | |||
53 | copy_word: | ||
54 | /* copy page word by word */ | ||
55 | REG_L s5, (s2) | ||
56 | REG_S s5, (s4) | ||
57 | INT_ADD s4, s4, SZREG | ||
58 | INT_ADD s2, s2, SZREG | ||
59 | INT_SUB s6, s6, 1 | ||
60 | beq s6, zero, process_entry | ||
61 | b copy_word | ||
62 | b process_entry | ||
63 | |||
64 | done: | ||
65 | /* jump to kexec_start_address */ | ||
66 | j s1 | ||
67 | |||
68 | .globl kexec_start_address | ||
69 | kexec_start_address: | ||
70 | .long 0x0 | ||
71 | |||
72 | .globl kexec_indirection_page | ||
73 | kexec_indirection_page: | ||
74 | .long 0x0 | ||
75 | |||
76 | relocate_new_kernel_end: | ||
77 | |||
78 | .globl relocate_new_kernel_size | ||
79 | relocate_new_kernel_size: | ||
80 | .long relocate_new_kernel_end - relocate_new_kernel | ||