aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Schaefer <gerald.schaefer@de.ibm.com>2012-11-08 12:46:55 +0100
committerEric B Munson <emunson@mgebm.net>2012-11-08 08:16:12 -0500
commitbcfabcdfcf146df88f24c9ffe56d9c70628de54d (patch)
tree22f55374cf3bb01b8b818f72e99b7013328b6810
parent5be36294eabcb289111686530396424e13e5e057 (diff)
downloadlibhugetlbfs-bcfabcdfcf146df88f24c9ffe56d9c70628de54d.tar.gz
Add --hugetlbfs-align linking support on s390
This patch adds support for libhugetlbfs linking on s390 for binutils >= 2.17 with the --hugetlbfs-align option. No custom linker scripts are provided, so CUSTOM_LDSCRIPTS is set to "no" and the deprecated --hugetlbfs-link option is not supported on s390. Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> Signed-off-by: Eric B Munson <emunson@mgebm.net>
-rw-r--r--HOWTO7
-rw-r--r--Makefile4
-rwxr-xr-xld.hugetlbfs1
-rw-r--r--sys-elf64_s390.S22
-rw-r--r--sys-elf_s390.S22
5 files changed, 52 insertions, 4 deletions
diff --git a/HOWTO b/HOWTO
index 8db958d..21eb34e 100644
--- a/HOWTO
+++ b/HOWTO
@@ -43,13 +43,14 @@ Hardware prerequisites
----------------------
You will need a CPU with some sort of hugepage support, which is
-handled by your kernel. The covers recent x86, AMD64 and 64-bit
-PowerPC(R) (POWER4, PPC970 and later) CPUs.
+handled by your kernel. This covers recent x86, AMD64, 64-bit
+PowerPC(R) (POWER4, PPC970 and later), and IBM System z CPUs.
Currently, only x86, AMD64 and PowerPC are fully supported by
libhugetlbfs. IA64 and Sparc64 have a working malloc, and SH64
should also but it has not been tested. IA64, Sparc64, and SH64
-do not support segment remapping at this time.
+do not support segment remapping at this time. IBM System z supports
+malloc and also segment remapping with --hugetlbfs-align.
Kernel prerequisites
--------------------
diff --git a/Makefile b/Makefile
index 3ec3c15..796b063 100644
--- a/Makefile
+++ b/Makefile
@@ -79,9 +79,11 @@ else
ifeq ($(ARCH),s390x)
CC64 = gcc -m64
CC32 = gcc -m31
+ELF32 = elf_s390
+ELF64 = elf64_s390
TMPLIB64 = lib64
TMPLIB32 = lib
-CFLAGS += -DNO_ELFLINK
+CUSTOM_LDSCRIPTS = no
else
$(error "Unrecognized architecture ($(ARCH))")
endif
diff --git a/ld.hugetlbfs b/ld.hugetlbfs
index aa25242..199bf97 100755
--- a/ld.hugetlbfs
+++ b/ld.hugetlbfs
@@ -85,6 +85,7 @@ MB=$((1024*1024))
case "$EMU" in
elf32ppclinux|elf64ppc) 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 ;;
esac
if [ "$HTLB_ALIGN" == "slice" ]; then
diff --git a/sys-elf64_s390.S b/sys-elf64_s390.S
new file mode 100644
index 0000000..425a387
--- /dev/null
+++ b/sys-elf64_s390.S
@@ -0,0 +1,22 @@
+/*
+ * libhugetlbfs - direct system call for s390 (64 bit)
+ *
+ * Copyright IBM Corp. 2012
+ * Author(s): Gerald Schaefer <gerald.schaefer@de.ibm.com>
+ *
+ * NOTE: Only 4 syscall parameters supported w/o stack access, but this is
+ * sufficient for the syscalls used so far (__NR_write, __NR_kill and
+ * __NR_getpid).
+ */
+
+ .text
+
+ .globl direct_syscall
+direct_syscall:
+ lgr %r1,%r2
+ lgr %r2,%r3
+ lgr %r3,%r4
+ lgr %r4,%r5
+ lgr %r5,%r6
+ svc 0
+ br %r14
diff --git a/sys-elf_s390.S b/sys-elf_s390.S
new file mode 100644
index 0000000..40630d1
--- /dev/null
+++ b/sys-elf_s390.S
@@ -0,0 +1,22 @@
+/*
+ * libhugetlbfs - direct system call for s390 (31 bit)
+ *
+ * Copyright IBM Corp. 2012
+ * Author(s): Gerald Schaefer <gerald.schaefer@de.ibm.com>
+ *
+ * NOTE: Only 4 syscall parameters supported w/o stack access, but this is
+ * sufficient for the syscalls used so far (__NR_write, __NR_kill and
+ * __NR_getpid).
+ */
+
+ .text
+
+ .globl direct_syscall
+direct_syscall:
+ lr %r1,%r2
+ lr %r2,%r3
+ lr %r3,%r4
+ lr %r4,%r5
+ lr %r5,%r6
+ svc 0
+ br %r14