mcst-linux-kernel/patches-2024.06.26/libhugetlbfs-2.18/0000-init.add.patch

111 lines
3.4 KiB
Diff

*** a/Makefile Sun Apr 6 16:11:46 2014
--- b/Makefile Thu Apr 18 02:01:29 2019
***************
*** 1,3 ****
--- 1,5 ----
+ ## E2K run (no tests): make V=1 PREFIX=/usr libs tools
+ ## ...with tests: make V=1 PREFIX=/usr
PREFIX ?= /usr/local
EXEDIR ?= /bin
***************
*** 105,114 ****
--- 107,128 ----
TMPLIB32 = lib
CUSTOM_LDSCRIPTS = no
else
+ ifeq ($(ARCH),e2k)
+ CC64 = $(CC) -mptr64
+ CC32 = $(CC) -mptr32
+ #ELF32 = elf32_e2k
+ #ELF64 = elf64_e2k
+ LIBOBJS32 = obj32/elflink.o
+ LIBOBJS64 = obj64/elflink.o
+ TMPLIB64 = lib64
+ TMPLIB32 = lib32
+ CUSTOM_LDSCRIPTS = no
+ else
$(error "Unrecognized architecture ($(ARCH))")
endif
endif
endif
+ endif
endif
endif
endif
*** a/elflink.c Sun Apr 6 16:11:46 2014
--- b/elflink.c Thu Apr 18 02:01:29 2019
***************
*** 77,82 ****
--- 77,83 ----
* FIXME: This works in practice, but I suspect it
* is not guaranteed safe: the library functions we call could in
* theory call other functions via the PLT which will blow up. */
+ #ifndef __e2k__
static void write_err(const char *start, int len)
{
direct_syscall(__NR_write, 2 /*stderr*/, start, len);
***************
*** 87,92 ****
--- 88,113 ----
direct_syscall(__NR_kill, pid, SIGABRT);
}
+ #else
+ #include <asm/e2k_api.h>
+ #ifdef __ptr32__
+ # define ELFLINK_E2K_TRAP 1
+ #elif defined(__ptr64__)
+ # define ELFLINK_E2K_TRAP 3
+ #else
+ # error "Can't define correct trap id for syscalls, if both __ptr32__ and __ptr64__ are undefined
+ #endif
+ static void write_err(const char *start, int len)
+ {
+ E2K_SYSCALL(ELFLINK_E2K_TRAP /*trap*/,__NR_write /*sys_num*/, 3 /*num_args*/, 2 /*stderr*/, start, len);
+ }
+ static void sys_abort(void)
+ {
+ pid_t pid = E2K_SYSCALL(ELFLINK_E2K_TRAP /*trap*/,__NR_getpid /*sys_num*/, 0 /*num_args*/);
+
+ E2K_SYSCALL(ELFLINK_E2K_TRAP /*trap*/,__NR_write /*sys_num*/, 2 /*num_args*/, pid, SIGABRT);
+ }
+ #endif
static void write_err_base(unsigned long val, int base)
{
const char digit[] = "0123456789abcdef";
*** a/ld.hugetlbfs Sun Apr 6 16:11:46 2014
--- b/ld.hugetlbfs Thu Apr 18 02:01:29 2019
***************
*** 87,92 ****
--- 87,93 ----
elf64lppc) HPAGE_SIZE=$((16*$MB)) SLICE_SIZE=$((256*$MB)) ;;
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 ;;
+ elf32_e2k|elf64_e2k) HPAGE_SIZE=$((4*$MB)) SLICE_SIZE=$HPAGE_SIZE ;;
armelf_linux_eabi|aarch64elf) HPAGE_SIZE=$((2*MB)) SLICE_SIZE=$HPAGE_SIZE ;;
esac
*** a/tests/Makefile Sun Apr 6 16:11:46 2014
--- b/tests/Makefile Thu Apr 18 02:01:29 2019
***************
*** 1,8 ****
PREFIX = /usr/local
LIB_TESTS = gethugepagesize test_root find_path unlinked_fd misalign \
readback truncate shared private fork-cow empty_mounts large_mounts \
! meminfo_nohuge ptrace-write-hugepage icache-hygiene slbpacaflush \
chunk-overcommit mprotect alloc-instantiate-race mlock \
truncate_reserve_wraparound truncate_sigbus_versus_oom \
map_high_truncate_2 truncate_above_4GB direct \
--- 1,9 ----
PREFIX = /usr/local
+ # commented - icache-hygiene
LIB_TESTS = gethugepagesize test_root find_path unlinked_fd misalign \
readback truncate shared private fork-cow empty_mounts large_mounts \
! meminfo_nohuge ptrace-write-hugepage slbpacaflush \
chunk-overcommit mprotect alloc-instantiate-race mlock \
truncate_reserve_wraparound truncate_sigbus_versus_oom \
map_high_truncate_2 truncate_above_4GB direct \