From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Tyser Date: Thu, 29 Jul 2010 10:38:24 -0500 Subject: [U-Boot] [RFC][PATCH 02/19] relocation: fixup cmdtable In-Reply-To: <4C515B88.4000700@denx.de> References: <4C515B88.4000700@denx.de> Message-ID: <1280417904.19222.200.camel@petert> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de > +#if !defined(CONFIG_RELOC_FIXUP_WORKS) > +DECLARE_GLOBAL_DATA_PTR; > + > +void fixup_cmdtable(cmd_tbl_t *cmdtp, int size) > +{ > + int i; > + > + if (gd->reloc_off == 0) > + return; > + > + for (i = 0; i < size; i++) { > + ulong addr; > + > + addr = (ulong) (cmdtp->cmd) + gd->reloc_off; > + cmdtp->cmd = > + (int (*)(struct cmd_tbl_s *, int, int, char * const []))addr; > + addr = (ulong)(cmdtp->name) + gd->reloc_off; > + cmdtp->name = (char *)addr; > + if (cmdtp->usage) { > + addr = (ulong)(cmdtp->usage) + gd->reloc_off; > + cmdtp->usage = (char *)addr; > + } > +#ifdef CONFIG_SYS_LONGHELP > + if (cmdtp->help) { > + addr = (ulong)(cmdtp->help) + gd->reloc_off; > + cmdtp->help = (char *)addr; > + } > +#endif > + cmdtp++; > + } > +} A number of other arches have this same logic in arch-specific code, eg arch/mips/lib/board.c. Could you also convert them to use the new fixup_cmdtable() in this patch? Best, Peter