ARM: use r9 for gd
To be more EABI compliant and as a preparation for building with clang, use the platform-specific r9 register for gd instead of r8. note: The FIQ is not updated since it is not used in u-boot, and under discussion for the time being. The following checkpatch warning is ignored: WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl> cc: Albert ARIBAUD <albert.u.boot@aribaud.net>
This commit is contained in:
		
							parent
							
								
									a81872ff27
								
							
						
					
					
						commit
						fe1378a961
					
				|  | @ -17,7 +17,7 @@ endif | ||||||
| 
 | 
 | ||||||
| LDFLAGS_FINAL += --gc-sections | LDFLAGS_FINAL += --gc-sections | ||||||
| PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections \
 | PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections \
 | ||||||
|                      -fno-common -ffixed-r8 -msoft-float |                      -fno-common -ffixed-r9 -msoft-float | ||||||
| 
 | 
 | ||||||
| # Support generic board on ARM
 | # Support generic board on ARM
 | ||||||
| __HAVE_ARCH_GENERIC_BOARD := y | __HAVE_ARCH_GENERIC_BOARD := y | ||||||
|  |  | ||||||
|  | @ -22,11 +22,11 @@ ENTRY(lowlevel_init) | ||||||
| 	ldr	sp, =CONFIG_SYS_INIT_SP_ADDR | 	ldr	sp, =CONFIG_SYS_INIT_SP_ADDR | ||||||
| 	bic	sp, sp, #7 /* 8-byte alignment for ABI compliance */ | 	bic	sp, sp, #7 /* 8-byte alignment for ABI compliance */ | ||||||
| #ifdef CONFIG_SPL_BUILD | #ifdef CONFIG_SPL_BUILD | ||||||
| 	ldr	r8, =gdata | 	ldr	r9, =gdata | ||||||
| #else | #else | ||||||
| 	sub	sp, #GD_SIZE | 	sub	sp, #GD_SIZE | ||||||
| 	bic	sp, sp, #7 | 	bic	sp, sp, #7 | ||||||
| 	mov	r8, sp | 	mov	r9, sp | ||||||
| #endif | #endif | ||||||
| 	/* | 	/* | ||||||
| 	 * Save the old lr(passed in ip) and the current lr to stack | 	 * Save the old lr(passed in ip) and the current lr to stack | ||||||
|  |  | ||||||
|  | @ -47,6 +47,6 @@ struct arch_global_data { | ||||||
| 
 | 
 | ||||||
| #include <asm-generic/global_data.h> | #include <asm-generic/global_data.h> | ||||||
| 
 | 
 | ||||||
| #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r8") | #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r9") | ||||||
| 
 | 
 | ||||||
| #endif /* __ASM_GBL_DATA_H */ | #endif /* __ASM_GBL_DATA_H */ | ||||||
|  |  | ||||||
|  | @ -69,7 +69,7 @@ ENTRY(_main) | ||||||
| 	bic	sp, sp, #7	/* 8-byte alignment for ABI compliance */ | 	bic	sp, sp, #7	/* 8-byte alignment for ABI compliance */ | ||||||
| 	sub	sp, #GD_SIZE	/* allocate one GD above SP */ | 	sub	sp, #GD_SIZE	/* allocate one GD above SP */ | ||||||
| 	bic	sp, sp, #7	/* 8-byte alignment for ABI compliance */ | 	bic	sp, sp, #7	/* 8-byte alignment for ABI compliance */ | ||||||
| 	mov	r8, sp		/* GD is above SP */ | 	mov	r9, sp		/* GD is above SP */ | ||||||
| 	mov	r0, #0 | 	mov	r0, #0 | ||||||
| 	bl	board_init_f | 	bl	board_init_f | ||||||
| 
 | 
 | ||||||
|  | @ -81,15 +81,15 @@ ENTRY(_main) | ||||||
|  * 'here' but relocated. |  * 'here' but relocated. | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| 	ldr	sp, [r8, #GD_START_ADDR_SP]	/* sp = gd->start_addr_sp */ | 	ldr	sp, [r9, #GD_START_ADDR_SP]	/* sp = gd->start_addr_sp */ | ||||||
| 	bic	sp, sp, #7	/* 8-byte alignment for ABI compliance */ | 	bic	sp, sp, #7	/* 8-byte alignment for ABI compliance */ | ||||||
| 	ldr	r8, [r8, #GD_BD]		/* r8 = gd->bd */ | 	ldr	r9, [r9, #GD_BD]		/* r9 = gd->bd */ | ||||||
| 	sub	r8, r8, #GD_SIZE		/* new GD is below bd */ | 	sub	r9, r9, #GD_SIZE		/* new GD is below bd */ | ||||||
| 
 | 
 | ||||||
| 	adr	lr, here | 	adr	lr, here | ||||||
| 	ldr	r0, [r8, #GD_RELOC_OFF]		/* r0 = gd->reloc_off */ | 	ldr	r0, [r9, #GD_RELOC_OFF]		/* r0 = gd->reloc_off */ | ||||||
| 	add	lr, lr, r0 | 	add	lr, lr, r0 | ||||||
| 	ldr	r0, [r8, #GD_RELOCADDR]		/* r0 = gd->relocaddr */ | 	ldr	r0, [r9, #GD_RELOCADDR]		/* r0 = gd->relocaddr */ | ||||||
| 	b	relocate_code | 	b	relocate_code | ||||||
| here: | here: | ||||||
| 
 | 
 | ||||||
|  | @ -111,8 +111,8 @@ clbss_l:cmp	r0, r1			/* while not at end of BSS */ | ||||||
| 	bl red_led_on | 	bl red_led_on | ||||||
| 
 | 
 | ||||||
| 	/* call board_init_r(gd_t *id, ulong dest_addr) */ | 	/* call board_init_r(gd_t *id, ulong dest_addr) */ | ||||||
| 	mov	r0, r8			/* gd_t */ | 	mov     r0, r9                  /* gd_t */ | ||||||
| 	ldr	r1, [r8, #GD_RELOCADDR]	/* dest_addr */ | 	ldr	r1, [r9, #GD_RELOCADDR]	/* dest_addr */ | ||||||
| 	/* call board_init_r */ | 	/* call board_init_r */ | ||||||
| 	ldr	pc, =board_init_r	/* this is auto-relocated! */ | 	ldr	pc, =board_init_r	/* this is auto-relocated! */ | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue