diff options
Diffstat (limited to 'arch/arm/boot/compressed')
| -rw-r--r-- | arch/arm/boot/compressed/.gitignore | 1 | ||||
| -rw-r--r-- | arch/arm/boot/compressed/Makefile | 21 | ||||
| -rw-r--r-- | arch/arm/boot/compressed/atags_to_fdt.c | 2 | ||||
| -rw-r--r-- | arch/arm/boot/compressed/head-shark.S | 140 | ||||
| -rw-r--r-- | arch/arm/boot/compressed/head.S | 14 | ||||
| -rw-r--r-- | arch/arm/boot/compressed/misc.c | 14 | ||||
| -rw-r--r-- | arch/arm/boot/compressed/ofw-shark.c | 260 | 
7 files changed, 32 insertions, 420 deletions
diff --git a/arch/arm/boot/compressed/.gitignore b/arch/arm/boot/compressed/.gitignore index 47279aa96a6..0714e0334e3 100644 --- a/arch/arm/boot/compressed/.gitignore +++ b/arch/arm/boot/compressed/.gitignore @@ -1,4 +1,5 @@  ashldi3.S +bswapsdi2.S  font.c  lib1funcs.S  hyp-stub.S diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile index 7ac1610252b..68c918362b7 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile @@ -44,10 +44,6 @@ ifeq ($(CONFIG_ARCH_ACORN),y)  OBJS		+= ll_char_wr.o font.o  endif -ifeq ($(CONFIG_ARCH_SHARK),y) -OBJS		+= head-shark.o ofw-shark.o -endif -  ifeq ($(CONFIG_ARCH_SA1100),y)  OBJS		+= head-sa1100.o  endif @@ -68,7 +64,7 @@ else  endif  endif -ifeq ($(CONFIG_ARCH_SHMOBILE),y) +ifeq ($(CONFIG_ARCH_SHMOBILE_LEGACY),y)  OBJS		+= head-shmobile.o  endif @@ -112,12 +108,12 @@ endif  targets       := vmlinux vmlinux.lds \  		 piggy.$(suffix_y) piggy.$(suffix_y).o \ -		 lib1funcs.o lib1funcs.S ashldi3.o ashldi3.S \ -		 font.o font.c head.o misc.o $(OBJS) +		 lib1funcs.o lib1funcs.S ashldi3.o ashldi3.S bswapsdi2.o \ +		 bswapsdi2.S font.o font.c head.o misc.o $(OBJS)  # Make sure files are removed during clean  extra-y       += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern piggy.lz4 \ -		 lib1funcs.S ashldi3.S $(libfdt) $(libfdt_hdrs) \ +		 lib1funcs.S ashldi3.S bswapsdi2.S $(libfdt) $(libfdt_hdrs) \  		 hyp-stub.S  ifeq ($(CONFIG_FUNCTION_TRACER),y) @@ -160,6 +156,12 @@ ashldi3 = $(obj)/ashldi3.o  $(obj)/ashldi3.S: $(srctree)/arch/$(SRCARCH)/lib/ashldi3.S  	$(call cmd,shipped) +# For __bswapsi2, __bswapdi2 +bswapsdi2 = $(obj)/bswapsdi2.o + +$(obj)/bswapsdi2.S: $(srctree)/arch/$(SRCARCH)/lib/bswapsdi2.S +	$(call cmd,shipped) +  # We need to prevent any GOTOFF relocs being used with references  # to symbols in the .bss section since we cannot relocate them  # independently from the rest at run time.  This can be achieved by @@ -181,7 +183,8 @@ if [ $(words $(ZRELADDR)) -gt 1 -a "$(CONFIG_AUTO_ZRELADDR)" = "" ]; then \  fi  $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \ -		$(addprefix $(obj)/, $(OBJS)) $(lib1funcs) $(ashldi3) FORCE +		$(addprefix $(obj)/, $(OBJS)) $(lib1funcs) $(ashldi3) \ +		$(bswapsdi2) FORCE  	@$(check_for_multiple_zreladdr)  	$(call if_changed,ld)  	@$(check_for_bad_syms) diff --git a/arch/arm/boot/compressed/atags_to_fdt.c b/arch/arm/boot/compressed/atags_to_fdt.c index d1153c8a765..9448aa0c668 100644 --- a/arch/arm/boot/compressed/atags_to_fdt.c +++ b/arch/arm/boot/compressed/atags_to_fdt.c @@ -7,6 +7,8 @@  #define do_extend_cmdline 0  #endif +#define NR_BANKS 16 +  static int node_offset(void *fdt, const char *node_path)  {  	int offset = fdt_path_offset(fdt, node_path); diff --git a/arch/arm/boot/compressed/head-shark.S b/arch/arm/boot/compressed/head-shark.S deleted file mode 100644 index 92b56897ed6..00000000000 --- a/arch/arm/boot/compressed/head-shark.S +++ /dev/null @@ -1,140 +0,0 @@ -/* The head-file for the Shark - * by Alexander Schulz - * - * Does the following: - * - get the memory layout from firmware. This can only be done as long as the mmu - *   is still on. - * - switch the mmu off, so we have physical addresses - * - copy the kernel to 0x08508000. This is done to have a fixed address where the - *   C-parts (misc.c) are executed. This address must be known at compile-time, - *   but the load-address of the kernel depends on how much memory is installed. - * - Jump to this location. - * - Set r8 with 0, r7 with the architecture ID for head.S - */ - -#include <linux/linkage.h> - -#include <asm/assembler.h> -	 -		.section	".start", "ax" - -		.arch armv4 -		b	__beginning -	 -__ofw_data:	.long	0				@ the number of memory blocks -		.space  128				@ (startaddr,size) ... -		.space  128				@ bootargs -		.align - -__beginning:	mov	r4, r0				@ save the entry to the firmware - -		mov	r0, #0xC0			@ disable irq and fiq -		mov	r1, r0 -		mrs	r3, cpsr -		bic	r2, r3, r0 -		eor	r2, r2, r1 -		msr	cpsr_c, r2 - -		mov	r0, r4				@ get the Memory layout from firmware -		adr	r1, __ofw_data -		add	r2, r1, #4 -		mov	lr, pc -		b	ofw_init -		mov	r1, #0 - -		adr	r2, __mmu_off			@ calculate physical address -		sub	r2, r2, #0xf0000000		@ openprom maps us at f000 virt, 0e50 phys -		adr	r0, __ofw_data -		ldr	r0, [r0, #4] -		add	r2, r2, r0 -		add	r2, r2, #0x00500000 - -		mrc	p15, 0, r3, c1, c0 -		bic	r3, r3, #0xC			@ Write Buffer and DCache -		bic	r3, r3, #0x1000			@ ICache -		mcr	p15, 0, r3, c1, c0		@ disabled - -		mov	r0, #0 -		mcr	p15, 0, r0, c7, c7		@ flush I,D caches on v4 -		mcr	p15, 0, r0, c7, c10, 4		@ drain write buffer on v4 -		mcr	p15, 0, r0, c8, c7		@ flush I,D TLBs on v4 - -		bic	r3, r3, #0x1			@ MMU -		mcr	p15, 0, r3, c1, c0		@ disabled - -		mov	pc, r2 - -__copy_target:	.long	0x08507FFC -__copy_end:	.long	0x08607FFC -		 -		.word	_start -		.word	__bss_start - -		.align -__temp_stack:	.space 128 - -__mmu_off: -		adr	r0, __ofw_data			@ read the 1. entry of the memory map -		ldr	r0, [r0, #4] -		orr	r0, r0, #0x00600000 -		sub	r0, r0, #4 -	 -		ldr	r1, __copy_end -		ldr	r3, __copy_target - -/* r0 = 0x0e600000 (current end of kernelcode) - * r3 = 0x08508000 (where it should begin) - * r1 = 0x08608000 (end of copying area, 1MB) - * The kernel is compressed, so 1 MB should be enough. - * copy the kernel to the beginning of physical memory - * We start from the highest address, so we can copy - * from 0x08500000 to 0x08508000 if we have only 8MB - */ - -/* As we get more 2.6-kernels it gets more and more - * uncomfortable to be bound to kernel images of 1MB only. - * So we add a loop here, to be able to copy some more. - * Alexander Schulz 2005-07-17 - */ - -		mov	r4, #3				@ How many megabytes to copy - - -__MoveCode:	sub	r4, r4, #1 -	 -__Copy:		ldr	r2, [r0], #-4 -		str	r2, [r1], #-4 -		teq	r1, r3 -		bne	__Copy - -		/* The firmware maps us in blocks of 1 MB, the next block is -		   _below_ the last one. So our decrementing source pointer -		   ist right here, but the destination pointer must be increased -		   by 2 MB */ -		add	r1, r1, #0x00200000 -		add	r3, r3, #0x00100000 - -		teq	r4, #0 -		bne	__MoveCode - - -		/* and jump to it */ -		adr	r2, __go_on			@ where we want to jump -		adr	r0, __ofw_data			@ read the 1. entry of the memory map -		ldr	r0, [r0, #4] -		sub	r2, r2, r0			@ we are mapped add 0e50 now, sub that (-0e00) -		sub	r2, r2, #0x00500000		@ -0050 -		ldr	r0, __copy_target		@ and add 0850 8000 instead -		add	r0, r0, #4 -		add	r2, r2, r0 -		mov	pc, r2				@ and jump there - -__go_on: -		adr	sp, __temp_stack -		add	sp, sp, #128 -		adr	r0, __ofw_data -		mov	lr, pc -		b	create_params -	 -		mov	r8, #0 -		mov	r7, #15 diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index 75189f13cf5..3a8b32df6b3 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -60,11 +60,6 @@  		add	\rb, \rb, #0x00010000	@ Ser1  #endif  		.endm -#elif defined(CONFIG_ARCH_S3C24XX) -		.macro loadsp, rb, tmp -		mov	\rb, #0x50000000 -		add	\rb, \rb, #0x4000 * CONFIG_S3C_LOWLEVEL_UART_PORT -		.endm  #else  		.macro	loadsp,	rb, tmp  		addruart \rb, \tmp @@ -135,6 +130,7 @@ start:  		.word	_edata			@ zImage end address   THUMB(		.thumb			)  1: + ARM_BE8(	setend	be )			@ go BE8 if compiled for BE8  		mrs	r9, cpsr  #ifdef CONFIG_ARM_VIRT_EXT  		bl	__hyp_stub_install	@ get into SVC mode, reversibly @@ -699,9 +695,7 @@ __armv4_mmu_cache_on:  		mrc	p15, 0, r0, c1, c0, 0	@ read control reg  		orr	r0, r0, #0x5000		@ I-cache enable, RR cache replacement  		orr	r0, r0, #0x0030 -#ifdef CONFIG_CPU_ENDIAN_BE8 -		orr	r0, r0, #1 << 25	@ big-endian page tables -#endif + ARM_BE8(	orr	r0, r0, #1 << 25 )	@ big-endian page tables  		bl	__common_mmu_cache_on  		mov	r0, #0  		mcr	p15, 0, r0, c8, c7, 0	@ flush I,D TLBs @@ -728,9 +722,7 @@ __armv7_mmu_cache_on:  		orr	r0, r0, #1 << 22	@ U (v6 unaligned access model)  						@ (needed for ARM1176)  #ifdef CONFIG_MMU -#ifdef CONFIG_CPU_ENDIAN_BE8 -		orr	r0, r0, #1 << 25	@ big-endian page tables -#endif + ARM_BE8(	orr	r0, r0, #1 << 25 )	@ big-endian page tables  		mrcne   p15, 0, r6, c2, c0, 2   @ read ttb control reg  		orrne	r0, r0, #1		@ MMU enabled  		movne	r1, #0xfffffffd		@ domain 0 = client diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c index 31bd43b8209..d4f891f5699 100644 --- a/arch/arm/boot/compressed/misc.c +++ b/arch/arm/boot/compressed/misc.c @@ -127,6 +127,18 @@ asmlinkage void __div0(void)  	error("Attempting division by 0!");  } +unsigned long __stack_chk_guard; + +void __stack_chk_guard_setup(void) +{ +	__stack_chk_guard = 0x000a0dff; +} + +void __stack_chk_fail(void) +{ +	error("stack-protector: Kernel stack is corrupted\n"); +} +  extern int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x)); @@ -137,6 +149,8 @@ decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p,  {  	int ret; +	__stack_chk_guard_setup(); +  	output_data		= (unsigned char *)output_start;  	free_mem_ptr		= free_mem_ptr_p;  	free_mem_end_ptr	= free_mem_ptr_end_p; diff --git a/arch/arm/boot/compressed/ofw-shark.c b/arch/arm/boot/compressed/ofw-shark.c deleted file mode 100644 index 465c54b6b12..00000000000 --- a/arch/arm/boot/compressed/ofw-shark.c +++ /dev/null @@ -1,260 +0,0 @@ -/* - * linux/arch/arm/boot/compressed/ofw-shark.c - * - * by Alexander Schulz - * - * This file is used to get some basic information - * about the memory layout of the shark we are running - * on. Memory is usually divided in blocks a 8 MB. - * And bootargs are copied from OpenFirmware. - */ - - -#include <linux/kernel.h> -#include <linux/types.h> -#include <asm/setup.h> -#include <asm/page.h> - - -asmlinkage void -create_params (unsigned long *buffer) -{ -	/* Is there a better address? Also change in mach-shark/core.c */ -	struct tag *tag = (struct tag *) 0x08003000; -	int j,i,m,k,nr_banks,size; -	unsigned char *c; - -	k = 0; - -	/* Head of the taglist */ -	tag->hdr.tag  = ATAG_CORE; -	tag->hdr.size = tag_size(tag_core); -	tag->u.core.flags = 1; -	tag->u.core.pagesize = PAGE_SIZE; -	tag->u.core.rootdev = 0; - -	/* Build up one tagged block for each memory region */ -	size=0; -	nr_banks=(unsigned int) buffer[0]; -	for (j=0;j<nr_banks;j++){ -		/* search the lowest address and put it into the next entry   */ -		/* not a fast sort algorithm, but there are at most 8 entries */ -		/* and this is used only once anyway                          */ -		m=0xffffffff; -		for (i=0;i<(unsigned int) buffer[0];i++){ -			if (buffer[2*i+1]<m) { -				m=buffer[2*i+1]; -				k=i; -			} -		} -	   -		tag = tag_next(tag); -		tag->hdr.tag = ATAG_MEM; -		tag->hdr.size = tag_size(tag_mem32); -		tag->u.mem.size = buffer[2*k+2]; -		tag->u.mem.start = buffer[2*k+1]; - -		size += buffer[2*k+2]; - -		buffer[2*k+1]=0xffffffff;                    /* mark as copied */ -	} -	 -	/* The command line */ -	tag = tag_next(tag); -	tag->hdr.tag = ATAG_CMDLINE; -	 -	c=(unsigned char *)(&buffer[34]); -	j=0; -	while (*c) tag->u.cmdline.cmdline[j++]=*c++; - -	tag->u.cmdline.cmdline[j]=0; -	tag->hdr.size = (j + 7 + sizeof(struct tag_header)) >> 2; - -	/* Hardware revision */ -	tag = tag_next(tag); -	tag->hdr.tag = ATAG_REVISION; -	tag->hdr.size = tag_size(tag_revision); -	tag->u.revision.rev = ((unsigned char) buffer[33])-'0'; - -	/* End of the taglist */ -	tag = tag_next(tag); -	tag->hdr.tag = 0; -	tag->hdr.size = 0; -} - - -typedef int (*ofw_handle_t)(void *); - -/* Everything below is called with a wrong MMU setting. - * This means: no string constants, no initialization of - * arrays, no global variables! This is ugly but I didn't - * want to write this in assembler :-) - */ - -int -of_decode_int(const unsigned char *p) -{ -	unsigned int i = *p++ << 8; -	i = (i + *p++) << 8; -	i = (i + *p++) << 8; -	return (i + *p); -} -   -int -OF_finddevice(ofw_handle_t openfirmware, char *name) -{ -	unsigned int args[8]; -	char service[12]; - -	service[0]='f'; -	service[1]='i'; -	service[2]='n'; -	service[3]='d'; -	service[4]='d'; -	service[5]='e'; -	service[6]='v'; -	service[7]='i'; -	service[8]='c'; -	service[9]='e'; -	service[10]='\0'; - -	args[0]=(unsigned int)service; -	args[1]=1; -	args[2]=1; -	args[3]=(unsigned int)name; - -	if (openfirmware(args) == -1) -		return -1; -	return args[4]; -} - -int -OF_getproplen(ofw_handle_t openfirmware, int handle, char *prop) -{ -	unsigned int args[8]; -	char service[12]; - -	service[0]='g'; -	service[1]='e'; -	service[2]='t'; -	service[3]='p'; -	service[4]='r'; -	service[5]='o'; -	service[6]='p'; -	service[7]='l'; -	service[8]='e'; -	service[9]='n'; -	service[10]='\0'; - -	args[0] = (unsigned int)service; -	args[1] = 2; -	args[2] = 1; -	args[3] = (unsigned int)handle; -	args[4] = (unsigned int)prop; - -	if (openfirmware(args) == -1) -		return -1; -	return args[5]; -} -   -int -OF_getprop(ofw_handle_t openfirmware, int handle, char *prop, void *buf, unsigned int buflen) -{ -	unsigned int args[8]; -	char service[8]; - -	service[0]='g'; -	service[1]='e'; -	service[2]='t'; -	service[3]='p'; -	service[4]='r'; -	service[5]='o'; -	service[6]='p'; -	service[7]='\0'; - -	args[0] = (unsigned int)service; -	args[1] = 4; -	args[2] = 1; -	args[3] = (unsigned int)handle; -	args[4] = (unsigned int)prop; -	args[5] = (unsigned int)buf; -	args[6] = buflen; - -	if (openfirmware(args) == -1) -		return -1; -	return args[7]; -} -   -asmlinkage void ofw_init(ofw_handle_t o, int *nomr, int *pointer) -{ -	int phandle,i,mem_len,buffer[32]; -	char temp[15]; -   -	temp[0]='/'; -	temp[1]='m'; -	temp[2]='e'; -	temp[3]='m'; -	temp[4]='o'; -	temp[5]='r'; -	temp[6]='y'; -	temp[7]='\0'; - -	phandle=OF_finddevice(o,temp); - -	temp[0]='r'; -	temp[1]='e'; -	temp[2]='g'; -	temp[3]='\0'; - -	mem_len = OF_getproplen(o,phandle, temp); -	OF_getprop(o,phandle, temp, buffer, mem_len); -	*nomr=mem_len >> 3; - -	for (i=0; i<=mem_len/4; i++) pointer[i]=of_decode_int((const unsigned char *)&buffer[i]); - -	temp[0]='/'; -	temp[1]='c'; -	temp[2]='h'; -	temp[3]='o'; -	temp[4]='s'; -	temp[5]='e'; -	temp[6]='n'; -	temp[7]='\0'; - -	phandle=OF_finddevice(o,temp); - -	temp[0]='b'; -	temp[1]='o'; -	temp[2]='o'; -	temp[3]='t'; -	temp[4]='a'; -	temp[5]='r'; -	temp[6]='g'; -	temp[7]='s'; -	temp[8]='\0'; - -	mem_len = OF_getproplen(o,phandle, temp); -	OF_getprop(o,phandle, temp, buffer, mem_len); -	if (mem_len > 128) mem_len=128; -	for (i=0; i<=mem_len/4; i++) pointer[i+33]=buffer[i]; -	pointer[i+33]=0; - -	temp[0]='/'; -	temp[1]='\0'; -	phandle=OF_finddevice(o,temp); -	temp[0]='b'; -	temp[1]='a'; -	temp[2]='n'; -	temp[3]='n'; -	temp[4]='e'; -	temp[5]='r'; -	temp[6]='-'; -	temp[7]='n'; -	temp[8]='a'; -	temp[9]='m'; -	temp[10]='e'; -	temp[11]='\0'; -	mem_len = OF_getproplen(o,phandle, temp); -	OF_getprop(o,phandle, temp, buffer, mem_len); -	* ((unsigned char *) &pointer[32]) = ((unsigned char *) buffer)[mem_len-2]; -}  | 
