Subject: Re: Revision K strongarms ...
To: None <port-arm32@NetBSD.ORG>
From: Chris Poole <cep20@hermes.cam.ac.uk>
List: port-arm32
Date: 05/07/1998 15:31:08
On Thu 07 May, kim@pvv.ntnu.no wrote:

> There is still the possibility of always assembling LDM as LDM NOP, and
> let the linker change it to NOP LDM if the LDM happens to lie last on a
> page.

Yes, but as pointed out earlier, it is not just LDMs that are affected.  LDR
instructions fail too, if they load the pc.  I was looking through Xarm-33
and found about 12 bad LDMs and 6 bad LDRs.  This suggests that about 4% of
the total instructions are LDMs or LDRs loading the pc.

> The overhead will then be less than the time spent executing LDMs. How
> much is that? Probably still acceptable.

Why not simply have a linker option which finds all the affected
instructions and replaces them with branches to copies stored at safe
locations (or even a separate patching utility which does this).  All the
affected instructions are effectively branches, so the patches need not
return.

This scheme is trivial for everything except the branch table example where
you have instructions of the form "LDR pc, [pc, rx, LSL#2]" which is not
relocatable.  For these cases (2 in Xarm-33), the linker might have to try
to move the object files around a bit, but there might be an easier way.

Cheers,

Chris

-- 
+- Chris Poole                                  ,-. , . ,-. ,-, ,-.       -+
+-   Churchill College, Cambridge, CB3 0DS      |   |-| |(   |  `-.       -+
+-   Phone: 01223 331543                        `-' ' ` ' ` '-' `-' *     -+
+-   Email: cep20@cam.ac.uk       WWW: http://www2.eng.cam.ac.uk/~cep20/  -+