Source-Changes archive

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

Re: CVS commit: src/sys/arch/arm/arm32



> > 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.
> 

A colleague of mine has just pointed out that we can probably avoid having 
to disassemble the instruction entirely and base the decision on the FSR 
code.  Assuming for the moment that the address being accessed is 
permitted for that process, then if it's a permission fault it must be as 
a result of an attempt to write.  A failure to read the location will 
always result in a domain or translation fault.  For the case where the 
access is outside the legal space of the process, it really doesn't matter 
what we get, since the uvm code will just bounce the access.

If that will work, then it really would be a GOOD THING.  Since it would 
mean no further work is needed in this area to handle Thumb.  It would 
probably be faster too, since we almost certainly already have the fault 
code and it would avoid having to dig the instruction out of user space.


R.




Home | Main Index | Thread Index | Old Index