summaryrefslogtreecommitdiff
path: root/gdb/arch
diff options
context:
space:
mode:
authorYouling Tang <tangyouling@loongson.cn>2022-07-10 10:22:33 +0800
committerTiezhu Yang <yangtiezhu@loongson.cn>2022-07-10 17:27:50 +0800
commit3eba483364436567fd1b6ac4b5d82e23bb223a54 (patch)
treee28a404bcf927b5bc244ccd8c96c70ce1551da50 /gdb/arch
parente5c0531cfe8667e4f510f6357e62f488113b7049 (diff)
downloadbinutils-gdb-3eba483364436567fd1b6ac4b5d82e23bb223a54.tar.gz
gdbserver: LoongArch: Simplify code with register number macros
Move "enum loongarch_regnum" to gdb/arch/loongarch.h so that the macro definitions can be used in gdbserver/linux-loongarch-low.cc to simplify the code. Signed-off-by: Youling Tang <tangyouling@loongson.cn> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Diffstat (limited to 'gdb/arch')
-rw-r--r--gdb/arch/loongarch.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/gdb/arch/loongarch.h b/gdb/arch/loongarch.h
index 8194ea66c0a..5cf5498079a 100644
--- a/gdb/arch/loongarch.h
+++ b/gdb/arch/loongarch.h
@@ -22,6 +22,22 @@
#include "gdbsupport/tdesc.h"
+/* Register numbers of various important registers. */
+enum
+{
+ LOONGARCH_RA_REGNUM = 1, /* Return Address. */
+ LOONGARCH_SP_REGNUM = 3, /* Stack Pointer. */
+ LOONGARCH_A0_REGNUM = 4, /* First Argument/Return Value. */
+ LOONGARCH_A7_REGNUM = 11, /* Seventh Argument/Syscall Number. */
+ LOONGARCH_FP_REGNUM = 22, /* Frame Pointer. */
+ LOONGARCH_ORIG_A0_REGNUM = 32, /* Syscall's original arg0. */
+ LOONGARCH_PC_REGNUM = 33, /* Program Counter. */
+ LOONGARCH_BADV_REGNUM = 34, /* Bad Vaddr for Addressing Exception. */
+ LOONGARCH_LINUX_NUM_GREGSET = 45, /* 32 GPR, ORIG_A0, PC, BADV, RESERVED 10. */
+ LOONGARCH_ARG_REGNUM = 8, /* r4-r11: general-purpose argument registers.
+ f0-f7: floating-point argument registers. */
+};
+
/* 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