1 /* SPDX-License-Identifier: GPL-2.0 */
2 #include <linux/linkage.h>
4 #include <asm/asm-offsets.h>
9 #define MMU_BASE 8 /* MMU flags base in cpu_mmu_flags */
13 ENTRY(relocate_new_kernel)
14 movel %sp@(4),%a0 /* a0 = ptr */
15 movel %sp@(8),%a1 /* a1 = start */
16 movel %sp@(12),%d1 /* d1 = cpu_mmu_flags */
17 movew #PAGE_MASK,%d2 /* d2 = PAGE_MASK */
21 btst #MMU_BASE + MMUB_68851,%d1
24 1: /* 68851 or 68030 */
27 2: addl #0x00000000,%a4 /* virt_to_phys() */
29 .section ".m68k_fixup","aw"
30 .long M68K_FIXUP_MEMOFFSET, 2b+2
34 pmove %tc,%d0 /* Disable MMU */
37 jmp %a4@ /* Jump to physical .Lcopy */
41 btst #MMU_BASE + MMUB_68030,%d1
44 btst #MMU_BASE + MMUB_68040,%d1
47 4: /* 68040 or 68060 */
49 lea %pc@(.Lcont040),%a4
50 5: addl #0x00000000,%a4 /* virt_to_phys() */
52 .section ".m68k_fixup","aw"
53 .long M68K_FIXUP_MEMOFFSET, 5b+2
58 orw #0xe020,%d0 /* Map 16 MiB, enable, cacheable */
63 jmp %a4@ /* Jump to physical .Lcont040 */
68 movec %d0,%tc /* Disable MMU */
77 btst #MMU_BASE + MMUB_68060,%d1
81 movel %a0@+,%d0 /* d0 = entry = *ptr */
84 btst #2,%d0 /* entry & IND_DONE? */
87 btst #1,%d0 /* entry & IND_INDIRECTION? */
90 movel %d0,%a0 /* ptr = entry & PAGE_MASK */
94 btst #0,%d0 /* entry & IND_DESTINATION? */
97 movel %d0,%a2 /* a2 = dst = entry & PAGE_MASK */
101 btst #3,%d0 /* entry & IND_SOURCE? */
105 movel %d0,%a3 /* a3 = src = entry & PAGE_MASK */
106 movew #PAGE_SIZE/32 - 1,%d0 /* d0 = PAGE_SIZE/32 - 1 */
108 movel %a3@+,%a2@+ /* *dst++ = *src++ */
109 movel %a3@+,%a2@+ /* *dst++ = *src++ */
110 movel %a3@+,%a2@+ /* *dst++ = *src++ */
111 movel %a3@+,%a2@+ /* *dst++ = *src++ */
112 movel %a3@+,%a2@+ /* *dst++ = *src++ */
113 movel %a3@+,%a2@+ /* *dst++ = *src++ */
114 movel %a3@+,%a2@+ /* *dst++ = *src++ */
115 movel %a3@+,%a2@+ /* *dst++ = *src++ */
120 /* Flush all caches */
125 1: /* 68020 or 68030 */
140 3: /* 68040 or 68060 */
157 relocate_new_kernel_end:
159 ENTRY(relocate_new_kernel_size)
160 .long relocate_new_kernel_end - relocate_new_kernel