public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Cooper Qu <cooper.qu@linux.alibaba.com>
To: Alan Modra <amodra@gmail.com>, Lifang Xia <lifang_xia@c-sky.com>
Cc: binutils@sourceware.org
Subject: Re: [PATCH] CSKY: Add objdump option -M abi-names.
Date: Sat, 26 Sep 2020 00:45:09 +0800	[thread overview]
Message-ID: <5b38e893-3c8c-784d-5c89-79aaf93b4d7d@linux.alibaba.com> (raw)
In-Reply-To: <20200925131837.GO5452@bubble.grove.modra.org>

On 9/25/20 9:18 PM, Alan Modra wrote:

> On Wed, Sep 23, 2020 at 11:50:35PM +0800, Lifang Xia wrote:
>> On 2020/9/17 14:30, Cooper Qu wrote:
>>> Add option parser for disassembler, and refine the codes of
>>> parse register operand and disassemble register operand.
>>> While strengthen the operands legality check of some instructions.
>>>
>>> Co-Authored-By: Lifang Xia <lifang_xia@c-sky.com>
>>>
>>> gas/
>>> 	* config/tc-csky.c (parse_type_ctrlreg): Use function
>>> 	csky_get_control_regno to operand.
>>> 	(csky_get_reg_val): Likewise.
>>> 	(is_reg_sp_with_bracket): Use function csky_get_reg_val
>>> 	to parse operand.
>>> 	(is_reg_sp): Refine.
>>> 	(is_oimm_within_range): Fix, report error when operand
>>> 	is not constant.
>>> 	(parse_type_cpreg): Refine.
>>> 	(parse_type_cpcreg): Refine.
>>> 	(get_operand_value): Add handle of OPRND_TYPE_IMM5b_LS.
>>> 	(md_assemble): Fix no error reporting somtimes when
>>> 	operands number are not fit.
>>> 	(csky_addc64): Refine.
>>> 	(csky_subc64): Refine.
>>> 	(csky_or64): Refine.
>>> 	(v1_work_fpu_fo): Refine.
>>> 	(v1_work_fpu_read): Refine.
>>> 	(v1_work_fpu_writed): Refine.
>>> 	(v1_work_fpu_readd): Refine.
>>> 	(v2_work_addc): New function, strengthen the operands legality
>>> 	check of addc.
>>> 	* gas/testsuite/gas/csky/all.d : Use register number format when
>>> 	disassemble register name by default.
>>> 	* gas/testsuite/gas/csky/cskyv2_all.d : Likewise.
>>> 	* gas/testsuite/gas/csky/trust.d: Likewise.
>>> 	* gas/testsuite/gas/csky/cskyv2_ck860.d : Fix.
>>> 	* gas/testsuite/gas/csky/trust.s : Fix.
>>>
>>> opcodes/
>>> 	* csky-dis.c (using_abi): New.
>>> 	(parse_csky_dis_options): New function.
>>> 	(get_gr_name): New function.
>>> 	(get_cr_name): New function.
>>> 	(csky_output_operand): Use get_gr_name and get_cr_name to
>>> 	disassemble and add handle of OPRND_TYPE_IMM5b_LS.
>>> 	(print_insn_csky): Parse disassembler options.
>>> 	* opcodes/csky-opc.h (OPRND_TYPE_IMM5b_LS): New enum.
>>> 	(GENARAL_REG_BANK): Define.
>>> 	(REG_SUPPORT_ALL): Define.
>>> 	(REG_SUPPORT_ALL): New.
>>> 	(ASH): Define.
>>> 	(REG_SUPPORT_A): Define.
>>> 	(REG_SUPPORT_B): Define.
>>> 	(REG_SUPPORT_C): Define.
>>> 	(REG_SUPPORT_D): Define.
>>> 	(REG_SUPPORT_E): Define.
>>> 	(csky_abiv1_general_regs): New.
>>> 	(csky_abiv1_control_regs): New.
>>> 	(csky_abiv2_general_regs): New.
>>> 	(csky_abiv2_control_regs): New.
>>> 	(get_register_name): New function.
>>> 	(get_register_number): New function.
>>> 	(csky_get_general_reg_name): New function.
>>> 	(csky_get_general_regno): New function.
>>> 	(csky_get_control_reg_name): New function.
>>> 	(csky_get_control_regno): New function.
>>> 	(csky_v2_opcodes): Prefer two oprerans format for bclri and
>>> 	bseti, strengthen the operands legality check of addc, zext
>>> 	and sext.
> This patch results in ubsan errors, for example
> opcodes/csky-opc.h:929 shift exponent 536870912 is too large
>
> I took a look at what I think the code is trying to do, and came up
> with the following fix.  Please check that this is correct.
>
> opcodes/
> 	* csky-opc.h: Formatting.
> 	(GENERAL_REG_BANK): Correct spelling.  Update use throughout file.
> 	(get_register_name): Mask arch with CSKY_ARCH_MASK for shift,
> 	and shift 1u.
> 	(get_register_number): Likewise.
> 	* csky-dis.c (get_gr_name, get_cr_name): Don't mask mach_flag.
> gas/
> 	* config/tc-csky.c (parse_type_ctrlreg): Don't mask mach_flag
> 	for csky_get_control_regno.
> 	(csky_get_reg_val): Likewise when calling csky_get_general_regno.
>
Hi Alan,

The patch looks good and I have tested it, there is no problem. Thanks 
for fixing the bug and improving the code, these bugs will prompt me to 
write and test better next time.


Best Regards,

Cooper


  reply	other threads:[~2020-09-25 16:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-17  6:30 Cooper Qu
2020-09-23 15:50 ` Lifang Xia
2020-09-25 13:18   ` Alan Modra
2020-09-25 16:45     ` Cooper Qu [this message]
2020-09-24 14:14 ` [PUSHED] " Andrew Burgess
2020-09-24  3:14 Simon Marchi

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=5b38e893-3c8c-784d-5c89-79aaf93b4d7d@linux.alibaba.com \
    --to=cooper.qu@linux.alibaba.com \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=lifang_xia@c-sky.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).