Source: libhugetlbfs
Version: 2.23-5
Severity: normal
X-Debbugs-Cc: wuruil...@loongson.cn

Dear Maintainer,

"Please refer to the attached patch to support the Loong64 architecture. This 
patch has been successfully compiled locally and has been merged upstream. The 
PR link is: https://github.com/libhugetlbfs/libhugetlbfs/pull/82";

wuruilong

-- System Information:
Debian Release: trixie/sid
  APT prefers unreleased
  APT policy: (500, 'unreleased'), (500, 'unstable')
Architecture: loong64 (loongarch64)

Kernel: Linux 5.10.0-60.96.0.126.oe2203.loongarch64 (SMP w/32 CPU threads)
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: unable to detect
Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 libhugetlbfs (2.23-5) unstable; urgency=medium
 .
   * Disable malloc if __morecore hook not available (Closes: #1017324)
Author: Punit Agrawal <pu...@debian.org>
Bug-Debian: https://bugs.debian.org/1017324

---
The information above should follow the Patch Tagging Guidelines, please
checkout https://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: (upstream|backport|vendor|other), (<patch-url>|commit:<commit-id>)
Bug: <upstream-bugtracker-url>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: (no|not-needed|<patch-forwarded-url>)
Applied-Upstream: <version>, (<commit-url>|commit:<commid-id>)
Reviewed-By: <name and email of someone who approved/reviewed the patch>
Last-Update: 2024-03-07

--- libhugetlbfs-2.23.orig/Makefile
+++ libhugetlbfs-2.23/Makefile
@@ -120,10 +120,17 @@ ELF64 = elf_riscv64
 TMPLIB64 = lib64
 CUSTOM_LDSCRIPTS = no
 else
+ifeq ($(ARCH),loongarch64)
+CC64 = $(CC) 
+ELF64 = elf_loong64
+TMPLIB64 = lib64
+CUSTOM_LDSCRIPTS = no
+else
 $(error "Unrecognized architecture ($(ARCH))")
 endif
 endif
 endif
+endif
 endif
 endif
 endif
--- /dev/null
+++ libhugetlbfs-2.23/sys-elf_loong64.S
@@ -0,0 +1,22 @@
+/*
+ * libhugetlbfs - direct system call for loong64
+ *
+ * Author(s): WuRuilong
+ */
+       .text
+
+       .globl  direct_syscall
+direct_syscall:
+        move     $a7, $a0
+        move     $a0, $a1
+       move      $a1, $a2
+        move      $a2, $a3
+        move      $a3, $a4 
+        move      $a4, $a5
+       move      $a5, $a6
+        syscall 0
+       ret
+
+#if defined(__linux__) && defined(__ELF__)
+       .section .note.GNU-stack,"",%progbits
+#endif
--- libhugetlbfs-2.23.orig/tests/icache-hygiene.c
+++ libhugetlbfs-2.23/tests/icache-hygiene.c
@@ -88,7 +88,8 @@ static void sig_handler(int signum, sigi
 {
 #if defined(__powerpc__) || defined(__powerpc64__) || defined(__ia64__) || \
     defined(__s390__) || defined(__s390x__) || defined(__sparc__) || \
-    defined(__aarch64__) || (defined(__riscv) && __riscv_xlen == 64)
+    defined(__aarch64__) || (defined(__riscv) && __riscv_xlen == 64) || \
+    defined(__loongarch64)
        /* On powerpc, ia64, s390 and Aarch64, 0 bytes are an illegal
         * instruction, so, if the icache is cleared properly, we SIGILL
         * as soon as we jump into the cleared page */

Reply via email to