From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Denk Date: Fri, 01 Dec 2006 15:31:52 +0100 Subject: [U-Boot-Users] [PATCH 00/07 v2]: Add mpc7448hpc2 (Taiga) board support In-Reply-To: Your message of "01 Dec 2006 16:09:27 +0800." <1164960567.6742.25.camel@localhost.localdomain> Message-ID: <20061201143152.9F8E4352621@atlas.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de In message <1164960567.6742.25.camel@localhost.localdomain> you wrote: > > index d92f142..8a4d141 100644 > --- a/lib_ppc/extable.c > +++ b/lib_ppc/extable.c > @@ -50,15 +50,29 @@ search_one_table(const struct exception_ > const struct exception_table_entry *last, > unsigned long value) > { > + DECLARE_GLOBAL_DATA_PTR; > + > while (first <= last) { > const struct exception_table_entry *mid; > long diff; > > mid = (last - first) / 2 + first; > - diff = mid->insn - value; > - if (diff == 0) > - return mid->fixup; > - else if (diff < 0) > + if (mid > CFG_MONITOR_BASE) { > + /* exception occurs in FLASH, before u-boot relocation. > + * No relocation offset is needed. > + */ > + diff = mid->insn - value; > + if (diff == 0) > + return mid->fixup; > + } else { > + /* exception occurs in RAM, after u-boot relocation. > + * A relocation offset should be added. > + */ > + diff = (mid->insn + gd->reloc_off) - value; > + if (diff == 0) > + return (mid->fixup + gd->reloc_off); > + } > + if (diff < 0) > first = mid+1; > else > last = mid-1; The problem I see with this code is that it is based on the assumption that CFG_MONITOR_BASE is greater than any RAM address. While this is always true so far, I would rather not rely on this. And I still don't understand why this change is necessary, and/or if this is the right fix. If a fix is needed, then probably the values of "value" is wrong in the first place, so the fix should be in the calling routine. Also please note that the DECLARE_GLOBAL_DATA_PTR declaration must be placed outside the function, i. e. on file scope. Best regards, Wolfgang Denk -- Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Wisdom is one of the few things that looks bigger the further away it is. - Terry Pratchett, _Witches Abroad_