Add assembly instruction to GCC

Michael Shell list1@michaelshell.org
Fri Apr 13 16:14:00 GMT 2012


On Fri, 13 Apr 2012 09:24:13 -0400
Amir Ghanbari <a.ghanbari1990@gmail.com> wrote:

> The problem is that the binary being generated is not exactly what I
> want. when I simulate my code, I get an "invalid opcode" error and the
> address of the instruction is exactly where the disassembly get
> screwed up. So I believe that's what's happening. I need to make GCC
> treat that "F0 0F 23" as an instruction and put it in the binary
> intact and don't mix it with other instructions.


If I may, I think the problem is because in vanilla i386, LOCK
cannot be used with MOV:

http://pdos.csail.mit.edu/6.858/2011/readings/i386/LOCK.htm

"An undefined opcode trap will be generated if a LOCK prefix is used
 with any instruction not listed above."

thus the invalid opcode error and the confused disassembler.


  Cheers,

  Mike Shell






More information about the Gcc-help mailing list