aboutsummaryrefslogtreecommitdiff
path: root/gdb/arch
diff options
context:
space:
mode:
authorFeiyang Chen <chenfeiyang@loongson.cn>2024-01-25 16:32:36 +0800
committerTiezhu Yang <yangtiezhu@loongson.cn>2024-02-06 18:40:19 +0800
commite4d74c01e77365f1327e4e567e7579cdd3bf74f6 (patch)
tree57a80ffa2ea61b4754b9d71f89fcee012966bf05 /gdb/arch
parent1e9569f383a3d5a88ee07d0c2401bd95613c222e (diff)
downloadbinutils-e4d74c01e77365f1327e4e567e7579cdd3bf74f6.zip
binutils-e4d74c01e77365f1327e4e567e7579cdd3bf74f6.tar.gz
binutils-e4d74c01e77365f1327e4e567e7579cdd3bf74f6.tar.bz2
gdb: LoongArch: Add LBT extension support
Loongson Binary Translation (LBT) is used to accelerate binary translation, which contains 4 scratch registers (scr0 to scr3), x86/ARM eflags (eflags) and x87 fpu stack pointer (ftop). This patch support gdb to fetch/store these registers. Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn> # Framework Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn> # Detail Optimizes Signed-off-by: Hui Li <lihui@loongson.cn> # Error Fixes Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Diffstat (limited to 'gdb/arch')
-rw-r--r--gdb/arch/loongarch.c4
-rw-r--r--gdb/arch/loongarch.h8
2 files changed, 12 insertions, 0 deletions
diff --git a/gdb/arch/loongarch.c b/gdb/arch/loongarch.c
index e9995c9..22f2d39 100644
--- a/gdb/arch/loongarch.c
+++ b/gdb/arch/loongarch.c
@@ -27,6 +27,7 @@
#include "../features/loongarch/fpu.c"
#include "../features/loongarch/lsx.c"
#include "../features/loongarch/lasx.c"
+#include "../features/loongarch/lbt.c"
#ifndef GDBSERVER
#define STATIC_IN_GDB static
@@ -69,6 +70,9 @@ loongarch_create_target_description (const struct loongarch_gdbarch_features fea
regnum = create_feature_loongarch_lsx (tdesc.get (), regnum);
regnum = create_feature_loongarch_lasx (tdesc.get (), regnum);
+ /* For now we only support creating scr registers, eflags and ftop. */
+ regnum = create_feature_loongarch_lbt (tdesc.get (), regnum);
+
return tdesc;
}
diff --git a/gdb/arch/loongarch.h b/gdb/arch/loongarch.h
index d166f9d..4b7ab05 100644
--- a/gdb/arch/loongarch.h
+++ b/gdb/arch/loongarch.h
@@ -45,6 +45,12 @@ enum loongarch_regnum
LOONGARCH_LINUX_NUM_LSXREGSET = 32,
LOONGARCH_FIRST_LASX_REGNUM = LOONGARCH_FIRST_LSX_REGNUM + LOONGARCH_LINUX_NUM_LSXREGSET,
LOONGARCH_LINUX_NUM_LASXREGSET = 32,
+
+ LOONGARCH_FIRST_SCR_REGNUM = LOONGARCH_FIRST_LASX_REGNUM + LOONGARCH_LINUX_NUM_LASXREGSET,
+ LOONGARCH_LINUX_NUM_SCR = 4,
+ LOONGARCH_LAST_SCR_REGNUM = LOONGARCH_FIRST_SCR_REGNUM + LOONGARCH_LINUX_NUM_SCR - 1,
+ LOONGARCH_EFLAGS_REGNUM = LOONGARCH_LAST_SCR_REGNUM + 1,
+ LOONGARCH_FTOP_REGNUM = LOONGARCH_EFLAGS_REGNUM + 1,
};
enum loongarch_fputype
@@ -53,6 +59,8 @@ enum loongarch_fputype
DOUBLE_FLOAT = 2,
};
+ #define LOONGARCH_LBT_REGS_SIZE (8 * LOONGARCH_LINUX_NUM_SCR + 4 + 4)
+
/* The set of LoongArch architectural features that we track that impact how
we configure the actual gdbarch instance. We hold one of these in the
gdbarch_tdep structure, and use it to distinguish between different