Subject: Re: CVS commit: src/sys/arch/arm/arm32
To: Steve Woodford <scw@netbsd.org>
From: Richard Earnshaw <rearnsha@arm.com>
List: source-changes
Date: 10/16/2003 10:04:21
> On Wednesday 15 October 2003 2:56 pm, Richard Earnshaw wrote:
> 
> > This is wrong.  ldrd and strd are available on any v5E processor, so
> > it shouldn't be wrapped in '#ifdef XSCALE'.
> 
> Ok, my 'fix' commit also jumped the gun, and hasn't actually solved the 
> problem.
> 
> What's the easiest/quickest way to determine if strd/ldrd are available?

Note that there's no such thing as strSh (storing a halfword is a 
truncation not an extension operation).

The bit patterns are:

LDR	(insn & 0x0c500000) == 0x04100000
LDRB	(insn & 0x0c500000) == 0x04500000
LDRSB	(insn & 0x0e1000f0) == 0x001000d0
LDRH	(insn & 0x0e1000f0) == 0x001000b0
LDRSH	(insn & 0x0e1000f0) == 0x001000f0
LDRD	(insn & 0x0e1000f0) == 0x000000d0

(note the above will match ldrt and ldrbt, you will need to do further 
tests if you want to exclude those).

STR	(insn & 0x0c500000) == 0x04000000
STRB	(insn & 0x0c500000) == 0x04400000
STRH	(insn & 0x0e1000f0) == 0x000000b0
STRD	(insn & 0x0e1000f0) == 0x000000f0

(similar note re STRT & STRBT)

So we see from this that LDRD/STRD are squeezed into the meaningless 
STRSH/STRSB space.

So probably the best way to code this is

	if ((insn & 0x0c100000) == 0x0c000000)     /* STR, STRB */
	    || (insn & 0x0e1000b0) == 0x000000b0)  /* STR[HD] */


R.