Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
deepin-anything (6.2.4) unstable; urgency=medium

* Adapt kernel module for SW64 architecture.

-- Wen Lunpeng <wenlunpeng@uniontech.com> Tue, 11 Mar 2025 11:29:47 +0800

deepin-anything (6.2.3) unstable; urgency=medium

* Fix search fail for invalid path.
Expand Down
14 changes: 13 additions & 1 deletion src/kernelmod/arg_extractor.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
//
// SPDX-License-Identifier: GPL-3.0-or-later

#include <linux/kernel.h>

Check warning on line 6 in src/kernelmod/arg_extractor.c

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <linux/kernel.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <linux/module.h>

Check warning on line 7 in src/kernelmod/arg_extractor.c

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <linux/module.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.

#ifdef CONFIG_SW
#if defined(CONFIG_SW) || defined(CONFIG_SW64)
#include <uapi/linux/ptrace.h>

Check warning on line 10 in src/kernelmod/arg_extractor.c

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <uapi/linux/ptrace.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#endif

#if defined(__powerpc64__)
Expand All @@ -28,6 +28,8 @@
x86_64 args order: rdi, rsi, rdx, rcx, r8, r9, then comes the stack
loongson3 64bit args order: a0, a1, a2, a3, which is regs[4] ~ regs[7], then comes the stack
PT_R4(32) is the offset of regs[4] for loongson 64-bit, quoted from asm-offsets.h
sw64 args order: first 6 int args by r16~r21, namely a0 ~ a5, in pt_regs, regs[16] ~ reg[21]
in old struct pt_regs, called r16 ~ r21. so use offset like loongarch.
*/
switch (n) {
#if defined(CONFIG_X86_64)
Expand All @@ -54,6 +56,16 @@
case 3: return regs->r18;
case 4: return regs->r19;

#elif defined(CONFIG_SW64)
/* refer to arch/sw_64/kernel/traps.c
* & arch/sw_64/include/uapi/asm/regdef.h
*/
case 1: // r16
case 2: // r17
case 3: // r18
case 4: // r19
return *(unsigned long*)((char *)regs + (15+n)*8);

#elif defined(CONFIG_ARM64) || defined (CONFIG_AARCH64)

/*修改ARM上anything不能使用的问题,寄存器地址不正确*/
Expand Down
Loading