Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tiezhu Yang <yangtiezhu@loongson.cn>
To: Xi Ruoyao <xry111@xry111.site>, gdb-patches@sourceware.org
Cc: Hui Li <lihui@loongson.cn>, Lulu Cheng <chenglulu@loongson.cn>,
	Mingcong Bai <jeffbai@aosc.io>, Xuerui Wang <i@xen0n.name>
Subject: Re: [PATCH] gdb: LoongArch: Recognize LoongArch v1.10 store conditional instructions
Date: Tue, 19 Aug 2025 16:45:56 +0800	[thread overview]
Message-ID: <9d8a7bab-e3fe-3083-e6ce-12b9ce48192b@loongson.cn> (raw)
In-Reply-To: <20250819073626.46815-1-xry111@xry111.site>

On 2025/8/19 下午3:33, Xi Ruoyao wrote:
> We can't put a breakpoint in the middle of a ll/sc atomic sequence,
> recognize the sc.q, screl.w, and screl.d instructions added in LoongArch

sc.q, ll.acq.{w/d}, sc.rel.{w/d}

> v1.10 so a ll/sc atomic sequence using them won't loop forever being
> debugged.

It is better to add the references:

https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#_sc_q
https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#_ll_acq_wd_sc_rel_wd

> Signed-off-by: Xi Ruoyao <xry111@xry111.site>
> ---
>   gdb/loongarch-tdep.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/gdb/loongarch-tdep.c b/gdb/loongarch-tdep.c
> index cc75cd4a3d3..7556b81a9fa 100644
> --- a/gdb/loongarch-tdep.c
> +++ b/gdb/loongarch-tdep.c
> @@ -98,7 +98,9 @@ static bool
>   loongarch_insn_is_ll (insn_t insn)
>   {
>     if ((insn & 0xff000000) == 0x20000000		/* ll.w  */
> -      || (insn & 0xff000000) == 0x22000000)	/* ll.d  */
> +      || (insn & 0xff000000) == 0x22000000	/* ll.d  */
> +      || (insn & 0xfffffc00) == 0x38578000	/* llacq.w  */
> +      || (insn & 0xfffffc00) == 0x38578800)	/* llacq.d  */
>       return true;
>     return false;
>   }
> @@ -109,7 +111,10 @@ static bool
>   loongarch_insn_is_sc (insn_t insn)
>   {
>     if ((insn & 0xff000000) == 0x21000000		/* sc.w  */
> -      || (insn & 0xff000000) == 0x23000000)	/* sc.d  */
> +      || (insn & 0xff000000) == 0x23000000	/* sc.d  */
> +      || (insn & 0xffff8000) == 0x38570000	/* sc.q  */
> +      || (insn & 0xfffffc00) == 0x38578400	/* screl.w  */
> +      || (insn & 0xfffffc00) == 0x38578c00)	/* screl.d  */
>       return true;
>     return false;
>   }

The encodings for the instructions that you're handling look correct
to me. I prefer using ll.acq.w, ll.acq.d, sc.rel.w, sc.rel.d in the
code comments to make consistent with the manual.

If no more comments, I will amend these when applying in the next week,
no need to send v2.

Thanks,
Tiezhu


  reply	other threads:[~2025-08-19  8:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-19  7:33 Xi Ruoyao
2025-08-19  8:45 ` Tiezhu Yang [this message]
2025-08-20 10:57   ` WANG Xuerui
2025-08-21  1:18     ` Tiezhu Yang
2025-08-25 12:12 ` Tiezhu Yang

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=9d8a7bab-e3fe-3083-e6ce-12b9ce48192b@loongson.cn \
    --to=yangtiezhu@loongson.cn \
    --cc=chenglulu@loongson.cn \
    --cc=gdb-patches@sourceware.org \
    --cc=i@xen0n.name \
    --cc=jeffbai@aosc.io \
    --cc=lihui@loongson.cn \
    --cc=xry111@xry111.site \
    /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