This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: how to embed an arbitrary opcode
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: John Breitenbach <breiten at lexmark dot com>, binutils at sourceware dot org
- Date: Fri, 19 Jun 2009 14:50:13 +0100
- Subject: Re: how to embed an arbitrary opcode
- References: <4A3AA129.5090708@lpdev.prtdev.lexmark.com> <4A3B93C0.4030109@redhat.com>
On Fri, 2009-06-19 at 14:33 +0100, Nick Clifton wrote:
> Hi John,
>
> > I'm looking for a way to embed an arbitrary opcode into an assembly
> > file for the ARM architecture.
>
> Is there a particular reason why you cannot just include the textual
> version of the opcode you want and have it assembled as normal ?
>
> > Objdump refuses to disassemble those opcodes even with the
> > --disassemble-all flag.
>
> This has now been fixed in the mainline sources.
>
> > .long 0xe320f003
>
> Currently there is no way to achieve the effect you desire. But all is
> not lost, this being free software and all. So, please try out the
> attached patch which adds two new pseudo ops to the ARM port of GAS:
>
> .iword <expression>[,<expression>]*
> .ishort <expression>[,<expression>]*
>
> which can be used to insert 32-bit and 16-bit values respectively into
> the output stream and mark them as instructions not data.
>
> Cheers
> Nick
>
Yay! Something I've wanted for a long time...
One question. What happens if .iword is used in Thumb mode, or .ishort
in ARM mode? I think it would be better to just have .insn (or .inst),
which takes 32-bit numbers in ARM state and 16-bit numbers in thumb.
The assembler has to know what state it's in anyway in order to generate
the correct mapping symbol information.
R.