[U-Boot-Users] relocate_code

Murray Jensen
2003-01-04T12:50:08Z

On Sat, 04 Jan 2003 10:45:27 +0800, YanMin Qiao <sepherosa@sohu.com> writes:
> First thanks for your answer, howerever, my question is
> Why we copy _forward_ when _memory address_ <CFG_MONITOR_BASE, but
>when _memory address_>=CFG_MONITOR_BASE we will have to _copy backword_?
> Is it because some overlapping problem when copy?

Yes. It is generic memory copying code - if it is at all possible that the
copy might overwrite the destination then it goes backwards, instead of
forwards. It shouldn't make a lot of difference either way (I guess I can
imagine a scenario where it stuffs up some fancy pre-fetching in the CPU,
which might make it go half or a third of the speed, but its not likely).

>>Be careful with the first "bge" above - it isn't testing the result of the
>>previous instruction, it is testing the result of the "cmplw" done quite a
>>few instructions beforehand and stored in "cr1" i.e. it will branch if "r3"
>>(the destination address) is >= "r4" (the source address) i.e. if it is
>>possible that the copy will overwrite the source.
>>
> thanks, I know

OK, I was just trying to be thorough. Cheers!
Murray...
--
Murray Jensen, CSIRO Manufacturing & Infra. Tech. Phone: +61 3 9662 7763
Locked Bag No. 9, Preston, Vic, 3072, Australia. Fax: +61 3 9662 7853
Internet: Murray.Jensen at csiro.au

Hymod project: http://www.msa.cmst.csiro.au/projects/Hymod/

To the extent permitted by law, CSIRO does not represent, warrant and/or
guarantee that the integrity of this communication has been maintained or
that the communication is free of errors, virus, interception or interference.

The information contained in this e-mail may be confidential or privileged.
Any unauthorised use or disclosure is prohibited. If you have received this
e-mail in error, please delete it immediately and notify Murray Jensen on
+61 3 9662 7763. Thank you.