diff options
author | Alexander Gordeev <agordeev@linux.ibm.com> | 2021-08-06 12:55:09 +0200 |
---|---|---|
committer | Heiko Carstens <hca@linux.ibm.com> | 2021-08-25 11:03:33 +0200 |
commit | e8f06683d40e705da2d85bc6bc498e651d1ef31b (patch) | |
tree | 989d05717c8d6479ebe1789ba1c7474c421fd872 | |
parent | ddd63c85ef67ea9ea7282ad35eafb6568047126e (diff) | |
download | linux-e8f06683d40e705da2d85bc6bc498e651d1ef31b.tar.bz2 |
s390/boot: factor out offset_vmlinux_info() function
Move offsetting all of vmlinux_info fields to a separate
function for better readability.
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
-rw-r--r-- | arch/s390/boot/startup.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/arch/s390/boot/startup.c b/arch/s390/boot/startup.c index 6188be11de57..6dc8d0a53864 100644 --- a/arch/s390/boot/startup.c +++ b/arch/s390/boot/startup.c @@ -248,6 +248,17 @@ static void setup_vmalloc_size(void) vmalloc_size = max(size, vmalloc_size); } +static void offset_vmlinux_info(unsigned long offset) +{ + vmlinux.default_lma += offset; + *(unsigned long *)(&vmlinux.entry) += offset; + vmlinux.bootdata_off += offset; + vmlinux.bootdata_preserved_off += offset; + vmlinux.rela_dyn_start += offset; + vmlinux.rela_dyn_end += offset; + vmlinux.dynsym_start += offset; +} + void startup_kernel(void) { unsigned long random_lma; @@ -273,19 +284,12 @@ void startup_kernel(void) setup_vmalloc_size(); setup_kernel_memory_layout(); - random_lma = __kaslr_offset = 0; if (IS_ENABLED(CONFIG_RANDOMIZE_BASE) && kaslr_enabled) { random_lma = get_random_base(safe_addr); if (random_lma) { __kaslr_offset = random_lma - vmlinux.default_lma; img = (void *)vmlinux.default_lma; - vmlinux.default_lma += __kaslr_offset; - *(unsigned long *)(&vmlinux.entry) += __kaslr_offset; - vmlinux.bootdata_off += __kaslr_offset; - vmlinux.bootdata_preserved_off += __kaslr_offset; - vmlinux.rela_dyn_start += __kaslr_offset; - vmlinux.rela_dyn_end += __kaslr_offset; - vmlinux.dynsym_start += __kaslr_offset; + offset_vmlinux_info(__kaslr_offset); } } |