public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Tsukasa OI <research_trasio@irq.a4lg.com>
To: Tsukasa OI <research_trasio@irq.a4lg.com>,
	Nelson Chu <nelson.chu@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Kito Cheng <kito.cheng@sifive.com>
Cc: binutils@sourceware.org
Subject: [PATCH 0/1] RISC-V: Check shift amount against XLEN (disassembler)
Date: Sat, 30 Jul 2022 12:51:11 +0900	[thread overview]
Message-ID: <cover.1659153057.git.research_trasio@irq.a4lg.com> (raw)
In-Reply-To: <cover.1653300374.git.research_trasio@irq.a4lg.com>

Hello,

This patchset is going to support shift amount checking on the disassembler.

Previous Patchset:
<https://sourceware.org/pipermail/binutils/2022-May/120956.html>
<https://github.com/a4lg/binutils-gdb/wiki/riscv_dis_shift_xlen>
Tracker on GitHub:
<https://github.com/a4lg/binutils-gdb/wiki/riscv_dis_shift_xlen_2>


In the disassembler, there's no validation whether shift amount is valid on the
specific architecture (RV32/64).

My previous Idea 1 patchset tried to fix that by adding xlen argument to every
match_func (in opcode entries).  However, it requires bigger core disassembler
changes and maintaining is relatively hard.

Idea 2 patchset (this patchset) fixes that by printing invalid0x[SHAMT] instead
of actual shift width (SHAMT in hexadecimal like regular shift amounts).  If we
don't have to print "unrecognized instruction" (such as .4byte) on instrucitons
with invalid shift amounts, this patch would be the simplest solution for the
invalid shift amount checking support on the disassembler.


This patchset supports styling. invalid shift amounts are printed as text, not
immediate.  It makes invalid shift amounts default white opposed to blue on
valid ones.
See an example with the GitHub Wiki page linked above.


Thanks,
Tsukasa




Tsukasa OI (1):
  RISC-V: Check shift amount against XLEN (disasm)

 gas/testsuite/gas/riscv/shamt-dis-32.d | 34 +++++++++++++++++++
 gas/testsuite/gas/riscv/shamt-dis-64.d | 34 +++++++++++++++++++
 gas/testsuite/gas/riscv/shamt-dis.s    | 47 ++++++++++++++++++++++++++
 opcodes/riscv-dis.c                    | 16 ++++++---
 4 files changed, 127 insertions(+), 4 deletions(-)
 create mode 100644 gas/testsuite/gas/riscv/shamt-dis-32.d
 create mode 100644 gas/testsuite/gas/riscv/shamt-dis-64.d
 create mode 100644 gas/testsuite/gas/riscv/shamt-dis.s


base-commit: b245c595aaa59812f8f3a0e8b70ea5f52e045627
-- 
2.34.1


  parent reply	other threads:[~2022-07-30  3:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-23 10:06 [RFC PATCH 0/3] " Tsukasa OI
2022-05-23 10:06 ` [RFC PATCH 1/3] RISC-V: Add xlen to match_func Tsukasa OI
2022-05-23 10:06 ` [RFC PATCH 2/3] RISC-V: Check shift amount against XLEN Tsukasa OI
2022-05-23 10:06 ` [RFC PATCH 3/3] RISC-V: Add disassembler tests for shift amount Tsukasa OI
2022-07-30  3:47 ` [RFC PATCH 0/3] RISC-V: Check shift amount against XLEN (disassembler) Tsukasa OI
2022-07-30  3:51 ` Tsukasa OI [this message]
2022-07-30  3:51   ` [PATCH 1/1] RISC-V: Check shift amount against XLEN (disasm) Tsukasa OI

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1659153057.git.research_trasio@irq.a4lg.com \
    --to=research_trasio@irq.a4lg.com \
    --cc=binutils@sourceware.org \
    --cc=kito.cheng@sifive.com \
    --cc=nelson.chu@sifive.com \
    --cc=palmer@dabbelt.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).