Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bf9921a9 authored by Gerald Schaefer's avatar Gerald Schaefer Committed by Martin Schwidefsky
Browse files

s390: introduce .boot.preserved.data section



Introduce .boot.preserve.data section which is similar to .boot.data and
"shared" between the decompressor code and the decompressed kernel. The
decompressor will store values in it, and copy over to the decompressed
image before starting it. This method allows to avoid using pre-defined
addresses and other hacks to pass values between those boot phases.

Unlike .boot.data section .boot.preserved.data is NOT a part of init data,
and hence will be preserved for the kernel life time.

Signed-off-by: default avatarGerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 46a984ff
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@ struct vmlinux_info {
	unsigned long bss_size;		/* uncompressed image .bss size */
	unsigned long bootdata_off;
	unsigned long bootdata_size;
	unsigned long bootdata_preserved_off;
	unsigned long bootdata_preserved_size;
};

extern char _vmlinux_info[];
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ SECTIONS
		_edata = . ;
	}
	BOOT_DATA
	BOOT_DATA_PRESERVED

	/*
	 * uncompressed image info used by the decompressor it should match
+4 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
#include "boot.h"

extern char __boot_data_start[], __boot_data_end[];
extern char __boot_data_preserved_start[], __boot_data_preserved_end[];

void error(char *x)
{
@@ -43,6 +44,9 @@ static void copy_bootdata(void)
	if (__boot_data_end - __boot_data_start != vmlinux.bootdata_size)
		error(".boot.data section size mismatch");
	memcpy((void *)vmlinux.bootdata_off, __boot_data_start, vmlinux.bootdata_size);
	if (__boot_data_preserved_end - __boot_data_preserved_start != vmlinux.bootdata_preserved_size)
		error(".boot.preserved.data section size mismatch");
	memcpy((void *)vmlinux.bootdata_preserved_off, __boot_data_preserved_start, vmlinux.bootdata_preserved_size);
}

void startup_kernel(void)
+7 −0
Original line number Diff line number Diff line
@@ -16,4 +16,11 @@
 */
#define __bootdata(var) __section(.boot.data.var) var

/*
 * .boot.preserved.data is similar to .boot.data, but it is not part of the
 * .init section and thus will be preserved for later use in the decompressed
 * kernel.
 */
#define __bootdata_preserved(var) __section(.boot.preserved.data.var) var

#endif
+13 −0
Original line number Diff line number Diff line
@@ -18,3 +18,16 @@
		*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.boot.data*)))		\
		__boot_data_end = .;					\
	}

/*
 * .boot.preserved.data is similar to .boot.data, but it is not part of the
 * .init section and thus will be preserved for later use in the decompressed
 * kernel.
 */
#define BOOT_DATA_PRESERVED						\
	. = ALIGN(PAGE_SIZE);						\
	.boot.preserved.data : {					\
		__boot_data_preserved_start = .;			\
		*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.boot.preserved.data*))) \
		__boot_data_preserved_end = .;				\
	}
Loading