I think I figured out the problem. The byte sequence generation by GCC was correct; the problem was with the byte sequence that I have chosen. "F0 0F" is used for locked opcodes and according to the link below, mentioned by Mike Shell, can only be used with certain instructions. http://pdos.csail.mit.edu/6.858/2011/readings/i386/LOCK.htm I changed my byte to 3 byte opcode "0F 38 50" and everything is fine now. Now both disassembly and execution are what I need them to be. Thank you very much for your time. -- Amir On Sat, Apr 14, 2012 at 12:38 AM, Ian Lance Taylor <iant@xxxxxxxxxx> wrote: > Amir Ghanbari <a.ghanbari1990@xxxxxxxxx> writes: > >> The problem is that the binary being generated is not exactly what I >> want. > > What is the precise byte sequence that you want, and what is the precise > byte sequence that you are getting? Don't show us the disassembly; show > us the bytes. > >> 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. > > I'm sorry, I don't know what this means. GCC generates assembly code > and the assembler generates bytes. > > Ian