Resolve compilation errors for loongarch64

This commit is contained in:
wangshuo 2024-05-13 23:19:29 +08:00
parent e0f5e0952b
commit 4376fb0387
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>
Date: Wed, 14 Dec 2022 02:58:36 +0000
Date: Tue, 14 May 2024 11:07:07 +0800
Subject: [PATCH] add loongarch64 support
---
configure | 6 +-
machines.h | 31 +++++++
tags | 252 +++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 288 insertions(+), 1 deletion(-)
create mode 100644 tags
configure | 6 +++++-
machines.h | 31 +++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/configure b/configure
index 7c7280f..60fd170 100755
@ -30,7 +28,7 @@ index 7c7280f..60fd170 100755
;;
esac
diff --git a/machines.h b/machines.h
index cbbe69d..4472bd1 100644
index cbbe69d..3e184d5 100644
--- a/machines.h
+++ b/machines.h
@@ -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)
+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)
+{
+ return regs->gpr[1];
+ return regs->regs[1];
+}
+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)
+{
+ return regs->gpr[7];
+ return regs->regs[7];
+}
+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)
+{
@ -71,4 +69,6 @@ index cbbe69d..4472bd1 100644
#elif defined(MLX_ARMv7)
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
Version: 1.1.1
Release: 7
Release: 8
Summary: Memory lead detection tool
License: GPLv2
URL: https://github.com/WuBingzheng/memleax
@ -49,6 +49,9 @@ make install DESTDIR="%{buildroot}"
%{_mandir}/man1/%{name}.1*
%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
- add riscv64 support