Re: Add assembly instruction to GCC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Amir Ghanbari <a.ghanbari1990@xxxxxxxxx> writes:

> I'm trying to expand X86 ISA. So I have added some hardware to X86 (in
> Gem5 Simulator) and I have updated X86 decoder to support those
> instructions. In order to call those instructions I use GCC inline
> assembly ".byte" directive. something like this : ".byte 0xF0, 0x0F,
> 0x23;"
> The problem is when I compile my code using GCC, it changes the
> instructions that i have created. For instance:
> I intend to have something generated like this:
>
>     48 89 eb               mov    %rbp,%rbx
>     48 83 e3 fe           and    $0xfffffffffffffffe,%rbx
>     48 8b 7c 24 08      mov    0x8(%rsp),%rdi
>     f0 0f 23                lock (bad)
>     48 89 04 24          mov    %rax,(%rsp)
>     4c 8b 34 24          mov    (%rsp),%r14
>
> but GCC generates something like this:
>
>     48 89 eb               mov    %rbp,%rbx"
>     48 83 e3 fe           and    $0xfffffffffffffffe,%rbx"
>     48 8b 7c 24 08      mov    0x8(%rsp),%rdi"
>     f0 0f                     lock mov (bad),%db1"
>     23 48 89               and    -0x77(%rax),%ecx"
>     04 24                    add    $0x24,%al"
>     4c 8b 34 24           mov    (%rsp),%r14"
>
> Is there a way to tell GCC that "F0 0F 23" is a unique instruction so
> it wouldn't mix it with other instructions?

I don't understand what you are asking.  GCC does not generate any
output that looks like the lines quoted above.  It looks like you are
showing us the output of a disassembler, but GCC does not include a
disassembler.  And it looks like the bytes that the disassembler is
showing are the bytes that you want, they just aren't being disassembled
the way you want them to be.  It sounds like you need to change your
disassembler to support your instruction.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux