Skip to content

Commit e8f0668

Browse files
Alexander Gordeevhcahca
authored andcommitted
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>
1 parent ddd63c8 commit e8f0668

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

‎arch/s390/boot/startup.c‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,17 @@ static void setup_vmalloc_size(void)
248248
vmalloc_size = max(size, vmalloc_size);
249249
}
250250

251+
static void offset_vmlinux_info(unsigned long offset)
252+
{
253+
vmlinux.default_lma += offset;
254+
*(unsigned long *)(&vmlinux.entry) += offset;
255+
vmlinux.bootdata_off += offset;
256+
vmlinux.bootdata_preserved_off += offset;
257+
vmlinux.rela_dyn_start += offset;
258+
vmlinux.rela_dyn_end += offset;
259+
vmlinux.dynsym_start += offset;
260+
}
261+
251262
void startup_kernel(void)
252263
{
253264
unsigned long random_lma;
@@ -273,19 +284,12 @@ void startup_kernel(void)
273284
setup_vmalloc_size();
274285
setup_kernel_memory_layout();
275286

276-
random_lma = __kaslr_offset = 0;
277287
if (IS_ENABLED(CONFIG_RANDOMIZE_BASE) && kaslr_enabled) {
278288
random_lma = get_random_base(safe_addr);
279289
if (random_lma) {
280290
__kaslr_offset = random_lma - vmlinux.default_lma;
281291
img = (void *)vmlinux.default_lma;
282-
vmlinux.default_lma += __kaslr_offset;
283-
*(unsigned long *)(&vmlinux.entry) += __kaslr_offset;
284-
vmlinux.bootdata_off += __kaslr_offset;
285-
vmlinux.bootdata_preserved_off += __kaslr_offset;
286-
vmlinux.rela_dyn_start += __kaslr_offset;
287-
vmlinux.rela_dyn_end += __kaslr_offset;
288-
vmlinux.dynsym_start += __kaslr_offset;
292+
offset_vmlinux_info(__kaslr_offset);
289293
}
290294
}
291295

0 commit comments

Comments
 (0)