~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/arm/kernel/relocate_kernel.S

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * relocate_kernel.S - put the kernel image in place to boot
  4  */
  5 
  6 #include <linux/linkage.h>
  7 #include <asm/assembler.h>
  8 #include <asm/asm-offsets.h>
  9 #include <asm/kexec.h>
 10 
 11         .align  3       /* not needed for this code, but keeps fncpy() happy */
 12 
 13 ENTRY(relocate_new_kernel)
 14 
 15         adr     r7, relocate_new_kernel_end
 16         ldr     r0, [r7, #KEXEC_INDIR_PAGE]
 17         ldr     r1, [r7, #KEXEC_START_ADDR]
 18 
 19         /*
 20          * If there is no indirection page (we are doing crashdumps)
 21          * skip any relocation.
 22          */
 23         cmp     r0, #0
 24         beq     2f
 25 
 26 0:      /* top, read another word for the indirection page */
 27         ldr     r3, [r0],#4
 28 
 29         /* Is it a destination page. Put destination address to r4 */
 30         tst     r3,#1
 31         beq     1f
 32         bic     r4,r3,#1
 33         b       0b
 34 1:
 35         /* Is it an indirection page */
 36         tst     r3,#2
 37         beq     1f
 38         bic     r0,r3,#2
 39         b       0b
 40 1:
 41 
 42         /* are we done ? */
 43         tst     r3,#4
 44         beq     1f
 45         b       2f
 46 
 47 1:
 48         /* is it source ? */
 49         tst     r3,#8
 50         beq     0b
 51         bic r3,r3,#8
 52         mov r6,#1024
 53 9:
 54         ldr r5,[r3],#4
 55         str r5,[r4],#4
 56         subs r6,r6,#1
 57         bne 9b
 58         b 0b
 59 
 60 2:
 61         /* Jump to relocated kernel */
 62         mov     lr, r1
 63         mov     r0, #0
 64         ldr     r1, [r7, #KEXEC_MACH_TYPE]
 65         ldr     r2, [r7, #KEXEC_R2]
 66  ARM(   ret     lr      )
 67  THUMB( bx      lr      )
 68 
 69 ENDPROC(relocate_new_kernel)
 70 
 71         .align  3
 72 relocate_new_kernel_end:
 73 
 74         .globl relocate_new_kernel_size
 75 relocate_new_kernel_size:
 76         .long relocate_new_kernel_end - relocate_new_kernel
 77 
 78 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php