From 3eba483364436567fd1b6ac4b5d82e23bb223a54 Mon Sep 17 00:00:00 2001 From: Youling Tang Date: Sun, 10 Jul 2022 10:22:33 +0800 Subject: 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 Signed-off-by: Tiezhu Yang --- gdb/arch/loongarch.h | 16 ++++++++++++++++ gdb/loongarch-tdep.h | 16 ---------------- 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'gdb') diff --git a/gdb/arch/loongarch.h b/gdb/arch/loongarch.h index 8194ea6..5cf5498 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 diff --git a/gdb/loongarch-tdep.h b/gdb/loongarch-tdep.h index 672bc2b..b68a789 100644 --- a/gdb/loongarch-tdep.h +++ b/gdb/loongarch-tdep.h @@ -27,22 +27,6 @@ #include "elf/loongarch.h" #include "opcode/loongarch.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. */ -}; - /* Register set definitions. */ extern const struct regset loongarch_gregset; -- cgit v1.1