On Thu, Dec 13, 2012 at 06:11:22PM +0000, Gerald Schaefer wrote:
> On Wed, 12 Dec 2012 18:10:02 +0000
> Steve Capper <steve.cap...@arm.com> wrote:
>
> > 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.
>
> Have you considered using the CUSTOM_LDSCRIPTS variable in the Makefile?
> It was introduced with the s390 support for the very same reason, i.e.
> to make it easier to provide arch support w/o the xBT/xBDT scripts, see
> git commit 5be36294eabcb289111686530396424e13e5e057.
>
Ahhh, thank you, yes that makes a lot more sense. Apologies I just didn't
notice CUSTOM_LDSCRIPTS when I was rebasing.
I've attached a simplified patch that sets CUSTOM_LDSCRIPTS=no.
Thanks,
--
Steve
>From 1f030401da3b683c8d07307564d67c48ce2f94b1 Mon Sep 17 00:00:00 2001
From: Steve Capper <steve.cap...@arm.com>
Date: Tue, 24 Jul 2012 10:32:07 -0400
Subject: [PATCH] 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.cap...@arm.com>
---
Makefile | 7 +++++++
ld.hugetlbfs | 12 ++++++++++++
sys-armelf_linux_eabi.S | 32 ++++++++++++++++++++++++++++++++
3 files changed, 51 insertions(+)
create mode 100644 sys-armelf_linux_eabi.S
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
--
1.8.0.1
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel