代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/libhugetlbfs 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 206ee484953757ce62dc6364cb70d16a59a6b45b Mon Sep 17 00:00:00 2001
From: liweigang <liweiganga@uniontech.com>
Date: Mon, 6 May 2024 09:38:25 +0000
Subject: [PATCH] add support sw64
---
Makefile.in | 7 ++++++
ld.hugetlbfs | 4 +--
sys-sw_64elf.S | 36 +++++++++++++++++++++++++++
tests/icache-hygiene.c | 4 +--
tests/mremap-expand-slice-collision.c | 2 +-
5 files changed, 48 insertions(+), 5 deletions(-)
create mode 100644 sys-sw_64elf.S
diff --git a/Makefile.in b/Makefile.in
index 65ae5a4..dfaeaca 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -67,6 +67,12 @@ TMPLIB32 = lib
ELF32 += armelf_linux_eabi
CUSTOM_LDSCRIPTS = no
else
+ifneq (,$(findstring sw_64,$(ARCH)))
+CC64 = $(CC)
+ELF64 = sw_64elf
+TMPLIB64 = lib
+CUSTOM_LDSCRIPTS = no
+else
ifneq (,$(findstring aarch64,$(ARCH)))
CC64 = $(CC)
ELF64 = aarch64elf
@@ -141,6 +147,7 @@ endif
endif
endif
endif
+endif
ifdef CC32
OBJDIRS += obj32
diff --git a/ld.hugetlbfs b/ld.hugetlbfs
index 5e4e497..d828f8b 100755
--- a/ld.hugetlbfs
+++ b/ld.hugetlbfs
@@ -117,7 +117,7 @@ elf64ppc|elf64lppc)
fi ;;
elf_i386|elf_x86_64) HPAGE_SIZE=$((4*$MB)) SLICE_SIZE=$HPAGE_SIZE ;;
elf_s390|elf64_s390) HPAGE_SIZE=$((1*$MB)) SLICE_SIZE=$HPAGE_SIZE ;;
-armelf*_linux_eabi|aarch64elf*|aarch64linux*)
+armelf*_linux_eabi|aarch64elf*|aarch64linux*|sw_64elf*|sw_64linux*)
hpage_kb=$(cat /proc/meminfo | grep Hugepagesize: | awk '{print $2}')
HPAGE_SIZE=$((hpage_kb * 1024))
SLICE_SIZE=$HPAGE_SIZE ;;
@@ -130,7 +130,7 @@ if [ "$HTLB_ALIGN" == "slice" ]; then
# targeting the ARM platform one needs to explicitly set the text segment offset
# otherwise it will be NULL.
case "$EMU" in
- armelf*_linux_eabi|aarch64elf*|aarch64linux*)
+ armelf*_linux_eabi|aarch64elf*|aarch64linux*|sw_64elf*|sw_64linux*)
printf -v TEXTADDR "%x" "$SLICE_SIZE"
HTLBOPTS="$HTLBOPTS -Ttext-segment=$TEXTADDR" ;;
elf_i386) HTLBOPTS="$HTLBOPTS -Ttext-segment=0x08000000" ;;
diff --git a/sys-sw_64elf.S b/sys-sw_64elf.S
new file mode 100644
index 0000000..78e0adf
--- /dev/null
+++ b/sys-sw_64elf.S
@@ -0,0 +1,36 @@
+/*
+ * libhugetlbfs - Easy use of Linux hugepages
+ * Copyright (C) 2013 Linaro Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+ .text
+
+ .globl direct_syscall
+
+
+direct_syscall:
+ mov $16,$0
+ mov $17,$16
+ mov $18,$17
+ mov $19,$18
+ mov $20,$19
+ mov $21,$20
+ sys_call 0x83
+ ret
+
+#if defined(__linux__) && defined(__ELF__)
+ .section .note.GNU-stack,"",%progbits
+#endif
diff --git a/tests/icache-hygiene.c b/tests/icache-hygiene.c
index 6f0e417..2e872fe 100644
--- a/tests/icache-hygiene.c
+++ b/tests/icache-hygiene.c
@@ -54,7 +54,7 @@ static void cacheflush(void *p)
{
#if defined(__powerpc__)
asm volatile("dcbst 0,%0; sync; icbi 0,%0; isync" : : "r"(p));
-#elif defined(__arm__) || defined(__aarch64__)
+#elif defined(__arm__) || defined(__aarch64__) || defined(__sw_64__)
__clear_cache(p, p + COPY_SIZE);
#endif
}
@@ -88,7 +88,7 @@ static void sig_handler(int signum, siginfo_t *si, void *uc)
{
#if defined(__powerpc__) || defined(__powerpc64__) || defined(__ia64__) || \
defined(__s390__) || defined(__s390x__) || defined(__sparc__) || \
- defined(__aarch64__) || (defined(__riscv) && __riscv_xlen == 64 || __loongarch64)
+ defined(__aarch64__) || defined(__sw_64__) || (defined(__riscv) && __riscv_xlen == 64 || __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 */
diff --git a/tests/mremap-expand-slice-collision.c b/tests/mremap-expand-slice-collision.c
index 78c11f2..dc2133c 100644
--- a/tests/mremap-expand-slice-collision.c
+++ b/tests/mremap-expand-slice-collision.c
@@ -38,7 +38,7 @@ void init_slice_boundary(int fd)
unsigned long slice_size;
void *p, *heap;
int i, rc;
-#if defined(__LP64__) && !defined(__aarch64__)
+#if defined(__LP64__) && !defined(__aarch64__) && !defined(__sw_64__)
/* powerpc: 1TB slices starting at 1 TB */
slice_boundary = 0x10000000000;
slice_size = 0x10000000000;
--
2.45.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。