Subject: Re: strh on a SHARK
To: Mark Brinicombe <mark@causality.com>
From: Richard Earnshaw <rearnsha@arm.com>
List: port-arm32
Date: 08/10/1998 17:33:25
> Hi,
> Ok here is a quick question for all of you how have far too much spare
> time ;-)
>
> What is the best set tests to apply to an instruction word in order to
> determine if it is a store instruction ?
>
> Cheers,
> Mark
>
It depends how precise you need to be. If you *know* that the relevant
instruction is a load or a store of some sort, then the test
(inst & 0x00100000) == 0
will suffice.
You can be a bit more precise:
(inst & 0x0c100000) == 0x04000000 /* STR */
(inst & 0x0a100000) == 0x08000000 /* STM/STC */
(inst & 0x0e1000f0) == 0x000000b0 /* STRH */
(inst & 0x0fb00ff0) == 0x01000090 /* SWP */
Which allows some STRH encodings to overlap into undefined instruction
space,
Or you can go the whole hog
(inst & 0x0c100000) == 0x04000000 /* STR */
(inst & 0x0a100000) == 0x08000000 /* STM/STC */
(inst & 0x0e500ff0) == 0x000000b0 /* STRH Reg offset */
(inst & 0x0e5000f0) == 0x004000b0 /* STRH Imm offset */
(inst & 0x0fb00ff0) == 0x01000090 /* SWP */
Of course, decoding Thumb instructions is a whole new ball game.
Richard.