Add assembly instruction to GCC
Amir Ghanbari
a.ghanbari1990@gmail.com
Fri Apr 13 00:20:00 GMT 2012
Hello all,
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?
Thank you,
--
Amir
More information about the Gcc-help
mailing list