Hi Linaro Toolchain Group,
I am trying to learn the 'decoding decision tree' for aarch64 in binutils by trying to add a new assembly instruction 'addvp'. For example: addvp x0, x0, 9
For this, I added a entry in struct aarch64_opcode aarch64_opcode_table[] (file opcodes/aarch64-tbl.h) as below: {"addvp", 0x01000000, 0x7f000000, addsub_imm, 0, CORE, OP3 (Rd_SP, Rn_SP, AIMM), QL_R2NIL, F_SF},
ARM manual say, bit 27 & bit 28 are unallocated. Thus for addvp, I am giving opcode 01000000 (with bit 27 & 28 as 0). With this, generating object file from assembly file is successful (test.s --> test.o); but while disassembling using objdump, it say undefined instruction.
From objdump log:
81002400 .inst 0x81002400 ; undefined (but instruction was generated correct i.e. 81002400 !!!). I know since addvp is a hack instruction, it won't execute on cpu. But still disassembly should succeed.
1. Please help me in knowing what I am doing wrong here ? What else I should do to add a new instruction in binutils ? 2. I also saw some printf in opcodes/aarch64-gen.c which I guess create decoding tree (initialize_decoder_tree()). How to print them ? I made debug =1 but still print is not coming. 3. There are some auto-generated files like aarch64-asm-2.c, aarch64-dis-2.c. How to re-generate them ?
Thanks.
On Sat, Jul 25, 2015 at 6:19 AM, Virendra Kumar Pathak kumarvir.pathak@gmail.com wrote:
- Please help me in knowing what I am doing wrong here ? What else I should
do to add a new instruction in binutils ?
I don't know offhand, but see below.
- I also saw some printf in opcodes/aarch64-gen.c which I guess create
decoding tree (initialize_decoder_tree()). How to print them ? I made debug =1 but still print is not coming.
It looks like it prints debug info to stdout, so the debugging info is in the output files like aarch64-asm-2.c.
- There are some auto-generated files like aarch64-asm-2.c,
aarch64-dis-2.c. How to re-generate them ?
Use --enable-maintainer-mode when running configure. This enables makefiles rules for the auto-generated sources. These are normally disabled by default to make it easier to build the source tree. With this enabled, you may need extra utilities installed for a build to work, especially if you haven't been careful about preserving file timestamps. This enables rules to generate flex/bison output files, and autoconf/automake output files, and files like aarch64-asm-2.c.
If you didn't do this before modifying aarch64-tbl.h, then this may be why your changes aren't working. With --enable-maintainer-mode, changing aarcht64-tbl.h will automatically rebuild aarch64-gen on the next make, and that will then automatically be rerun to regenerate files like aarch64-asm-2.c.
Jim
linaro-toolchain@lists.linaro.org