[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Which port for armv4l?



On Wed, 2016-08-17 at 14:34 +0200, Adam Wysocki wrote:
[...]
> I don't see why using MOV PC,reg would prevent interworking with binaries 
> built using Thumb, as this code executes in ARM state anyway... it could 
> use BX only to switch to Thumb (and when it doesn't use Thumb at all, it 
> would never use it)...

If ARM code is called from Thumb code, it must return using something
like BX LR. Mov PC, LR won't return to Thumb mode. E.g.


/* Thumb code... */
	BLX func


/* ARM code... */
	BL func
	...

func:
	...
	BX	LR

The above 'func' can be called OK from both the ARM and Thumb state. If
it returned with MOV PC, LR instead, then when called from Thumb it
wouldn't work (for ARMv6 and earlier that is - ARMv7 changed behaviour
of MOV and similar).

Of course, ARM4T has original Thumb not Thumb-2, so doesn't have BLX.
Instead, it would have some trampoline code which uses BX. (It's been
almost 20 years since I worked on ARM4T systems, and memory is a bit
fuzzy as to details, though I do remember that it was a complete pain in
the arse. :-)

-- 
Tixy



Reply to: