Dear Albert ARIBAUD, In message <4ce0388e.2070...@free.fr> you wrote: > > > Register use is documented in the top level README. > > My bad: I'd missed that one because I always go straight to the doc/ > directory for documentation of this kind -- the root README I never read > apart from the first few pages, and I would not have thought it to give > this level of detail.
;-) > BTW, a fix to this ./README is in order as GOT is not used any more with > ELF ARM relocation, so r9 is not needed for this anymore... Agreed. > ... and even though I don't like the idea of reserving a register for > gd, since we must for the moment, then using the (now available) r9 > register would be *more* 'EABI/AAPCS-compliant' than using r8 (as I > said, one could think of this use of r9 as 'our AAPCS variant'). Actually situation might be differenton ARM. I just did quick and ditry test for the TX25 board: diff --git a/arch/arm/cpu/arm926ejs/config.mk b/arch/arm/cpu/arm926ejs/config.mk index f8ef90f..f8bbeba 100644 --- a/arch/arm/cpu/arm926ejs/config.mk +++ b/arch/arm/cpu/arm926ejs/config.mk @@ -21,7 +21,7 @@ # MA 02111-1307 USA # -PLATFORM_RELFLAGS += -fno-common -ffixed-r8 -msoft-float +PLATFORM_RELFLAGS += -fno-common -msoft-float PLATFORM_CPPFLAGS += -march=armv5te # ========================================================================= diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h index ada3fbb..7561523 100644 --- a/arch/arm/include/asm/global_data.h +++ b/arch/arm/include/asm/global_data.h @@ -86,6 +86,13 @@ typedef struct global_data { #define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */ #define GD_FLG_ENV_READY 0x00080 /* Environment imported into hash table */ + +#if 0 #define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r8") +#else /* We could use plain global data, but the resulting code is bigger */ +#define XTRN_DECLARE_GLOBAL_DATA_PTR extern +#define DECLARE_GLOBAL_DATA_PTR XTRN_DECLARE_GLOBAL_DATA_PTR \ + gd_t *gd +#endif #endif /* __ASM_GBL_DATA_H */ diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index 1fd5f83..b0de6c7 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -647,3 +647,14 @@ void hang (void) puts ("### ERROR ### Please RESET the board ###\n"); for (;;); } + +#if 1 /* We could use plain global data, but the resulting code is bigger */ +/* + * Pointer to initial global data area + * + * Here we initialize it. + */ +#undef XTRN_DECLARE_GLOBAL_DATA_PTR +#define XTRN_DECLARE_GLOBAL_DATA_PTR /* empty = allocate here */ +DECLARE_GLOBAL_DATA_PTR = (gd_t *) (CONFIG_SYS_INIT_SP_ADDR); +#endif /* 0 */ Compare sizes for "tx25": text data bss dec hex filename 158730 8668 37120 204518 31ee6 ./u-boot with register 158574 8672 37120 204366 31e4e ./u-boot with global pointer The global pointer method saves a total of 152 bytes here (156 in .text saved, but 4 in .data needed). OK, this is not even 0.1% of the size, but anyway... Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de "Probably the best operating system in the world is the [operating system] made for the PDP-11 by Bell Laboratories." - Ted Nelson, October 1977 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot