!24 Resolve compilation errors for loongarch64

From: @fuowang 
Reviewed-by: @caodongxia 
Signed-off-by: @caodongxia
This commit is contained in:
openeuler-ci-bot 2024-05-20 09:28:15 +00:00 committed by Gitee
commit 7b2e13fdc6
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 17 additions and 14 deletions

View File

@ -1,14 +1,12 @@
From e82e3332d36a97a86cc1e23e7f3c6e953a1ada2c Mon Sep 17 00:00:00 2001 From 26cf0d75eda1c2530640b8bf9699785a47c78a24 Mon Sep 17 00:00:00 2001
From: doupengda <doupengda@loongson.cn> From: doupengda <doupengda@loongson.cn>
Date: Wed, 14 Dec 2022 02:58:36 +0000 Date: Tue, 14 May 2024 11:07:07 +0800
Subject: [PATCH] add loongarch64 support Subject: [PATCH] add loongarch64 support
--- ---
configure | 6 +- configure | 6 +++++-
machines.h | 31 +++++++ machines.h | 31 +++++++++++++++++++++++++++++++
tags | 252 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-)
3 files changed, 288 insertions(+), 1 deletion(-)
create mode 100644 tags
diff --git a/configure b/configure diff --git a/configure b/configure
index 7c7280f..60fd170 100755 index 7c7280f..60fd170 100755
@ -30,7 +28,7 @@ index 7c7280f..60fd170 100755
;; ;;
esac esac
diff --git a/machines.h b/machines.h diff --git a/machines.h b/machines.h
index cbbe69d..4472bd1 100644 index cbbe69d..3e184d5 100644
--- a/machines.h --- a/machines.h
+++ b/machines.h +++ b/machines.h
@@ -87,6 +87,37 @@ static inline int is_breakpoint(pid_t pid, uintptr_t address) @@ -87,6 +87,37 @@ static inline int is_breakpoint(pid_t pid, uintptr_t address)
@ -40,23 +38,23 @@ index cbbe69d..4472bd1 100644
+#elif defined(MLX_LOONGARCH64) +#elif defined(MLX_LOONGARCH64)
+static inline uintptr_t call_return_address(pid_t pid, registers_info_t *regs) +static inline uintptr_t call_return_address(pid_t pid, registers_info_t *regs)
+{ +{
+ return ptrace_get_data(pid, regs->gpr[3]); + return ptrace_get_data(pid, regs->regs[3]);
+} +}
+static inline uintptr_t call_return_value(registers_info_t *regs) +static inline uintptr_t call_return_value(registers_info_t *regs)
+{ +{
+ return regs->gpr[1]; + return regs->regs[1];
+} +}
+static inline uintptr_t call_arg1(pid_t pid, registers_info_t *regs) +static inline uintptr_t call_arg1(pid_t pid, registers_info_t *regs)
+{ +{
+ return regs->gpr[6]; + return regs->regs[6];
+} +}
+static inline uintptr_t call_arg2(pid_t pid, registers_info_t *regs) +static inline uintptr_t call_arg2(pid_t pid, registers_info_t *regs)
+{ +{
+ return regs->gpr[7]; + return regs->regs[7];
+} +}
+static inline uintptr_t pc_unwind(pid_t pid, registers_info_t *regs) +static inline uintptr_t pc_unwind(pid_t pid, registers_info_t *regs)
+{ +{
+ return regs->pc; + return regs->csr_era;
+} +}
+static inline void set_breakpoint(pid_t pid, uintptr_t address, uintptr_t code) +static inline void set_breakpoint(pid_t pid, uintptr_t address, uintptr_t code)
+{ +{
@ -71,4 +69,6 @@ index cbbe69d..4472bd1 100644
#elif defined(MLX_ARMv7) #elif defined(MLX_ARMv7)
static inline uintptr_t call_return_address(pid_t pid, registers_info_t *regs) static inline uintptr_t call_return_address(pid_t pid, registers_info_t *regs)
{ {
--
2.43.0

View File

@ -1,6 +1,6 @@
Name: memleax Name: memleax
Version: 1.1.1 Version: 1.1.1
Release: 7 Release: 8
Summary: Memory lead detection tool Summary: Memory lead detection tool
License: GPLv2 License: GPLv2
URL: https://github.com/WuBingzheng/memleax URL: https://github.com/WuBingzheng/memleax
@ -49,6 +49,9 @@ make install DESTDIR="%{buildroot}"
%{_mandir}/man1/%{name}.1* %{_mandir}/man1/%{name}.1*
%changelog %changelog
* Tue May 14 2024 wangshuo <wangshuo@kylinos.cn> - 1.1.1-8
- Resolve compilation errors for loongarch64
* Fri Jun 30 2023 zhangxiang <zhangxiang@iscas.ac.cn> - 1.1.1-7 * Fri Jun 30 2023 zhangxiang <zhangxiang@iscas.ac.cn> - 1.1.1-7
- add riscv64 support - add riscv64 support