This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: how to embed an arbitrary opcode


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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]