From c9b8f14cbafac00acfbeaba1590ef9dd5ec8cd4a Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Tue, 19 Aug 2025 15:33:44 +0800 Subject: gdb: LoongArch: Handle newly added llsc instructions We can't put a breakpoint in the middle of a ll/sc atomic sequence, handle the instructions sc.q, llacq.{w/d}, screl.{w/d} newly added in the LoongArch Reference Manual v1.10 so a ll/sc atomic sequence using them won't loop forever being debugged. Signed-off-by: Xi Ruoyao Signed-off-by: Tiezhu Yang --- 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 3bf47d2..e497848 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; } -- cgit v1.1