[SCTP]: We need to be careful when copying to sockaddr_storage.
[firewire-audio.git] / arch / mips / kernel / relocate_kernel.S
bloba3f0d00c13349aecae7997c97b530c5ea417c070
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  */
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>
17         .globl relocate_new_kernel
18 relocate_new_kernel:
20         PTR_L   s0, kexec_indirection_page
21         PTR_L   s1, kexec_start_address
23 process_entry:
24         PTR_L   s2, (s0)
25         PTR_ADD s0, s0, SZREG
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
35         /* indirection page, update s0  */
36         and     s3, s2, 0x2
37         beq     s3, zero, 1f
38         and     s0, s2, ~0x2
39         b       process_entry
42         /* done page */
43         and     s3, s2, 0x4
44         beq     s3, zero, 1f
45         b       done
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
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
64 done:
65         /* jump to kexec_start_address */
66         j       s1
68         .globl kexec_start_address
69 kexec_start_address:
70         .long   0x0
72         .globl kexec_indirection_page
73 kexec_indirection_page:
74         .long   0x0
76 relocate_new_kernel_end:
78         .globl relocate_new_kernel_size
79 relocate_new_kernel_size:
80         .long relocate_new_kernel_end - relocate_new_kernel