early_32.c (c39f2d9db0fd81ea20bb5cce9b3f082ca63753e2) | early_32.c (2b0e86cc5de6dabadc2d64cefa429fc227c8a756) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2 3/* 4 * Early init before relocation 5 */ 6 7#include <linux/init.h> 8#include <linux/kernel.h> --- 5 unchanged lines hidden (view full) --- 14 * We're called here very early in the boot. 15 * 16 * Note that the kernel may be running at an address which is different 17 * from the address that it was linked at, so we must use RELOC/PTRRELOC 18 * to access static data (including strings). -- paulus 19 */ 20notrace unsigned long __init early_init(unsigned long dt_ptr) 21{ | 1// SPDX-License-Identifier: GPL-2.0 2 3/* 4 * Early init before relocation 5 */ 6 7#include <linux/init.h> 8#include <linux/kernel.h> --- 5 unchanged lines hidden (view full) --- 14 * We're called here very early in the boot. 15 * 16 * Note that the kernel may be running at an address which is different 17 * from the address that it was linked at, so we must use RELOC/PTRRELOC 18 * to access static data (including strings). -- paulus 19 */ 20notrace unsigned long __init early_init(unsigned long dt_ptr) 21{ |
22 unsigned long offset = reloc_offset(); | 22 unsigned long kva, offset = reloc_offset(); |
23 | 23 |
24 kva = *PTRRELOC(&kernstart_virt_addr); 25 |
|
24 /* First zero the BSS */ | 26 /* First zero the BSS */ |
25 memset(PTRRELOC(&__bss_start), 0, __bss_stop - __bss_start); | 27 if (kva == KERNELBASE) 28 memset(PTRRELOC(&__bss_start), 0, __bss_stop - __bss_start); |
26 27 /* 28 * Identify the CPU type and fix up code sections 29 * that depend on which cpu we have. 30 */ 31 identify_cpu(offset, mfspr(SPRN_PVR)); 32 33 apply_feature_fixups(); 34 | 29 30 /* 31 * Identify the CPU type and fix up code sections 32 * that depend on which cpu we have. 33 */ 34 identify_cpu(offset, mfspr(SPRN_PVR)); 35 36 apply_feature_fixups(); 37 |
35 return KERNELBASE + offset; | 38 return kva + offset; |
36} | 39} |