Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RISC-V: Set insn info fields correctly when disassembling. #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bluewww
Copy link

@bluewww bluewww commented Aug 8, 2018

I ported this patch from binutils 1.30. The disassembler struct (disassembler_info) has a member struct (insn_type) that should be filled out with the appropriate information for the currently disassembled instruction. This was handled not at all before, despite signaling that information was filled in.

This patch is basically only relevant if one uses the opcodes library.

bluewww added 2 commits August 8, 2018 21:37
This fixes a problem reported via github
    riscvarchive/riscv-binutils-gdb#153
We are setting insn_info_valid, but not setting insn_type and data_size.  This
patch adds support to set the two fields.

This was tested by adding some code to print the two fields, disassembling
libstdc++, and then checking to make sure the output was right.  It was also
testing with cross riscv{32,64}-{elf,linux} builds and make checks, and there
were no regressions.

Committed.

Jim

The original patch is from
https://sourceware.org/ml/binutils/2018-07/msg00508.html and is ported
to PULP binutils (which is about version 1.28) by me. Use git diff
--word-diff for a better overview of the changes.

Robert

	include/
	* opcode/riscv.h (INSN_TYPE, INSN_BRANCH, INSN_CONDBRANCH, INSN_JSR)
	(INSN_DREF, INSN_DATA_SIZE, INSN_DATA_SIZE_SHIFT, INSN_1_BYTE)
	(INSN_2_BYTE, INSN_4_BYTE, INSN_8_BYTE, INSN_16_BYTE): New.

	opcodes/
	* riscv-dis.c (riscv_disassemble_insn): Set insn_type and data_size
	fields.
	* riscv-opc.c (riscv_opcodes): Use new INSN_* flags to annotate insns.
@bluewww bluewww requested a review from haugoug August 8, 2018 19:50
gtagliavini added a commit that referenced this pull request Apr 14, 2020
extend binutils to support SPR 2 and 3 (mac&load)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant