1/* 2 * relocate_kernel.S - put the kernel image in place to boot 3 * 2005.9.17 kogiidena@eggplant.ddo.jp 4 * 5 * LANDISK/sh4 is supported. Maybe, SH archtecture works well. 6 * 7 * This source code is licensed under the GNU General Public License, 8 * Version 2. See the file COPYING for more details. 9 */ 10#include <linux/linkage.h> 11#include <asm/addrspace.h> 12#include <asm/page.h> 13 14 .globl relocate_new_kernel 15relocate_new_kernel: 16 /* r4 = indirection_page */ 17 /* r5 = reboot_code_buffer */ 18 /* r6 = start_address */ 19 /* r7 = vbr_reg */ 20 21 mov.l 10f,r8 /* PAGE_SIZE */ 22 mov.l 11f,r9 /* P2SEG */ 23 24 /* stack setting */ 25 add r8,r5 26 mov r5,r15 27 28 bra 1f 29 mov r4,r0 /* cmd = indirection_page */ 300: 31 mov.l @r4+,r0 /* cmd = *ind++ */ 32 331: /* addr = (cmd | P2SEG) & 0xfffffff0 */ 34 mov r0,r2 35 or r9,r2 36 mov #-16,r1 37 and r1,r2 38 39 /* if(cmd & IND_DESTINATION) dst = addr */ 40 tst #1,r0 41 bt 2f 42 bra 0b 43 mov r2,r5 44 452: /* else if(cmd & IND_INDIRECTION) ind = addr */ 46 tst #2,r0 47 bt 3f 48 bra 0b 49 mov r2,r4 50 513: /* else if(cmd & IND_DONE) goto 6 */ 52 tst #4,r0 53 bt 4f 54 bra 6f 55 nop 56 574: /* else if(cmd & IND_SOURCE) memcpy(dst,addr,PAGE_SIZE) */ 58 tst #8,r0 59 bt 0b 60 61 mov r8,r3 62 shlr2 r3 63 shlr2 r3 645: 65 dt r3 66 mov.l @r2+,r1 /* 16n+0 */ 67 mov.l r1,@r5 68 add #4,r5 69 mov.l @r2+,r1 /* 16n+4 */ 70 mov.l r1,@r5 71 add #4,r5 72 mov.l @r2+,r1 /* 16n+8 */ 73 mov.l r1,@r5 74 add #4,r5 75 mov.l @r2+,r1 /* 16n+12 */ 76 mov.l r1,@r5 77 add #4,r5 78 bf 5b 79 80 bra 0b 81 nop 826: 83#ifdef CONFIG_SH_STANDARD_BIOS 84 ldc r7, vbr 85#endif 86 jmp @r6 87 nop 88 89 .align 2 9010: 91 .long PAGE_SIZE 9211: 93 .long P2SEG 94 95relocate_new_kernel_end: 96 97 .globl relocate_new_kernel_size 98relocate_new_kernel_size: 99 .long relocate_new_kernel_end - relocate_new_kernel 100