aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Capper <steve.capper@arm.com>2013-02-21 15:57:37 +0000
committerEric Munson <emunson@bert.(none)>2013-02-23 15:21:40 -0500
commit6aedf047e15db02f5e1472783c888a46d6e146b0 (patch)
tree9c6c76608e55e04fdbf7006c836c88489f52cfa4
parentff8c86c8d323b7a716c496558fa86c8f2a66dfe8 (diff)
downloadlibhugetlbfs-6aedf047e15db02f5e1472783c888a46d6e146b0.tar.gz
ARM support.
This patch adds support for the ARM architecture to libhugetlbfs. We do not add the xBT/xBDT style linker scripts as these have been deprecated in favour of adjusting the page sizes via command line parameter to ld. Signed-off-by: Steve Capper <steve.capper@arm.com> Acked-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Eric Munson <emunson@bert.(none)>
-rw-r--r--Makefile7
-rwxr-xr-xld.hugetlbfs12
-rw-r--r--sys-armelf_linux_eabi.S32
3 files changed, 51 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 796b063..48205af 100644
--- a/Makefile
+++ b/Makefile
@@ -51,6 +51,12 @@ CC32 = gcc -m32
ELF32 = elf32ppclinux
TMPLIB32 = lib
else
+ifeq ($(ARCH),armv7l)
+CC32 = gcc
+TMPLIB32 = lib
+ELF32 += armelf_linux_eabi
+CUSTOM_LDSCRIPTS = no
+else
ifeq ($(ARCH),i386)
CC32 = gcc
ELF32 = elf_i386
@@ -93,6 +99,7 @@ endif
endif
endif
endif
+endif
ifdef CC32
OBJDIRS += obj32
diff --git a/ld.hugetlbfs b/ld.hugetlbfs
index 199bf97..d6d12c4 100755
--- a/ld.hugetlbfs
+++ b/ld.hugetlbfs
@@ -79,6 +79,11 @@ if [ -n "$HTLB_LINK" ]; then
HTLB_ALIGN="" # --hugetlbfs-link overrides --hugetlbfs-align
LDSCRIPT="$EMU.x$HTLB_LINK"
HTLBOPTS="-T${HUGETLB_LDSCRIPT_PATH}/${LDSCRIPT}"
+
+ if [ "$EMU" == "armelf_linux_eabi" ]; then
+ echo "Please use --hugetlbfs-align when targeting ARM."
+ exit -1
+ fi
fi
MB=$((1024*1024))
@@ -86,11 +91,18 @@ 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 ;;
+armelf_linux_eabi) HPAGE_SIZE=$((2*$MB)) SLICE_SIZE=$HPAGE_SIZE ;;
esac
if [ "$HTLB_ALIGN" == "slice" ]; then
HTLBOPTS="-zcommon-page-size=$SLICE_SIZE -zmax-page-size=$SLICE_SIZE"
HTLBOPTS="$HTLBOPTS -lhugetlbfs"
+
+ # targeting the ARM platform one needs to explicitly set the text segment offset
+ # otherwise it will be NULL.
+ if [ "$EMU" == "armelf_linux_eabi" ]; then
+ HTLBOPTS="$HTLBOPTS -Ttext-segment=$SLICE_SIZE"
+ fi
fi
${LD} "${args[@]}" ${HTLBOPTS}
diff --git a/sys-armelf_linux_eabi.S b/sys-armelf_linux_eabi.S
new file mode 100644
index 0000000..983d28b
--- /dev/null
+++ b/sys-armelf_linux_eabi.S
@@ -0,0 +1,32 @@
+/*
+ * libhugetlbfs - Easy use of Linux hugepages
+ * Copyright (C) 2012 ARM 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 ip, sp
+ stmfd sp!, {r4, r5, r6, r7}
+ mov r7, r0
+ mov r0, r1
+ mov r1, r2
+ mov r2, r3
+ ldmfd ip, {r3, r4, r5, r6}
+ swi 0x0
+ ldmfd sp!, {r4, r5, r6, r7}
+ bx lr