Commit a2ac1bb1 authored by Vasily Gorbik's avatar Vasily Gorbik Committed by Martin Schwidefsky

s390/decompressor: get rid of .bss usage

Using .bss in early code should be avoided. It might overlay initrd
image or not yet be initialized. Clean up the last couple of places in
the decompressor's code where .bss is used and enfore no .bss usage
check on boot/compressed/misc.c. In particular:
- initializing free_mem_ptr and free_mem_end_ptr with values guarantee
that these variables won't end up in the .bss section.
- define STATIC_RW_DATA to go into .data section.
Reviewed-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 369f91c3
...@@ -62,6 +62,6 @@ OBJCOPYFLAGS_piggy.o := -I binary -O elf64-s390 -B s390:64-bit --rename-section ...@@ -62,6 +62,6 @@ OBJCOPYFLAGS_piggy.o := -I binary -O elf64-s390 -B s390:64-bit --rename-section
$(obj)/piggy.o: $(obj)/vmlinux.bin$(suffix-y) FORCE $(obj)/piggy.o: $(obj)/vmlinux.bin$(suffix-y) FORCE
$(call if_changed,objcopy) $(call if_changed,objcopy)
chkbss := $(filter-out $(obj)/misc.o $(obj)/piggy.o $(obj)/info.o,$(OBJECTS)) chkbss := $(filter-out $(obj)/piggy.o $(obj)/info.o,$(OBJECTS))
chkbss-target := $(obj)/vmlinux.bin chkbss-target := $(obj)/vmlinux.bin
include $(srctree)/arch/s390/scripts/Makefile.chkbss include $(srctree)/arch/s390/scripts/Makefile.chkbss
...@@ -11,12 +11,14 @@ ...@@ -11,12 +11,14 @@
#include <asm/page.h> #include <asm/page.h>
#include <asm/sclp.h> #include <asm/sclp.h>
#include <asm/ipl.h> #include <asm/ipl.h>
#include <asm/sections.h>
#include "decompressor.h" #include "decompressor.h"
/* /*
* gzip declarations * gzip declarations
*/ */
#define STATIC static #define STATIC static
#define STATIC_RW_DATA static __section(.data)
#undef memset #undef memset
#undef memcpy #undef memcpy
...@@ -26,21 +28,20 @@ ...@@ -26,21 +28,20 @@
/* Symbols defined by linker scripts */ /* Symbols defined by linker scripts */
extern char _end[]; extern char _end[];
extern char _bss[], _ebss[];
extern unsigned char _compressed_start[]; extern unsigned char _compressed_start[];
extern unsigned char _compressed_end[]; extern unsigned char _compressed_end[];
static void error(char *m); static void error(char *m);
static unsigned long free_mem_ptr;
static unsigned long free_mem_end_ptr;
#ifdef CONFIG_HAVE_KERNEL_BZIP2 #ifdef CONFIG_HAVE_KERNEL_BZIP2
#define HEAP_SIZE 0x400000 #define HEAP_SIZE 0x400000
#else #else
#define HEAP_SIZE 0x10000 #define HEAP_SIZE 0x10000
#endif #endif
static unsigned long free_mem_ptr = (unsigned long) _end;
static unsigned long free_mem_end_ptr = (unsigned long) _end + HEAP_SIZE;
#ifdef CONFIG_KERNEL_GZIP #ifdef CONFIG_KERNEL_GZIP
#include "../../../../lib/decompress_inflate.c" #include "../../../../lib/decompress_inflate.c"
#endif #endif
...@@ -102,14 +103,6 @@ void *decompress_kernel(void) ...@@ -102,14 +103,6 @@ void *decompress_kernel(void)
} }
#endif #endif
/*
* Clear bss section. free_mem_ptr and free_mem_end_ptr need to be
* initialized afterwards since they reside in bss.
*/
memset(_bss, 0, _ebss - _bss);
free_mem_ptr = (unsigned long) _end;
free_mem_end_ptr = free_mem_ptr + HEAP_SIZE;
__decompress(_compressed_start, _compressed_end - _compressed_start, __decompress(_compressed_start, _compressed_end - _compressed_start,
NULL, NULL, output, 0, NULL, error); NULL, NULL, output, 0, NULL, error);
return output; return output;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment