From 6c9dca5a9bc3aeab260bc125e8ddc08a5107ec4e Mon Sep 17 00:00:00 2001 From: Simon South Date: Mon, 1 Jun 2020 13:15:31 -0400 Subject: gnu: jamvm-1-bootstrap: Add aarch64-linux support. * gnu/packages/java.scm (jamvm-1-bootstrap)[source]: Add patch; update name of existing patch. [arguments]<#:phases>: Invoke autoreconf during bootstrap phase when building for aarch64. [native-inputs]: Include packages required for autoreconf when building for aarch64. * gnu/packages/patches/jamvm-1.5.1-aarch64-support.patch: New file. * gnu/packages/patches/jamvm-arm.patch: Rename to "jamvm-1.5.1-armv7-support.patch". * gnu/local.mk (dist_patch_DATA): Add file; update filename. Signed-off-by: Efraim Flashner --- gnu/local.mk | 3 +- gnu/packages/java.scm | 22 +- .../patches/jamvm-1.5.1-aarch64-support.patch | 572 +++++++++ .../patches/jamvm-1.5.1-armv7-support.patch | 1313 ++++++++++++++++++++ gnu/packages/patches/jamvm-arm.patch | 1313 -------------------- 5 files changed, 1907 insertions(+), 1316 deletions(-) create mode 100644 gnu/packages/patches/jamvm-1.5.1-aarch64-support.patch create mode 100644 gnu/packages/patches/jamvm-1.5.1-armv7-support.patch delete mode 100644 gnu/packages/patches/jamvm-arm.patch diff --git a/gnu/local.mk b/gnu/local.mk index 396629cc93..df098708e9 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1114,8 +1114,9 @@ dist_patch_DATA = \ %D%/packages/patches/irrlicht-use-system-libs.patch \ %D%/packages/patches/isl-0.11.1-aarch64-support.patch \ %D%/packages/patches/jacal-fix-texinfo.patch \ + %D%/packages/patches/jamvm-1.5.1-aarch64-support.patch \ + %D%/packages/patches/jamvm-1.5.1-armv7-support.patch \ %D%/packages/patches/jamvm-2.0.0-disable-branch-patching.patch \ - %D%/packages/patches/jamvm-arm.patch \ %D%/packages/patches/java-apache-ivy-port-to-latest-bouncycastle.patch \ %D%/packages/patches/java-commons-collections-fix-java8.patch \ %D%/packages/patches/java-jeromq-fix-tests.patch \ diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index 48f9a52a56..27a6ebc437 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -288,7 +288,8 @@ language.") (uri (string-append "mirror://sourceforge/jamvm/jamvm/" "JamVM%20" version "/jamvm-" version ".tar.gz")) - (patches (search-patches "jamvm-arm.patch")) + (patches (search-patches "jamvm-1.5.1-aarch64-support.patch" + "jamvm-1.5.1-armv7-support.patch")) (sha256 (base32 "06lhi03l3b0h48pc7x58bk9my2nrcf1flpmglvys3wyad6yraf36")) @@ -304,13 +305,30 @@ language.") (assoc-ref %build-inputs "classpath")) "--disable-int-caching" "--enable-runtime-reloc-checks" - "--enable-ffi"))) + "--enable-ffi") + #:phases + ,(if (string-prefix? "aarch64" (or (%current-system) + (%current-target-system))) + ;; Makefiles and the configure script need to be regenerated to + ;; incorporate support for AArch64. + '(modify-phases %standard-phases + (replace 'bootstrap + (lambda _ (invoke "autoreconf" "-vif")))) + '%standard-phases))) (inputs `(("classpath" ,classpath-bootstrap) ("jikes" ,jikes) ("libffi" ,libffi) ("zip" ,zip) ("zlib" ,zlib))) + (native-inputs + (if (string-prefix? "aarch64" (or (%current-system) + (%current-target-system))) + ;; Additional packages needed for autoreconf. + `(("autoconf" ,autoconf) + ("automake" ,automake) + ("libtool" ,libtool)) + '())) (home-page "http://jamvm.sourceforge.net/") (synopsis "Small Java Virtual Machine") (description "JamVM is a Java Virtual Machine conforming to the JVM diff --git a/gnu/packages/patches/jamvm-1.5.1-aarch64-support.patch b/gnu/packages/patches/jamvm-1.5.1-aarch64-support.patch new file mode 100644 index 0000000000..8867d4f191 --- /dev/null +++ b/gnu/packages/patches/jamvm-1.5.1-aarch64-support.patch @@ -0,0 +1,572 @@ +From 9c83c3d3f443eb92f87dc87c7dcfe95577b95621 Mon Sep 17 00:00:00 2001 +From: Simon South +Date: Thu, 28 May 2020 14:29:55 -0400 +Subject: [PATCH] Add support for aarch64 on GNU/Linux + +--- + configure.ac | 10 +- + src/arch/Makefile.am | 2 +- + src/arch/aarch64.h | 110 ++++++++++++++++ + src/os/linux/Makefile.am | 2 +- + src/os/linux/aarch64/Makefile.am | 28 ++++ + src/os/linux/aarch64/callNative.S | 212 ++++++++++++++++++++++++++++++ + src/os/linux/aarch64/dll_md.c | 59 +++++++++ + src/os/linux/aarch64/init.c | 51 +++++++ + 8 files changed, 469 insertions(+), 5 deletions(-) + create mode 100644 src/arch/aarch64.h + create mode 100644 src/os/linux/aarch64/Makefile.am + create mode 100644 src/os/linux/aarch64/callNative.S + create mode 100644 src/os/linux/aarch64/dll_md.c + create mode 100644 src/os/linux/aarch64/init.c + +diff --git a/configure.ac b/configure.ac +index ccd530f..707f281 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -43,6 +43,7 @@ amd64-*-freebsd*) host_os=bsd libdl_needed=no ;; + arm*-*-linux*) host_cpu=arm host_os=linux ;; + arm*-*-openbsd*) host_cpu=arm host_os=bsd libdl_needed=no ;; + arm*-*-freebsd*) host_cpu=arm host_os=bsd libdl_needed=no ;; ++aarch64*-*-linux*) host_cpu=aarch64 host_os=linux ;; + powerpc*-*-linux*) host_cpu=powerpc host_os=linux ;; + powerpc*-*-openbsd*) host_cpu=powerpc host_os=bsd libdl_needed=no ;; + powerpc*-*-freebsd*) host_cpu=powerpc host_os=bsd libdl_needed=no ;; +@@ -149,9 +150,11 @@ AC_ARG_ENABLE(runtime-reloc-checks, + + AC_ARG_ENABLE(int-inlining, + [AS_HELP_STRING(--enable-int-inlining,enable inline threaded version of the interpreter +- (by default enabled on x86_64, i386 and powerpc, disabled otherwise))],, +- [if test "$host_cpu" = x86_64 -o "$host_cpu" = i386 -o "$host_cpu" = powerpc && \ +- test "$cross_compiling" = no -o "$enable_runtime_reloc_checks" != no; then ++ (by default enabled on x86_64, i386, powerpc and aarch64, ++ disabled otherwise))],, ++ [if test "$host_cpu" = x86_64 -o "$host_cpu" = i386 -o "$host_cpu" = powerpc -o \ ++ "$host_cpu" = aarch64 && test "$cross_compiling" = no -o \ ++ "$enable_runtime_reloc_checks" != no; then + enable_int_inlining=yes + else + enable_int_inlining=no +@@ -298,6 +301,7 @@ AC_CONFIG_FILES( + src/os/linux/x86_64/Makefile \ + src/os/linux/parisc/Makefile \ + src/os/linux/mips/Makefile \ ++ src/os/linux/aarch64/Makefile \ + src/os/darwin/i386/Makefile \ + src/os/darwin/arm/Makefile \ + src/os/darwin/powerpc/Makefile \ +diff --git a/src/arch/Makefile.am b/src/arch/Makefile.am +index 078c1de..afb26d1 100644 +--- a/src/arch/Makefile.am ++++ b/src/arch/Makefile.am +@@ -19,4 +19,4 @@ + ## Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + ## + +-EXTRA_DIST = powerpc.h arm.h i386.h x86_64.h parisc.h mips.h ++EXTRA_DIST = powerpc.h arm.h i386.h x86_64.h parisc.h mips.h aarch64.h +diff --git a/src/arch/aarch64.h b/src/arch/aarch64.h +new file mode 100644 +index 0000000..c96aa9f +--- /dev/null ++++ b/src/arch/aarch64.h +@@ -0,0 +1,110 @@ ++/* ++ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 ++ * Robert Lougher . ++ * Copyright (C) 2020 Simon South . ++ * ++ * This file is part of JamVM. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2, ++ * or (at your option) any later version. ++ * ++ * This program 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 General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ */ ++ ++#include ++ ++#define OS_ARCH "aarch64" ++ ++#define HANDLER_TABLE_T static const void ++#define DOUBLE_1_BITS 0x3ff0000000000000LL ++ ++#define READ_DBL(v,p,l) v = ((u8)p[0]<<56)|((u8)p[1]<<48)|((u8)p[2]<<40) \ ++ |((u8)p[3]<<32)|((u8)p[4]<<24)|((u8)p[5]<<16) \ ++ |((u8)p[6]<<8)|(u8)p[7]; p+=8 ++ ++/* Needed for i386 -- empty here */ ++#define FPU_HACK ++ ++#define COMPARE_AND_SWAP_64(addr, old_val, new_val) \ ++({ \ ++ int result, read_val; \ ++ __asm__ __volatile__ (" \ ++ 1: ldaxr %2, %1; \ ++ cmp %2, %3; \ ++ b.ne 2f; \ ++ stlxr %w0, %4, %1; \ ++ cmp %w0, wzr; \ ++ b.ne 1b; \ ++ 2: cset %w0, eq;" \ ++ : "=&r" (result), "+Q" (*addr), "=&r" (read_val) \ ++ : "r" (old_val), "r" (new_val) \ ++ : "cc"); \ ++ result; \ ++}) ++ ++#define COMPARE_AND_SWAP(addr, old_val, new_val) \ ++ COMPARE_AND_SWAP_64(addr, old_val, new_val) ++ ++#define LOCKWORD_READ(addr) \ ++({ \ ++ uintptr_t result; \ ++ __asm__ __volatile__ (" \ ++ ldar %0, %1;" \ ++ : "=r" (result) \ ++ : "Q" (*addr) \ ++ : "cc"); \ ++ result; \ ++}) ++ ++#define LOCKWORD_WRITE(addr, value) \ ++({ \ ++ __asm__ __volatile__ (" \ ++ stlr %1, %0;" \ ++ : "=Q" (*addr) \ ++ : "r" (value) \ ++ : "cc"); \ ++}) ++ ++#define LOCKWORD_COMPARE_AND_SWAP(addr, old_val, new_val) \ ++ COMPARE_AND_SWAP_64(addr, old_val, new_val) ++ ++#define FLUSH_CACHE(addr, length) \ ++{ \ ++ uintptr_t start = (uintptr_t) (addr); \ ++ uintptr_t end = start + length; \ ++ uintptr_t i; \ ++ \ ++ for(i = start & aarch64_data_cache_line_mask; \ ++ i < end; \ ++ i += aarch64_data_cache_line_len) \ ++ __asm__ ("dc cvau, %0" :: "r" (i)); \ ++ \ ++ __asm__ ("dsb ish"); \ ++ \ ++ for(i = start & aarch64_instruction_cache_line_mask; \ ++ i < end; \ ++ i += aarch64_instruction_cache_line_len) \ ++ __asm__ ("ic ivau, %0" :: "r" (i)); \ ++ \ ++ __asm__ ("dsb ish; isb"); \ ++} ++ ++#define MBARRIER() __asm__ ("dmb ish" ::: "memory") ++#define UNLOCK_MBARRIER() __asm__ ("dmb ish" ::: "memory") ++#define JMM_LOCK_MBARRIER() __asm__ ("dmb ish" ::: "memory") ++#define JMM_UNLOCK_MBARRIER() JMM_LOCK_MBARRIER() ++ ++/* Defined in src/os/linux/aarch64/init.c */ ++extern unsigned char aarch64_data_cache_line_len; ++extern uintptr_t aarch64_data_cache_line_mask; ++extern unsigned char aarch64_instruction_cache_line_len; ++extern uintptr_t aarch64_instruction_cache_line_mask; +diff --git a/src/os/linux/Makefile.am b/src/os/linux/Makefile.am +index aa29be1..d582b97 100644 +--- a/src/os/linux/Makefile.am ++++ b/src/os/linux/Makefile.am +@@ -20,7 +20,7 @@ + ## + + SUBDIRS = @arch@ +-DIST_SUBDIRS = powerpc arm i386 x86_64 parisc mips ++DIST_SUBDIRS = powerpc arm i386 x86_64 parisc mips aarch64 + + noinst_LTLIBRARIES = libos.la + libos_la_SOURCES = os.c +diff --git a/src/os/linux/aarch64/Makefile.am b/src/os/linux/aarch64/Makefile.am +new file mode 100644 +index 0000000..1024c3a +--- /dev/null ++++ b/src/os/linux/aarch64/Makefile.am +@@ -0,0 +1,28 @@ ++## ++## Copyright (C) 2003, 2004, 2005, 2006, 2007, 2010, 2011, 2012 ++## Robert Lougher . ++## ++## File added by Simon South . ++## ++## This file is part of JamVM. ++## ++## This program is free software; you can redistribute it and/or ++## modify it under the terms of the GNU General Public License ++## as published by the Free Software Foundation; either version 2, ++## or (at your option) any later version. ++## ++## This program 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 General Public License for more details. ++## ++## You should have received a copy of the GNU General Public License ++## along with this program; if not, write to the Free Software ++## Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++## ++ ++noinst_LTLIBRARIES = libnative.la ++libnative_la_SOURCES = init.c dll_md.c callNative.S ++ ++AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src ++AM_CCASFLAGS = -I$(top_builddir)/src +diff --git a/src/os/linux/aarch64/callNative.S b/src/os/linux/aarch64/callNative.S +new file mode 100644 +index 0000000..e067c4f +--- /dev/null ++++ b/src/os/linux/aarch64/callNative.S +@@ -0,0 +1,212 @@ ++/* ++ * Copyright (C) 2008, 2009, 2011, 2012 Robert Lougher . ++ * Copyright (C) 2020 Simon South . ++ * ++ * This file is part of JamVM. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2, ++ * or (at your option) any later version. ++ * ++ * This program 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 General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ */ ++ ++#include "config.h" ++ ++#ifndef USE_FFI ++ .text ++ .arch armv8-a ++ .align 2 ++ .global callJNIMethod ++ .type callJNIMethod,function ++ ++/* ++ * Arguments passed in: ++ * ++ * x0 JNIEnv ++ * x1 class or NULL ++ * x2 sig ++ * w3 extra arg ++ * x4 ostack ++ * x5 function pntr ++ * w6 args count ++ */ ++ ++/* Register usage: ++ * ++ * x20 ostack ++ * x19 sig pntr ++ * x16 function pntr ++ * x15 ostack pntr ++ * x14 args pntr ++ * x13 float/double handler ++ * x12 int/long handler ++ * w11 fp regs remaining ++ * w10 int regs remaining ++ * x9 scratch ++ * x2-x7 outgoing int args ++ * x1 outgoing class or this pntr ++ * x0 outgoing JNIEnv (as passed in) ++ * ++ * d0 - d7 outgoing float args ++ */ ++ ++callJNIMethod: ++ stp x29, x30, [sp, #-32]! ++ mov x29, sp ++ stp x19, x20, [x29, #16] ++ ++ sub sp, sp, w3 /* allocate room for stacked args */ ++ mov x14, sp ++ ++ mov x20, x4 /* preserve ostack */ ++ add x19, x2, #1 /* init sig pntr -- skipping '(' */ ++ ++ mov x16, x5 /* save function pntr */ ++ mov x15, x20 /* init ostack pntr */ ++ ++ adr x13, fp_reg_handlers-8 ++ adr x12, int_reg_handlers-8 ++ ++ mov w11, #8 /* fp regs remaining */ ++ mov w10, #6 /* int regs remaining */ ++ ++ cbnz x1, scan_sig /* is method non-static? */ ++ ldr x1, [x15], #8 /* yes, load x1 with "this" */ ++ ++scan_sig: ++ ldrb w9, [x19], #1 /* get next sig char */ ++ ++ cmp w9, #41 /* ')' */ ++ b.eq done ++ ++ cmp w9, #74 /* 'J' */ ++ b.eq long ++ ++ cmp w9, #70 /* 'F' */ ++ b.eq float ++ ++ cmp w9, #68 /* 'D' */ ++ b.eq double ++ ++skip_brackets: ++ cmp w9, #91 /* '[' */ ++ b.ne 1f ++ ldrb w9, [x19], #1 ++ b skip_brackets ++1: ++ cmp w9, #76 /* 'L' */ ++ b.ne int ++ ++skip_ref: ++ ldrb w9, [x19], #1 ++ cmp w9, #59 /* ';' */ ++ b.ne skip_ref ++ ++int: ++ ldr x9, [x15], #8 ++ cbz w10, stack_push ++ ++load_int_reg: ++ sub w10, w10, #1 ++ add x12, x12, #8 ++ br x12 ++ ++int_reg_handlers: ++ mov x2, x9 ++ b scan_sig ++ mov x3, x9 ++ b scan_sig ++ mov x4, x9 ++ b scan_sig ++ mov x5, x9 ++ b scan_sig ++ mov x6, x9 ++ b scan_sig ++ mov x7, x9 ++ b scan_sig ++ ++long: ++ ldr x9, [x15], #16 ++ cbz w10, stack_push ++ b load_int_reg ++ ++float: ++ ldr w9, [x15], #8 ++ cbz w11, stack_push ++ b load_fp_reg ++ ++double: ++ ldr x9, [x15], #16 ++ cbz w11, stack_push ++ ++load_fp_reg: ++ sub w11, w11, #1 ++ add x13, x13, #8 ++ br x13 ++ ++fp_reg_handlers: ++ fmov d0, x9 ++ b scan_sig ++ fmov d1, x9 ++ b scan_sig ++ fmov d2, x9 ++ b scan_sig ++ fmov d3, x9 ++ b scan_sig ++ fmov d4, x9 ++ b scan_sig ++ fmov d5, x9 ++ b scan_sig ++ fmov d6, x9 ++ b scan_sig ++ fmov d7, x9 ++ b scan_sig ++ ++stack_push: ++ str x9, [x14], #8 ++ b scan_sig ++ ++done: ++ /* Call the function */ ++ blr x16 ++ ++ mov sp, x29 /* Pop argument area */ ++ ++ ldrb w9, [x19] /* Return type */ ++ ++ cmp w9, #86 /* 'V' */ ++ b.eq return ++ ++ cmp w9, #68 /* 'D' */ ++ b.ne 2f ++ str d0, [x20], #16 ++ b return ++2: ++ cmp w9, #70 /* 'F' */ ++ b.ne 3f ++ str s0, [x20], #8 ++ b return ++3: ++ cmp w9, #74 /* 'J' */ ++ b.ne 4f ++ str x0, [x20], #16 ++ b return ++4: ++ str x0, [x20], #8 ++ ++return: ++ mov x0, x20 /* return ostack */ ++ ++ ldp x19, x20, [x29, #16] ++ ldp x29, x30, [sp], #32 ++ ret ++#endif +diff --git a/src/os/linux/aarch64/dll_md.c b/src/os/linux/aarch64/dll_md.c +new file mode 100644 +index 0000000..189f8a8 +--- /dev/null ++++ b/src/os/linux/aarch64/dll_md.c +@@ -0,0 +1,59 @@ ++/* ++ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011 ++ * Robert Lougher . ++ * Copyright (C) 2020 Simon South . ++ * ++ * This file is part of JamVM. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2, ++ * or (at your option) any later version. ++ * ++ * This program 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 General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ */ ++ ++#include "jam.h" ++ ++#ifndef USE_FFI ++ ++int nativeExtraArg(MethodBlock *mb) { ++ char *sig = mb->type; ++ int stack_args = 0; ++ int int_args = 6; ++ int fp_args = 8; ++ ++ while(*++sig != ')') ++ switch(*sig) { ++ case 'F': ++ case 'D': ++ if(fp_args == 0) ++ stack_args += 8; ++ else ++ fp_args--; ++ ++ default: ++ if(int_args == 0) ++ stack_args += 8; ++ else ++ int_args--; ++ ++ if(*sig == '[') ++ while(*++sig == '['); ++ if(*sig == 'L') ++ while(*++sig != ';'); ++ break; ++ } ++ ++ /* Ensure the stack remains 16 byte aligned. */ ++ return (stack_args + 15) & ~15; ++} ++ ++#endif +diff --git a/src/os/linux/aarch64/init.c b/src/os/linux/aarch64/init.c +new file mode 100644 +index 0000000..e03b446 +--- /dev/null ++++ b/src/os/linux/aarch64/init.c +@@ -0,0 +1,51 @@ ++/* ++ * Copyright (C) 2003, 2004, 2005, 2006, 2007 ++ * Robert Lougher . ++ * Copyright (C) 2020 Simon South . ++ * ++ * This file is part of JamVM. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2, ++ * or (at your option) any later version. ++ * ++ * This program 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 General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ */ ++ ++#include "arch/aarch64.h" ++ ++/* Length in bytes of the smallest line in the host system's data cache */ ++unsigned char aarch64_data_cache_line_len; ++ ++/* Mask used to align a virtual address to a line in the data cache */ ++uintptr_t aarch64_data_cache_line_mask; ++ ++/* Length in bytes of the smallest line in the host system's instruction ++ cache */ ++unsigned char aarch64_instruction_cache_line_len; ++ ++/* Mask used to align a virtual address to a line in the instruction cache */ ++uintptr_t aarch64_instruction_cache_line_mask; ++ ++void initialisePlatform() { ++ unsigned int cache_type; ++ ++ /* Extract information from the cache-type register, which describes aspects ++ of the host's cache configuration */ ++ __asm__ ("mrs %0, ctr_el0" : "=r" (cache_type)); ++ ++ aarch64_data_cache_line_len = 4 << ((cache_type >> 16) & 0x0f); ++ aarch64_data_cache_line_mask = ~(aarch64_data_cache_line_len - 1); ++ ++ aarch64_instruction_cache_line_len = 4 << (cache_type & 0x0f); ++ aarch64_instruction_cache_line_mask = ++ ~(aarch64_instruction_cache_line_len - 1); ++} +-- +2.26.2 + diff --git a/gnu/packages/patches/jamvm-1.5.1-armv7-support.patch b/gnu/packages/patches/jamvm-1.5.1-armv7-support.patch new file mode 100644 index 0000000000..9e998e18db --- /dev/null +++ b/gnu/packages/patches/jamvm-1.5.1-armv7-support.patch @@ -0,0 +1,1313 @@ +From 67faeb7d58e0d25a50d36788ed49ed383b92e090 Mon Sep 17 00:00:00 2001 +From: Efraim Flashner +Date: Mon, 26 Mar 2018 11:08:17 +0300 +Subject: [PATCH] add ARMv7 support + +--- + src/arch/arm.h | 75 +++++- + src/os/linux/arm/Makefile.am | 9 +- + src/os/linux/arm/Makefile.in | 166 ++++++++---- + src/os/linux/arm/callNative.S | 12 +- + src/os/linux/arm/callNativeEABI.S | 8 +- + src/os/linux/arm/callNativeEABIHard.S | 315 +++++++++++++++++++++++ + src/os/linux/arm/callNativeEABIHardARM.S | 266 +++++++++++++++++++ + src/os/linux/arm/dll_md.c | 61 ++++- + 8 files changed, 843 insertions(+), 69 deletions(-) + create mode 100644 src/os/linux/arm/callNativeEABIHard.S + create mode 100644 src/os/linux/arm/callNativeEABIHardARM.S + +diff --git a/src/arch/arm.h b/src/arch/arm.h +index ccf68c4..d2c0318 100644 +--- a/src/arch/arm.h ++++ b/src/arch/arm.h +@@ -1,6 +1,6 @@ + /* +- * Copyright (C) 2003, 2004, 2005, 2006, 2007 +- * Robert Lougher . ++ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, ++ * 2014 Robert Lougher . + * + * This file is part of JamVM. + * +@@ -21,10 +21,16 @@ + + #define OS_ARCH "arm" + +-/* Override default min and max heap sizes. ARM machines are +- usually embedded, and the standard defaults are too large. */ +-#define DEFAULT_MAX_HEAP 16*MB ++/* Override minimum min heap size. The initial heap size is a ratio ++ of the physical memory, but it must be at least the minimum min ++ size. The normal setting is too large for ARM machines as they ++ are usually embedded. */ ++#define MIN_MIN_HEAP 1*MB ++ ++/* Likewise, override the default min/max heap sizes used when the ++ size of physical memory is not available */ + #define DEFAULT_MIN_HEAP 1*MB ++#define DEFAULT_MAX_HEAP 64*MB + + #ifdef DIRECT + #define HANDLER_TABLE_T static const void +@@ -51,6 +57,36 @@ + /* Needed for i386 -- empty here */ + #define FPU_HACK + ++#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7A__) ++#define COMPARE_AND_SWAP_32(addr, old_val, new_val) \ ++({ \ ++ int result, read_val; \ ++ __asm__ __volatile__ (" \ ++ 1: mov %0, #0; \ ++ ldrex %1, [%2]; \ ++ cmp %3, %1; \ ++ bne 2f; \ ++ strex %0, %4, [%2]; \ ++ cmp %0, #1; \ ++ beq 1b; \ ++ mov %0, #1; \ ++ 2:" \ ++ : "=&r" (result), "=&r" (read_val) \ ++ : "r" (addr), "r" (old_val), "r" (new_val) \ ++ : "cc", "memory"); \ ++ result; \ ++}) ++ ++#define COMPARE_AND_SWAP(addr, old_val, new_val) \ ++ COMPARE_AND_SWAP_32(addr, old_val, new_val) ++ ++#define LOCKWORD_READ(addr) *addr ++#define LOCKWORD_WRITE(addr, value) *addr = value ++#define LOCKWORD_COMPARE_AND_SWAP(addr, old_val, new_val) \ ++ COMPARE_AND_SWAP(addr, old_val, new_val) ++ ++#else ++ + #define LOCKWORD_COMPARE_AND_SWAP(addr, old_val, new_val) \ + ({ \ + int result, read_val; \ +@@ -94,7 +130,7 @@ do { \ + : "r" (addr), "r" (new_val) \ + : "cc", "memory"); \ + } while(0) +- ++#endif + + #ifdef __ARM_EABI__ + #define FLUSH_CACHE(addr, length) \ +@@ -124,8 +160,33 @@ do { \ + } + #endif + ++#define GEN_REL_JMP(target_addr, patch_addr, patch_size) \ ++({ \ ++ int patched = FALSE; \ ++ \ ++ if(patch_size >= 4) { \ ++ /* Guard against the pointer difference being \ ++ larger than the signed range */ \ ++ long long offset = (uintptr_t)(target_addr) - \ ++ (uintptr_t)(patch_addr) - 8; \ ++ \ ++ if(offset >= -1<<25 && offset < 1<<25) { \ ++ *(int*)(patch_addr) = offset>>2 & 0x00ffffff \ ++ | 0xea000000; \ ++ patched = TRUE; \ ++ } \ ++ } \ ++ patched; \ ++}) ++ ++#ifdef __ARM_ARCH_7A__ ++#define MBARRIER() __asm__ __volatile__ ("dmb" ::: "memory") ++#define UNLOCK_MBARRIER() __asm__ __volatile__ ("dmb" ::: "memory") ++#define JMM_LOCK_MBARRIER() __asm__ __volatile__ ("dmb" ::: "memory") ++#define JMM_UNLOCK_MBARRIER() __asm__ __volatile__ ("dmb" ::: "memory") ++#else + #define MBARRIER() __asm__ __volatile__ ("" ::: "memory") + #define UNLOCK_MBARRIER() __asm__ __volatile__ ("" ::: "memory") + #define JMM_LOCK_MBARRIER() __asm__ __volatile__ ("" ::: "memory") + #define JMM_UNLOCK_MBARRIER() __asm__ __volatile__ ("" ::: "memory") +- ++#endif +diff --git a/src/os/linux/arm/Makefile.am b/src/os/linux/arm/Makefile.am +index d18ea5a..74e7786 100644 +--- a/src/os/linux/arm/Makefile.am ++++ b/src/os/linux/arm/Makefile.am +@@ -1,6 +1,6 @@ + ## +-## Copyright (C) 2003, 2004, 2005, 2006, 2007 +-## Robert Lougher . ++## Copyright (C) 2003, 2004, 2005, 2006, 2007, 2010, 2011, 2012 ++## Robert Lougher . + ## + ## This file is part of JamVM. + ## +@@ -19,10 +19,11 @@ + ## Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + ## + +-EXTRA_DIST = callNativeOABI.S callNativeEABI.S ++EXTRA_DIST = callNativeOABI.S callNativeEABI.S callNativeEABIHard.S \ ++ callNativeEABIHardARM.S + + noinst_LTLIBRARIES = libnative.la + libnative_la_SOURCES = init.c dll_md.c callNative.S + +-AM_CPPFLAGS = -I$(top_builddir)/src ++AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src + AM_CCASFLAGS = -I$(top_builddir)/src +diff --git a/src/os/linux/arm/Makefile.in b/src/os/linux/arm/Makefile.in +index 63b21ad..6d44ea9 100644 +--- a/src/os/linux/arm/Makefile.in ++++ b/src/os/linux/arm/Makefile.in +@@ -1,8 +1,9 @@ +-# Makefile.in generated by automake 1.10 from Makefile.am. ++# Makefile.in generated by automake 1.11.6 from Makefile.am. + # @configure_input@ + + # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +-# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. ++# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software ++# Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation + # gives unlimited permission to copy and/or distribute it, + # with or without modifications, as long as this notice is preserved. +@@ -15,9 +16,27 @@ + @SET_MAKE@ + + VPATH = @srcdir@ ++am__make_dryrun = \ ++ { \ ++ am__dry=no; \ ++ case $$MAKEFLAGS in \ ++ *\\[\ \ ]*) \ ++ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ ++ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ ++ *) \ ++ for am__flg in $$MAKEFLAGS; do \ ++ case $$am__flg in \ ++ *=*|--*) ;; \ ++ *n*) am__dry=yes; break;; \ ++ esac; \ ++ done;; \ ++ esac; \ ++ test $$am__dry = yes; \ ++ } + pkgdatadir = $(datadir)/@PACKAGE@ +-pkglibdir = $(libdir)/@PACKAGE@ + pkgincludedir = $(includedir)/@PACKAGE@ ++pkglibdir = $(libdir)/@PACKAGE@ ++pkglibexecdir = $(libexecdir)/@PACKAGE@ + am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd + install_sh_DATA = $(install_sh) -c -m 644 + install_sh_PROGRAM = $(install_sh) -c +@@ -42,13 +61,15 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs + CONFIG_HEADER = $(top_builddir)/src/config.h + CONFIG_CLEAN_FILES = ++CONFIG_CLEAN_VPATH_FILES = + LTLIBRARIES = $(noinst_LTLIBRARIES) + libnative_la_LIBADD = + am_libnative_la_OBJECTS = init.lo dll_md.lo callNative.lo + libnative_la_OBJECTS = $(am_libnative_la_OBJECTS) +-DEFAULT_INCLUDES = -I. -I$(top_builddir)/src@am__isrc@ ++DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src + depcomp = $(SHELL) $(top_srcdir)/depcomp + am__depfiles_maybe = depfiles ++am__mv = mv -f + CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS) + LTCPPASCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ +@@ -65,6 +86,11 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + $(LDFLAGS) -o $@ + SOURCES = $(libnative_la_SOURCES) + DIST_SOURCES = $(libnative_la_SOURCES) ++am__can_run_installinfo = \ ++ case $$AM_UPDATE_INFO_DIR in \ ++ n|no|NO) false;; \ ++ *) (install-info --version) >/dev/null 2>&1;; \ ++ esac + ETAGS = etags + CTAGS = ctags + DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +@@ -84,21 +110,18 @@ CCDEPMODE = @CCDEPMODE@ + CFLAGS = @CFLAGS@ + CPP = @CPP@ + CPPFLAGS = @CPPFLAGS@ +-CXX = @CXX@ +-CXXCPP = @CXXCPP@ +-CXXDEPMODE = @CXXDEPMODE@ +-CXXFLAGS = @CXXFLAGS@ + CYGPATH_W = @CYGPATH_W@ + DEFS = @DEFS@ + DEPDIR = @DEPDIR@ +-ECHO = @ECHO@ ++DLLTOOL = @DLLTOOL@ ++DSYMUTIL = @DSYMUTIL@ ++DUMPBIN = @DUMPBIN@ + ECHO_C = @ECHO_C@ + ECHO_N = @ECHO_N@ + ECHO_T = @ECHO_T@ + EGREP = @EGREP@ + EXEEXT = @EXEEXT@ +-F77 = @F77@ +-FFLAGS = @FFLAGS@ ++FGREP = @FGREP@ + GREP = @GREP@ + INSTALL = @INSTALL@ + INSTALL_DATA = @INSTALL_DATA@ +@@ -106,21 +129,30 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ + INSTALL_SCRIPT = @INSTALL_SCRIPT@ + INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ + JAVAC = @JAVAC@ ++LD = @LD@ + LDFLAGS = @LDFLAGS@ + LIBOBJS = @LIBOBJS@ + LIBS = @LIBS@ + LIBTOOL = @LIBTOOL@ ++LIPO = @LIPO@ + LN_S = @LN_S@ + LTLIBOBJS = @LTLIBOBJS@ + MAINT = @MAINT@ + MAKEINFO = @MAKEINFO@ ++MANIFEST_TOOL = @MANIFEST_TOOL@ + MKDIR_P = @MKDIR_P@ ++NM = @NM@ ++NMEDIT = @NMEDIT@ ++OBJDUMP = @OBJDUMP@ + OBJEXT = @OBJEXT@ ++OTOOL = @OTOOL@ ++OTOOL64 = @OTOOL64@ + PACKAGE = @PACKAGE@ + PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ + PACKAGE_NAME = @PACKAGE_NAME@ + PACKAGE_STRING = @PACKAGE_STRING@ + PACKAGE_TARNAME = @PACKAGE_TARNAME@ ++PACKAGE_URL = @PACKAGE_URL@ + PACKAGE_VERSION = @PACKAGE_VERSION@ + PATH_SEPARATOR = @PATH_SEPARATOR@ + RANLIB = @RANLIB@ +@@ -133,9 +165,9 @@ abs_builddir = @abs_builddir@ + abs_srcdir = @abs_srcdir@ + abs_top_builddir = @abs_top_builddir@ + abs_top_srcdir = @abs_top_srcdir@ ++ac_ct_AR = @ac_ct_AR@ + ac_ct_CC = @ac_ct_CC@ +-ac_ct_CXX = @ac_ct_CXX@ +-ac_ct_F77 = @ac_ct_F77@ ++ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ + am__include = @am__include@ + am__leading_dot = @am__leading_dot@ + am__quote = @am__quote@ +@@ -149,6 +181,7 @@ build_cpu = @build_cpu@ + build_os = @build_os@ + build_vendor = @build_vendor@ + builddir = @builddir@ ++classlib = @classlib@ + datadir = @datadir@ + datarootdir = @datarootdir@ + docdir = @docdir@ +@@ -181,15 +214,18 @@ sharedstatedir = @sharedstatedir@ + srcdir = @srcdir@ + sysconfdir = @sysconfdir@ + target_alias = @target_alias@ ++top_build_prefix = @top_build_prefix@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ + use_zip_no = @use_zip_no@ + use_zip_yes = @use_zip_yes@ + with_classpath_install_dir = @with_classpath_install_dir@ +-EXTRA_DIST = callNativeOABI.S callNativeEABI.S ++EXTRA_DIST = callNativeOABI.S callNativeEABI.S callNativeEABIHard.S \ ++ callNativeEABIHardARM.S ++ + noinst_LTLIBRARIES = libnative.la + libnative_la_SOURCES = init.c dll_md.c callNative.S +-AM_CPPFLAGS = -I$(top_builddir)/src ++AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src + AM_CCASFLAGS = -I$(top_builddir)/src + all: all-am + +@@ -199,14 +235,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ +- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ +- && exit 0; \ ++ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ ++ && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ +- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/os/linux/arm/Makefile'; \ +- cd $(top_srcdir) && \ +- $(AUTOMAKE) --gnu src/os/linux/arm/Makefile ++ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/os/linux/arm/Makefile'; \ ++ $(am__cd) $(top_srcdir) && \ ++ $(AUTOMAKE) --gnu src/os/linux/arm/Makefile + .PRECIOUS: Makefile + Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ +@@ -224,6 +260,7 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ++$(am__aclocal_m4_deps): + + clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) +@@ -233,7 +270,7 @@ clean-noinstLTLIBRARIES: + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +-libnative.la: $(libnative_la_OBJECTS) $(libnative_la_DEPENDENCIES) ++libnative.la: $(libnative_la_OBJECTS) $(libnative_la_DEPENDENCIES) $(EXTRA_libnative_la_DEPENDENCIES) + $(LINK) $(libnative_la_OBJECTS) $(libnative_la_LIBADD) $(LIBS) + + mostlyclean-compile: +@@ -248,42 +285,42 @@ distclean-compile: + + .S.o: + @am__fastdepCCAS_TRUE@ $(CPPASCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +-@am__fastdepCCAS_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po ++@am__fastdepCCAS_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po + @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ + @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + @am__fastdepCCAS_FALSE@ $(CPPASCOMPILE) -c -o $@ $< + + .S.obj: + @am__fastdepCCAS_TRUE@ $(CPPASCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +-@am__fastdepCCAS_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po ++@am__fastdepCCAS_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po + @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ + @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + @am__fastdepCCAS_FALSE@ $(CPPASCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + + .S.lo: + @am__fastdepCCAS_TRUE@ $(LTCPPASCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +-@am__fastdepCCAS_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo ++@am__fastdepCCAS_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo + @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ + @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + @am__fastdepCCAS_FALSE@ $(LTCPPASCOMPILE) -c -o $@ $< + + .c.o: + @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po ++@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po + @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ + @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + @am__fastdepCC_FALSE@ $(COMPILE) -c $< + + .c.obj: + @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po ++@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po + @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ + @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + + .c.lo: + @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo ++@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo + @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ + @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< +@@ -299,45 +336,49 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ +- $(AWK) ' { files[$$0] = 1; } \ +- END { for (i in files) print i; }'`; \ ++ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ ++ END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique + tags: TAGS + + TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) +- tags=; \ ++ set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ +- $(AWK) ' { files[$$0] = 1; } \ +- END { for (i in files) print i; }'`; \ +- if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ ++ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ ++ END { if (nonempty) { for (i in files) print i; }; }'`; \ ++ shift; \ ++ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ +- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ +- $$tags $$unique; \ ++ if test $$# -gt 0; then \ ++ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ ++ "$$@" $$unique; \ ++ else \ ++ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ ++ $$unique; \ ++ fi; \ + fi + ctags: CTAGS + CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) +- tags=; \ +- here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ +- $(AWK) ' { files[$$0] = 1; } \ +- END { for (i in files) print i; }'`; \ +- test -z "$(CTAGS_ARGS)$$tags$$unique" \ ++ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ ++ END { if (nonempty) { for (i in files) print i; }; }'`; \ ++ test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ +- $$tags $$unique ++ $$unique + + GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ +- && cd $(top_srcdir) \ +- && gtags -i $(GTAGS_ARGS) $$here ++ && $(am__cd) $(top_srcdir) \ ++ && gtags -i $(GTAGS_ARGS) "$$here" + + distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +@@ -358,13 +399,17 @@ distdir: $(DISTFILES) + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ ++ if test -d "$(distdir)/$$file"; then \ ++ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ ++ fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ +- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ ++ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ ++ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ +- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ ++ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ +- test -f $(distdir)/$$file \ +- || cp -p $$d/$$file $(distdir)/$$file \ ++ test -f "$(distdir)/$$file" \ ++ || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +@@ -382,16 +427,22 @@ install-am: all-am + + installcheck: installcheck-am + install-strip: +- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ +- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ +- `test -z '$(STRIP)' || \ +- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install ++ if test -z '$(STRIP)'; then \ ++ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ ++ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ ++ install; \ ++ else \ ++ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ ++ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ ++ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ ++ fi + mostlyclean-generic: + + clean-generic: + + distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) ++ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + + maintainer-clean-generic: + @echo "This command is intended for maintainers to use" +@@ -413,6 +464,8 @@ dvi-am: + + html: html-am + ++html-am: ++ + info: info-am + + info-am: +@@ -421,18 +474,28 @@ install-data-am: + + install-dvi: install-dvi-am + ++install-dvi-am: ++ + install-exec-am: + + install-html: install-html-am + ++install-html-am: ++ + install-info: install-info-am + ++install-info-am: ++ + install-man: + + install-pdf: install-pdf-am + ++install-pdf-am: ++ + install-ps: install-ps-am + ++install-ps-am: ++ + installcheck-am: + + maintainer-clean: maintainer-clean-am +@@ -470,6 +533,7 @@ uninstall-am: + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am + ++ + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. + .NOEXPORT: +diff --git a/src/os/linux/arm/callNative.S b/src/os/linux/arm/callNative.S +index 39ab6d3..245afd1 100644 +--- a/src/os/linux/arm/callNative.S ++++ b/src/os/linux/arm/callNative.S +@@ -1,6 +1,6 @@ + /* +- * Copyright (C) 2003, 2004, 2005, 2006, 2007 +- * Robert Lougher . ++ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2011, 2012 ++ * Robert Lougher . + * + * This file is part of JamVM. + * +@@ -23,7 +23,15 @@ + + #ifndef USE_FFI + #ifdef __ARM_EABI__ ++#ifdef __ARM_PCS_VFP ++#ifdef __ARM_ARCH_7A__ ++#include "callNativeEABIHard.S" ++#else ++#include "callNativeEABIHardARM.S" ++#endif ++#else + #include "callNativeEABI.S" ++#endif + #else + #include "callNativeOABI.S" + #endif +diff --git a/src/os/linux/arm/callNativeEABI.S b/src/os/linux/arm/callNativeEABI.S +index 5effa57..3a7539e 100644 +--- a/src/os/linux/arm/callNativeEABI.S ++++ b/src/os/linux/arm/callNativeEABI.S +@@ -1,6 +1,6 @@ + /* +- * Copyright (C) 2003, 2004, 2005, 2006, 2007 +- * Robert Lougher . ++ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2011 ++ * Robert Lougher . + * + * This file is part of JamVM. + * +@@ -95,8 +95,12 @@ done: + ldmfd sp!, {r2, r3} + + /* Call the function */ ++#if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) + mov lr, pc + bx ip ++#else ++ blx ip ++#endif + + subs r4, r4, #8 /* Pop argument area */ + /* (minus 8 for r2/r3) */ +diff --git a/src/os/linux/arm/callNativeEABIHard.S b/src/os/linux/arm/callNativeEABIHard.S +new file mode 100644 +index 0000000..5d5785b +--- /dev/null ++++ b/src/os/linux/arm/callNativeEABIHard.S +@@ -0,0 +1,315 @@ ++/* ++ * Copyright (C) 2011, 2012 Robert Lougher . ++ * ++ * This file is part of JamVM. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2, ++ * or (at your option) any later version. ++ * ++ * This program 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 General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ */ ++ ++ .text ++ .syntax unified ++ .arch armv7-a ++ .thumb ++ .align 2 ++ .global callJNIMethod ++ .type callJNIMethod,function ++ ++/* ++ * Arguments passed in: ++ * ++ * r0 JNIEnv ++ * r1 class or NULL ++ * r2 sig ++ * r3 extra arg ++ * sp + 0 ostack ++ * sp + 4 function pntr ++ * sp + 8 args count ++ */ ++ ++/* Register usage : ++ * ++ * r11 function pntr ++ * lr ostack pntr ++ * ip args pntr ++ * r8 sig pntr ++ * r10 extra stack ++ * r6 fp backfill ++ * r4 fp reg ++ * r7 int reg ++ * r5 scratch ++ * r3, r2 outgoing int args ++ * r1 outgoing class or this pntr ++ * r0 outgoing JNIEnv (as passed in) ++ * ++ * s0 - s16 (d0 - d7) outgoing float args ++ */ ++ ++callJNIMethod: ++ stmfd sp!, {r4, r5, r6, r7, r8, r10, r11, lr} ++ ldr lr, [sp, #32] /* get ostack pntr */ ++ ldr r11, [sp, #36] /* get function pntr */ ++ ++ cmp r1, #0 /* is method non-static? */ ++ it eq ++ ldreq r1, [lr], #4 /* yes, load r1 with "this" */ ++ ++ mov r10, r3 ++ subs sp, sp, r3 /* allocate room for stacked */ ++ add r8, r2, #1 /* init sig pntr -- skipping '(' */ ++ ++ mov ip, sp /* init loop pntr */ ++ ++ mov r7, #2 ++ mov r4, #16 ++ mov r6, #0 ++ ++scan_sig: ++ ldrb r5, [r8], #1 ++ ++ cmp r5, #41 /* ')' */ ++ beq done ++ ++ cmp r5, #70 /* 'F' */ ++ beq float ++ ++ cmp r5, #68 /* 'D' */ ++ beq double ++ ++ cmp r5, #74 /* 'J' */ ++ beq long ++ ++skip_brackets: ++ cmp r5, #91 /* '[' */ ++ itt eq ++ ldrbeq r5, [r8], #1 ++ beq skip_brackets ++ ++ cmp r5, #76 /* 'L' */ ++ bne int ++ ++skip_ref: ++ ldrb r5, [r8], #1 ++ cmp r5, #59 /* ';' */ ++ bne skip_ref ++ ++int: ++ cbz r7, stack_int ++ ++ subs r7, r7, #1 ++ ite ne ++ ldrne r2, [lr], #4 ++ ldreq r3, [lr], #4 ++ ++ b scan_sig ++ ++float: ++ cbz r6, no_backfill ++ ++ sub r5, r6, #1 ++ mov r6, #0 ++ b load_float ++ ++no_backfill: ++ cbz r4, stack_int ++ ++ sub r4, r4, #1 ++ mov r5, r4 ++ ++load_float: ++ add lr, lr, #4 ++ tbb [pc, r5] ++ ++float_table: ++ .byte (s15-float_table)/2 ++ .byte (s14-float_table)/2 ++ .byte (s13-float_table)/2 ++ .byte (s12-float_table)/2 ++ .byte (s11-float_table)/2 ++ .byte (s10-float_table)/2 ++ .byte (s9-float_table)/2 ++ .byte (s8-float_table)/2 ++ .byte (s7-float_table)/2 ++ .byte (s6-float_table)/2 ++ .byte (s5-float_table)/2 ++ .byte (s4-float_table)/2 ++ .byte (s3-float_table)/2 ++ .byte (s2-float_table)/2 ++ .byte (s1-float_table)/2 ++ .byte (s0-float_table)/2 ++ ++stack_int: ++ ldr r5, [lr], #4 ++ str r5, [ip], #4 ++ b scan_sig ++ ++s0: ++ vldr s0, [lr, #-4] ++ b scan_sig ++s1: ++ vldr s1, [lr, #-4] ++ b scan_sig ++s2: ++ vldr s2, [lr, #-4] ++ b scan_sig ++s3: ++ vldr s3, [lr, #-4] ++ b scan_sig ++s4: ++ vldr s4, [lr, #-4] ++ b scan_sig ++s5: ++ vldr s5, [lr, #-4] ++ b scan_sig ++s6: ++ vldr s6, [lr, #-4] ++ b scan_sig ++s7: ++ vldr s7, [lr, #-4] ++ b scan_sig ++s8: ++ vldr s8, [lr, #-4] ++ b scan_sig ++s9: ++ vldr s9, [lr, #-4] ++ b scan_sig ++s10: ++ vldr s10, [lr, #-4] ++ b scan_sig ++s11: ++ vldr s11, [lr, #-4] ++ b scan_sig ++s12: ++ vldr s12, [lr, #-4] ++ b scan_sig ++s13: ++ vldr s13, [lr, #-4] ++ b scan_sig ++s14: ++ vldr s14, [lr, #-4] ++ b scan_sig ++s15: ++ vldr s15, [lr, #-4] ++ b scan_sig ++ ++long: ++ cmp r7, #2 ++ mov r7, #0 ++ bne stack_long ++ ++ ldmia lr!, {r2, r3} ++ b scan_sig ++ ++double: ++ lsrs r5, r4, #1 ++ it cs ++ movcs r6, r4 ++ ++ lsls r4, r5, #1 ++ beq stack_double ++ ++ sub r4, r4, #2 ++ add lr, lr, #8 ++ tbb [pc, r5] ++ ++double_table: ++ .byte 0 ++ .byte (d7-double_table)/2 ++ .byte (d6-double_table)/2 ++ .byte (d5-double_table)/2 ++ .byte (d4-double_table)/2 ++ .byte (d3-double_table)/2 ++ .byte (d2-double_table)/2 ++ .byte (d1-double_table)/2 ++ .byte (d0-double_table)/2 ++ .align 2 ++d0: ++ vldr d0, [lr, #-8] ++ b scan_sig ++d1: ++ vldr d1, [lr, #-8] ++ b scan_sig ++d2: ++ vldr d2, [lr, #-8] ++ b scan_sig ++d3: ++ vldr d3, [lr, #-8] ++ b scan_sig ++d4: ++ vldr d4, [lr, #-8] ++ b scan_sig ++d5: ++ vldr d5, [lr, #-8] ++ b scan_sig ++d6: ++ vldr d6, [lr, #-8] ++ b scan_sig ++d7: ++ vldr d7, [lr, #-8] ++ b scan_sig ++ ++stack_double: ++ mov r6, #0 ++ ++stack_long: ++ /* Ensure address is 8 byte aligned */ ++ add ip, ip, #7 ++ bic ip, ip, #7 ++ ++ ldr r5, [lr], #4 ++ str r5, [ip], #4 ++ ldr r5, [lr], #4 ++ str r5, [ip], #4 ++ b scan_sig ++ ++done: ++ /* Call the function */ ++ blx r11 ++ ++ add sp, sp, r10 /* Pop argument area */ ++ ++ ldr r4, [sp, #32] /* Reload ostack for */ ++ /* address of return value */ ++ ++ ldrb r5, [r8] /* Return type */ ++ ++ cmp r5, #86 /* 'V' */ ++ beq return ++ ++ cmp r5, #68 /* 'D' */ ++ beq return_double ++ ++ cmp r5, #70 /* 'F' */ ++ beq return_float ++ ++ str r0, [r4], #4 /* Low word */ ++ ++ cmp r5, #74 /* 'J' */ ++ it eq ++ streq r1, [r4], #4 /* High word */ ++ ++return: ++ mov r0, r4 /* return ostack */ ++ ldmfd sp!, {r4, r5, r6, r7, r8, r10, r11, lr} ++ bx lr ++ ++return_float: ++ vstr s0, [r4] ++ add r4, r4, #4 ++ b return ++ ++return_double: ++ vstr d0, [r4] ++ add r4, r4, #8 ++ b return +diff --git a/src/os/linux/arm/callNativeEABIHardARM.S b/src/os/linux/arm/callNativeEABIHardARM.S +new file mode 100644 +index 0000000..3a31acd +--- /dev/null ++++ b/src/os/linux/arm/callNativeEABIHardARM.S +@@ -0,0 +1,266 @@ ++/* ++ * Copyright (C) 2011, 2012 Robert Lougher . ++ * ++ * This file is part of JamVM. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2, ++ * or (at your option) any later version. ++ * ++ * This program 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 General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ */ ++ ++ .text ++ .align 2 ++ .global callJNIMethod ++ .type callJNIMethod,function ++ ++/* ++ * Arguments passed in: ++ * ++ * r0 JNIEnv ++ * r1 class or NULL ++ * r2 sig ++ * r3 extra arg ++ * sp + 0 ostack ++ * sp + 4 function pntr ++ * sp + 8 args count ++ */ ++ ++/* Register usage : ++ * ++ * lr ostack pntr ++ * ip scratch ++ * r11 function pntr ++ * r10 fp backfill ++ * r8 fp reg ++ * r7 int reg ++ * r6 args pntr ++ * r5 sig pntr ++ * r4 extra stack ++ * r3, r2 outgoing int args ++ * r1 outgoing class or this pntr ++ * r0 outgoing JNIEnv (as passed in) ++ * ++ * s0 - s16 (d0 - d7) outgoing float args ++ */ ++ ++callJNIMethod: ++ stmfd sp!, {r4, r5, r6, r7, r8, r10, r11, lr} ++ ldr lr, [sp, #32] /* get ostack pntr */ ++ ldr r11, [sp, #36] /* get function pntr */ ++ ++ cmp r1, #0 /* is method non-static? */ ++ ldreq r1, [lr], #4 /* yes, load r1 with "this" */ ++ ++ mov r4, r3 ++ sub sp, sp, r4 /* allocate room for stacked */ ++ add r5, r2, #1 /* init sig pntr -- skipping '(' */ ++ ++ mov r6, sp /* init loop pntr */ ++ ++ mov r7, #2 ++ mov r8, #16 ++ mov r10, #0 ++ ++scan_sig: ++ ldrb ip, [r5], #1 ++ ++ cmp ip, #41 /* ')' */ ++ beq done ++ ++ cmp ip, #70 /* 'F' */ ++ beq float ++ ++ cmp ip, #68 /* 'D' */ ++ beq double ++ ++ cmp ip, #74 /* 'J' */ ++ beq long ++ ++skip_brackets: ++ cmp ip, #91 /* '[' */ ++ ldreqb ip, [r5], #1 ++ beq skip_brackets ++ ++ cmp ip, #76 /* 'L' */ ++ bne int ++ ++skip_ref: ++ ldrb ip, [r5], #1 ++ cmp ip, #59 /* ';' */ ++ bne skip_ref ++ ++int: ++ cmp r7, #0 ++ beq stack_int ++ ++ subs r7, r7, #1 ++ ++ ldrne r2, [lr], #4 ++ ldreq r3, [lr], #4 ++ ++ b scan_sig ++ ++stack_int: ++ ldr ip, [lr], #4 ++ str ip, [r6], #4 ++ b scan_sig ++ ++float: ++ cmp r10, #0 ++ beq no_backfill ++ ++ sub ip, r10, #1 ++ mov r10, #0 ++ b load_float ++ ++no_backfill: ++ cmp r8, #0 ++ beq stack_int ++ ++ sub r8, r8, #1 ++ mov ip, r8 ++ ++load_float: ++ add lr, lr, #4 ++ add pc, pc, ip, lsl #3 ++ nop ++ ++ flds s15, [lr, #-4] ++ b scan_sig ++ flds s14, [lr, #-4] ++ b scan_sig ++ flds s13, [lr, #-4] ++ b scan_sig ++ flds s12, [lr, #-4] ++ b scan_sig ++ flds s11, [lr, #-4] ++ b scan_sig ++ flds s10, [lr, #-4] ++ b scan_sig ++ flds s9, [lr, #-4] ++ b scan_sig ++ flds s8, [lr, #-4] ++ b scan_sig ++ flds s7, [lr, #-4] ++ b scan_sig ++ flds s6, [lr, #-4] ++ b scan_sig ++ flds s5, [lr, #-4] ++ b scan_sig ++ flds s4, [lr, #-4] ++ b scan_sig ++ flds s3, [lr, #-4] ++ b scan_sig ++ flds s2, [lr, #-4] ++ b scan_sig ++ flds s1, [lr, #-4] ++ b scan_sig ++ flds s0, [lr, #-4] ++ b scan_sig ++ ++long: ++ cmp r7, #2 ++ mov r7, #0 ++ bne stack_long ++ ++ ldr r2, [lr], #4 ++ ldr r3, [lr], #4 ++ b scan_sig ++ ++double: ++ lsrs ip, r8, #1 ++ movcs r10, r8 ++ ++ lsls r8, ip, #1 ++ beq stack_double ++ ++ sub r8, r8, #2 ++ add lr, lr, #8 ++ add pc, pc, ip, lsl #3 ++ nop ++ nop ++ nop ++ ++ fldd d7, [lr, #-8] ++ b scan_sig ++ fldd d6, [lr, #-8] ++ b scan_sig ++ fldd d5, [lr, #-8] ++ b scan_sig ++ fldd d4, [lr, #-8] ++ b scan_sig ++ fldd d3, [lr, #-8] ++ b scan_sig ++ fldd d2, [lr, #-8] ++ b scan_sig ++ fldd d1, [lr, #-8] ++ b scan_sig ++ fldd d0, [lr, #-8] ++ b scan_sig ++ ++stack_double: ++ mov r10, #0 ++ ++stack_long: ++ /* Ensure address is 8 byte aligned */ ++ add r6, r6, #7 ++ bic r6, r6, #7 ++ ++ ldr ip, [lr], #4 ++ str ip, [r6], #4 ++ ldr ip, [lr], #4 ++ str ip, [r6], #4 ++ b scan_sig ++ ++done: ++ /* Call the function */ ++#if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) ++ mov lr, pc ++ bx r11 ++#else ++ blx r11 ++#endif ++ ++ add sp, sp, r4 /* Pop argument area */ ++ ldr r4, [sp, #32] /* Reload ostack for */ ++ /* address of return value */ ++ ldrb ip, [r5] /* Return type */ ++ ++ cmp ip, #86 /* 'V' */ ++ beq return ++ ++ cmp ip, #68 /* 'D' */ ++ beq return_double ++ ++ cmp ip, #70 /* 'F' */ ++ beq return_float ++ ++ str r0, [r4], #4 /* Low word */ ++ ++ cmp ip, #74 /* 'J' */ ++ streq r1, [r4], #4 /* High word */ ++ ++return: ++ mov r0, r4 /* return ostack */ ++ ldmfd sp!, {r4, r5, r6, r7, r8, r10, r11, lr} ++ bx lr ++ ++return_float: ++ add r4, r4, #4 ++ fsts s0, [r4, #-4] ++ b return ++ ++return_double: ++ add r4, r4, #8 ++ fstd d0, [r4, #-8] ++ b return +diff --git a/src/os/linux/arm/dll_md.c b/src/os/linux/arm/dll_md.c +index f5df90e..39bdf7c 100644 +--- a/src/os/linux/arm/dll_md.c ++++ b/src/os/linux/arm/dll_md.c +@@ -1,6 +1,6 @@ + /* +- * Copyright (C) 2003, 2004, 2005, 2006, 2007 +- * Robert Lougher . ++ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2011 ++ * Robert Lougher . + * + * This file is part of JamVM. + * +@@ -31,6 +31,61 @@ + * out stack requirements and then to push arguments. To + * save the first scan at call time, the signature is pre- + * scanned and stack requirement stored in the extra argument. */ ++ ++#ifdef __ARM_PCS_VFP ++int nativeExtraArg(MethodBlock *mb) { ++ char *sig = mb->type; ++ int fp_backfill = 0; ++ int stack_args = 0; ++ int int_args = 2; ++ int fp_args = 16; ++ ++ while(*++sig != ')') ++ switch(*sig) { ++ case 'J': ++ if(int_args < 2) ++ stack_args = (stack_args + 15) & ~7; ++ int_args = 0; ++ break; ++ ++ case 'D': ++ fp_backfill |= fp_args & 1; ++ fp_args &= ~1; ++ ++ if(fp_args == 0) { ++ stack_args = (stack_args + 15) & ~7; ++ fp_backfill = 0; ++ } else ++ fp_args -= 2; ++ break; ++ ++ case 'F': ++ if(fp_backfill) ++ fp_backfill = 0; ++ else { ++ if(fp_args == 0) ++ stack_args += 4; ++ else ++ fp_args--; ++ } ++ break; ++ ++ default: ++ if(int_args == 0) ++ stack_args += 4; ++ else ++ int_args--; ++ ++ if(*sig == '[') ++ while(*++sig == '['); ++ if(*sig == 'L') ++ while(*++sig != ';'); ++ break; ++ } ++ ++ return (stack_args + 7) & ~7; ++} ++#else + int nativeExtraArg(MethodBlock *mb) { + char *sig = mb->type; + int args = 0; +@@ -57,7 +112,7 @@ int nativeExtraArg(MethodBlock *mb) { + native method, so minimum stack requirement is 8 bytes. */ + return args < 8 ? 8 : args; + } +- ++#endif + #else + + /* Under OABI, arguments can be copied onto the stack "as is" +-- +2.17.1 + diff --git a/gnu/packages/patches/jamvm-arm.patch b/gnu/packages/patches/jamvm-arm.patch deleted file mode 100644 index 9e998e18db..0000000000 --- a/gnu/packages/patches/jamvm-arm.patch +++ /dev/null @@ -1,1313 +0,0 @@ -From 67faeb7d58e0d25a50d36788ed49ed383b92e090 Mon Sep 17 00:00:00 2001 -From: Efraim Flashner -Date: Mon, 26 Mar 2018 11:08:17 +0300 -Subject: [PATCH] add ARMv7 support - ---- - src/arch/arm.h | 75 +++++- - src/os/linux/arm/Makefile.am | 9 +- - src/os/linux/arm/Makefile.in | 166 ++++++++---- - src/os/linux/arm/callNative.S | 12 +- - src/os/linux/arm/callNativeEABI.S | 8 +- - src/os/linux/arm/callNativeEABIHard.S | 315 +++++++++++++++++++++++ - src/os/linux/arm/callNativeEABIHardARM.S | 266 +++++++++++++++++++ - src/os/linux/arm/dll_md.c | 61 ++++- - 8 files changed, 843 insertions(+), 69 deletions(-) - create mode 100644 src/os/linux/arm/callNativeEABIHard.S - create mode 100644 src/os/linux/arm/callNativeEABIHardARM.S - -diff --git a/src/arch/arm.h b/src/arch/arm.h -index ccf68c4..d2c0318 100644 ---- a/src/arch/arm.h -+++ b/src/arch/arm.h -@@ -1,6 +1,6 @@ - /* -- * Copyright (C) 2003, 2004, 2005, 2006, 2007 -- * Robert Lougher . -+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, -+ * 2014 Robert Lougher . - * - * This file is part of JamVM. - * -@@ -21,10 +21,16 @@ - - #define OS_ARCH "arm" - --/* Override default min and max heap sizes. ARM machines are -- usually embedded, and the standard defaults are too large. */ --#define DEFAULT_MAX_HEAP 16*MB -+/* Override minimum min heap size. The initial heap size is a ratio -+ of the physical memory, but it must be at least the minimum min -+ size. The normal setting is too large for ARM machines as they -+ are usually embedded. */ -+#define MIN_MIN_HEAP 1*MB -+ -+/* Likewise, override the default min/max heap sizes used when the -+ size of physical memory is not available */ - #define DEFAULT_MIN_HEAP 1*MB -+#define DEFAULT_MAX_HEAP 64*MB - - #ifdef DIRECT - #define HANDLER_TABLE_T static const void -@@ -51,6 +57,36 @@ - /* Needed for i386 -- empty here */ - #define FPU_HACK - -+#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7A__) -+#define COMPARE_AND_SWAP_32(addr, old_val, new_val) \ -+({ \ -+ int result, read_val; \ -+ __asm__ __volatile__ (" \ -+ 1: mov %0, #0; \ -+ ldrex %1, [%2]; \ -+ cmp %3, %1; \ -+ bne 2f; \ -+ strex %0, %4, [%2]; \ -+ cmp %0, #1; \ -+ beq 1b; \ -+ mov %0, #1; \ -+ 2:" \ -+ : "=&r" (result), "=&r" (read_val) \ -+ : "r" (addr), "r" (old_val), "r" (new_val) \ -+ : "cc", "memory"); \ -+ result; \ -+}) -+ -+#define COMPARE_AND_SWAP(addr, old_val, new_val) \ -+ COMPARE_AND_SWAP_32(addr, old_val, new_val) -+ -+#define LOCKWORD_READ(addr) *addr -+#define LOCKWORD_WRITE(addr, value) *addr = value -+#define LOCKWORD_COMPARE_AND_SWAP(addr, old_val, new_val) \ -+ COMPARE_AND_SWAP(addr, old_val, new_val) -+ -+#else -+ - #define LOCKWORD_COMPARE_AND_SWAP(addr, old_val, new_val) \ - ({ \ - int result, read_val; \ -@@ -94,7 +130,7 @@ do { \ - : "r" (addr), "r" (new_val) \ - : "cc", "memory"); \ - } while(0) -- -+#endif - - #ifdef __ARM_EABI__ - #define FLUSH_CACHE(addr, length) \ -@@ -124,8 +160,33 @@ do { \ - } - #endif - -+#define GEN_REL_JMP(target_addr, patch_addr, patch_size) \ -+({ \ -+ int patched = FALSE; \ -+ \ -+ if(patch_size >= 4) { \ -+ /* Guard against the pointer difference being \ -+ larger than the signed range */ \ -+ long long offset = (uintptr_t)(target_addr) - \ -+ (uintptr_t)(patch_addr) - 8; \ -+ \ -+ if(offset >= -1<<25 && offset < 1<<25) { \ -+ *(int*)(patch_addr) = offset>>2 & 0x00ffffff \ -+ | 0xea000000; \ -+ patched = TRUE; \ -+ } \ -+ } \ -+ patched; \ -+}) -+ -+#ifdef __ARM_ARCH_7A__ -+#define MBARRIER() __asm__ __volatile__ ("dmb" ::: "memory") -+#define UNLOCK_MBARRIER() __asm__ __volatile__ ("dmb" ::: "memory") -+#define JMM_LOCK_MBARRIER() __asm__ __volatile__ ("dmb" ::: "memory") -+#define JMM_UNLOCK_MBARRIER() __asm__ __volatile__ ("dmb" ::: "memory") -+#else - #define MBARRIER() __asm__ __volatile__ ("" ::: "memory") - #define UNLOCK_MBARRIER() __asm__ __volatile__ ("" ::: "memory") - #define JMM_LOCK_MBARRIER() __asm__ __volatile__ ("" ::: "memory") - #define JMM_UNLOCK_MBARRIER() __asm__ __volatile__ ("" ::: "memory") -- -+#endif -diff --git a/src/os/linux/arm/Makefile.am b/src/os/linux/arm/Makefile.am -index d18ea5a..74e7786 100644 ---- a/src/os/linux/arm/Makefile.am -+++ b/src/os/linux/arm/Makefile.am -@@ -1,6 +1,6 @@ - ## --## Copyright (C) 2003, 2004, 2005, 2006, 2007 --## Robert Lougher . -+## Copyright (C) 2003, 2004, 2005, 2006, 2007, 2010, 2011, 2012 -+## Robert Lougher . - ## - ## This file is part of JamVM. - ## -@@ -19,10 +19,11 @@ - ## Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - ## - --EXTRA_DIST = callNativeOABI.S callNativeEABI.S -+EXTRA_DIST = callNativeOABI.S callNativeEABI.S callNativeEABIHard.S \ -+ callNativeEABIHardARM.S - - noinst_LTLIBRARIES = libnative.la - libnative_la_SOURCES = init.c dll_md.c callNative.S - --AM_CPPFLAGS = -I$(top_builddir)/src -+AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src - AM_CCASFLAGS = -I$(top_builddir)/src -diff --git a/src/os/linux/arm/Makefile.in b/src/os/linux/arm/Makefile.in -index 63b21ad..6d44ea9 100644 ---- a/src/os/linux/arm/Makefile.in -+++ b/src/os/linux/arm/Makefile.in -@@ -1,8 +1,9 @@ --# Makefile.in generated by automake 1.10 from Makefile.am. -+# Makefile.in generated by automake 1.11.6 from Makefile.am. - # @configure_input@ - - # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, --# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -+# Foundation, Inc. - # This Makefile.in is free software; the Free Software Foundation - # gives unlimited permission to copy and/or distribute it, - # with or without modifications, as long as this notice is preserved. -@@ -15,9 +16,27 @@ - @SET_MAKE@ - - VPATH = @srcdir@ -+am__make_dryrun = \ -+ { \ -+ am__dry=no; \ -+ case $$MAKEFLAGS in \ -+ *\\[\ \ ]*) \ -+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ -+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ -+ *) \ -+ for am__flg in $$MAKEFLAGS; do \ -+ case $$am__flg in \ -+ *=*|--*) ;; \ -+ *n*) am__dry=yes; break;; \ -+ esac; \ -+ done;; \ -+ esac; \ -+ test $$am__dry = yes; \ -+ } - pkgdatadir = $(datadir)/@PACKAGE@ --pkglibdir = $(libdir)/@PACKAGE@ - pkgincludedir = $(includedir)/@PACKAGE@ -+pkglibdir = $(libdir)/@PACKAGE@ -+pkglibexecdir = $(libexecdir)/@PACKAGE@ - am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd - install_sh_DATA = $(install_sh) -c -m 644 - install_sh_PROGRAM = $(install_sh) -c -@@ -42,13 +61,15 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs - CONFIG_HEADER = $(top_builddir)/src/config.h - CONFIG_CLEAN_FILES = -+CONFIG_CLEAN_VPATH_FILES = - LTLIBRARIES = $(noinst_LTLIBRARIES) - libnative_la_LIBADD = - am_libnative_la_OBJECTS = init.lo dll_md.lo callNative.lo - libnative_la_OBJECTS = $(am_libnative_la_OBJECTS) --DEFAULT_INCLUDES = -I. -I$(top_builddir)/src@am__isrc@ -+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src - depcomp = $(SHELL) $(top_srcdir)/depcomp - am__depfiles_maybe = depfiles -+am__mv = mv -f - CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS) - LTCPPASCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ -@@ -65,6 +86,11 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - $(LDFLAGS) -o $@ - SOURCES = $(libnative_la_SOURCES) - DIST_SOURCES = $(libnative_la_SOURCES) -+am__can_run_installinfo = \ -+ case $$AM_UPDATE_INFO_DIR in \ -+ n|no|NO) false;; \ -+ *) (install-info --version) >/dev/null 2>&1;; \ -+ esac - ETAGS = etags - CTAGS = ctags - DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -@@ -84,21 +110,18 @@ CCDEPMODE = @CCDEPMODE@ - CFLAGS = @CFLAGS@ - CPP = @CPP@ - CPPFLAGS = @CPPFLAGS@ --CXX = @CXX@ --CXXCPP = @CXXCPP@ --CXXDEPMODE = @CXXDEPMODE@ --CXXFLAGS = @CXXFLAGS@ - CYGPATH_W = @CYGPATH_W@ - DEFS = @DEFS@ - DEPDIR = @DEPDIR@ --ECHO = @ECHO@ -+DLLTOOL = @DLLTOOL@ -+DSYMUTIL = @DSYMUTIL@ -+DUMPBIN = @DUMPBIN@ - ECHO_C = @ECHO_C@ - ECHO_N = @ECHO_N@ - ECHO_T = @ECHO_T@ - EGREP = @EGREP@ - EXEEXT = @EXEEXT@ --F77 = @F77@ --FFLAGS = @FFLAGS@ -+FGREP = @FGREP@ - GREP = @GREP@ - INSTALL = @INSTALL@ - INSTALL_DATA = @INSTALL_DATA@ -@@ -106,21 +129,30 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ - INSTALL_SCRIPT = @INSTALL_SCRIPT@ - INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ - JAVAC = @JAVAC@ -+LD = @LD@ - LDFLAGS = @LDFLAGS@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LIBTOOL = @LIBTOOL@ -+LIPO = @LIPO@ - LN_S = @LN_S@ - LTLIBOBJS = @LTLIBOBJS@ - MAINT = @MAINT@ - MAKEINFO = @MAKEINFO@ -+MANIFEST_TOOL = @MANIFEST_TOOL@ - MKDIR_P = @MKDIR_P@ -+NM = @NM@ -+NMEDIT = @NMEDIT@ -+OBJDUMP = @OBJDUMP@ - OBJEXT = @OBJEXT@ -+OTOOL = @OTOOL@ -+OTOOL64 = @OTOOL64@ - PACKAGE = @PACKAGE@ - PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ - PACKAGE_NAME = @PACKAGE_NAME@ - PACKAGE_STRING = @PACKAGE_STRING@ - PACKAGE_TARNAME = @PACKAGE_TARNAME@ -+PACKAGE_URL = @PACKAGE_URL@ - PACKAGE_VERSION = @PACKAGE_VERSION@ - PATH_SEPARATOR = @PATH_SEPARATOR@ - RANLIB = @RANLIB@ -@@ -133,9 +165,9 @@ abs_builddir = @abs_builddir@ - abs_srcdir = @abs_srcdir@ - abs_top_builddir = @abs_top_builddir@ - abs_top_srcdir = @abs_top_srcdir@ -+ac_ct_AR = @ac_ct_AR@ - ac_ct_CC = @ac_ct_CC@ --ac_ct_CXX = @ac_ct_CXX@ --ac_ct_F77 = @ac_ct_F77@ -+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ - am__include = @am__include@ - am__leading_dot = @am__leading_dot@ - am__quote = @am__quote@ -@@ -149,6 +181,7 @@ build_cpu = @build_cpu@ - build_os = @build_os@ - build_vendor = @build_vendor@ - builddir = @builddir@ -+classlib = @classlib@ - datadir = @datadir@ - datarootdir = @datarootdir@ - docdir = @docdir@ -@@ -181,15 +214,18 @@ sharedstatedir = @sharedstatedir@ - srcdir = @srcdir@ - sysconfdir = @sysconfdir@ - target_alias = @target_alias@ -+top_build_prefix = @top_build_prefix@ - top_builddir = @top_builddir@ - top_srcdir = @top_srcdir@ - use_zip_no = @use_zip_no@ - use_zip_yes = @use_zip_yes@ - with_classpath_install_dir = @with_classpath_install_dir@ --EXTRA_DIST = callNativeOABI.S callNativeEABI.S -+EXTRA_DIST = callNativeOABI.S callNativeEABI.S callNativeEABIHard.S \ -+ callNativeEABIHardARM.S -+ - noinst_LTLIBRARIES = libnative.la - libnative_la_SOURCES = init.c dll_md.c callNative.S --AM_CPPFLAGS = -I$(top_builddir)/src -+AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src - AM_CCASFLAGS = -I$(top_builddir)/src - all: all-am - -@@ -199,14 +235,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ -- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ -- && exit 0; \ -+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ -+ && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ -- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/os/linux/arm/Makefile'; \ -- cd $(top_srcdir) && \ -- $(AUTOMAKE) --gnu src/os/linux/arm/Makefile -+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/os/linux/arm/Makefile'; \ -+ $(am__cd) $(top_srcdir) && \ -+ $(AUTOMAKE) --gnu src/os/linux/arm/Makefile - .PRECIOUS: Makefile - Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ -@@ -224,6 +260,7 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -+$(am__aclocal_m4_deps): - - clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) -@@ -233,7 +270,7 @@ clean-noinstLTLIBRARIES: - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done --libnative.la: $(libnative_la_OBJECTS) $(libnative_la_DEPENDENCIES) -+libnative.la: $(libnative_la_OBJECTS) $(libnative_la_DEPENDENCIES) $(EXTRA_libnative_la_DEPENDENCIES) - $(LINK) $(libnative_la_OBJECTS) $(libnative_la_LIBADD) $(LIBS) - - mostlyclean-compile: -@@ -248,42 +285,42 @@ distclean-compile: - - .S.o: - @am__fastdepCCAS_TRUE@ $(CPPASCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< --@am__fastdepCCAS_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -+@am__fastdepCCAS_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po - @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ - @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - @am__fastdepCCAS_FALSE@ $(CPPASCOMPILE) -c -o $@ $< - - .S.obj: - @am__fastdepCCAS_TRUE@ $(CPPASCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` --@am__fastdepCCAS_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -+@am__fastdepCCAS_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po - @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ - @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - @am__fastdepCCAS_FALSE@ $(CPPASCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - - .S.lo: - @am__fastdepCCAS_TRUE@ $(LTCPPASCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< --@am__fastdepCCAS_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -+@am__fastdepCCAS_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo - @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ - @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - @am__fastdepCCAS_FALSE@ $(LTCPPASCOMPILE) -c -o $@ $< - - .c.o: - @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< --@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po - @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ - @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - @am__fastdepCC_FALSE@ $(COMPILE) -c $< - - .c.obj: - @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` --@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po - @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ - @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - - .c.lo: - @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< --@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo - @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ - @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< -@@ -299,45 +336,49 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ -- $(AWK) ' { files[$$0] = 1; } \ -- END { for (i in files) print i; }'`; \ -+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ -+ END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique - tags: TAGS - - TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) -- tags=; \ -+ set x; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ -- $(AWK) ' { files[$$0] = 1; } \ -- END { for (i in files) print i; }'`; \ -- if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ -+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ -+ END { if (nonempty) { for (i in files) print i; }; }'`; \ -+ shift; \ -+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ -- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ -- $$tags $$unique; \ -+ if test $$# -gt 0; then \ -+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ -+ "$$@" $$unique; \ -+ else \ -+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ -+ $$unique; \ -+ fi; \ - fi - ctags: CTAGS - CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) -- tags=; \ -- here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ -- $(AWK) ' { files[$$0] = 1; } \ -- END { for (i in files) print i; }'`; \ -- test -z "$(CTAGS_ARGS)$$tags$$unique" \ -+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ -+ END { if (nonempty) { for (i in files) print i; }; }'`; \ -+ test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ -- $$tags $$unique -+ $$unique - - GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ -- && cd $(top_srcdir) \ -- && gtags -i $(GTAGS_ARGS) $$here -+ && $(am__cd) $(top_srcdir) \ -+ && gtags -i $(GTAGS_ARGS) "$$here" - - distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -@@ -358,13 +399,17 @@ distdir: $(DISTFILES) - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ -+ if test -d "$(distdir)/$$file"; then \ -+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ -+ fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ -- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ -+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ -+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ -- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ -+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ -- test -f $(distdir)/$$file \ -- || cp -p $$d/$$file $(distdir)/$$file \ -+ test -f "$(distdir)/$$file" \ -+ || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -@@ -382,16 +427,22 @@ install-am: all-am - - installcheck: installcheck-am - install-strip: -- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ -- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ -- `test -z '$(STRIP)' || \ -- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -+ if test -z '$(STRIP)'; then \ -+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ -+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ -+ install; \ -+ else \ -+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ -+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ -+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ -+ fi - mostlyclean-generic: - - clean-generic: - - distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - - maintainer-clean-generic: - @echo "This command is intended for maintainers to use" -@@ -413,6 +464,8 @@ dvi-am: - - html: html-am - -+html-am: -+ - info: info-am - - info-am: -@@ -421,18 +474,28 @@ install-data-am: - - install-dvi: install-dvi-am - -+install-dvi-am: -+ - install-exec-am: - - install-html: install-html-am - -+install-html-am: -+ - install-info: install-info-am - -+install-info-am: -+ - install-man: - - install-pdf: install-pdf-am - -+install-pdf-am: -+ - install-ps: install-ps-am - -+install-ps-am: -+ - installcheck-am: - - maintainer-clean: maintainer-clean-am -@@ -470,6 +533,7 @@ uninstall-am: - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am - -+ - # Tell versions [3.59,3.63) of GNU make to not export all variables. - # Otherwise a system limit (for SysV at least) may be exceeded. - .NOEXPORT: -diff --git a/src/os/linux/arm/callNative.S b/src/os/linux/arm/callNative.S -index 39ab6d3..245afd1 100644 ---- a/src/os/linux/arm/callNative.S -+++ b/src/os/linux/arm/callNative.S -@@ -1,6 +1,6 @@ - /* -- * Copyright (C) 2003, 2004, 2005, 2006, 2007 -- * Robert Lougher . -+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2011, 2012 -+ * Robert Lougher . - * - * This file is part of JamVM. - * -@@ -23,7 +23,15 @@ - - #ifndef USE_FFI - #ifdef __ARM_EABI__ -+#ifdef __ARM_PCS_VFP -+#ifdef __ARM_ARCH_7A__ -+#include "callNativeEABIHard.S" -+#else -+#include "callNativeEABIHardARM.S" -+#endif -+#else - #include "callNativeEABI.S" -+#endif - #else - #include "callNativeOABI.S" - #endif -diff --git a/src/os/linux/arm/callNativeEABI.S b/src/os/linux/arm/callNativeEABI.S -index 5effa57..3a7539e 100644 ---- a/src/os/linux/arm/callNativeEABI.S -+++ b/src/os/linux/arm/callNativeEABI.S -@@ -1,6 +1,6 @@ - /* -- * Copyright (C) 2003, 2004, 2005, 2006, 2007 -- * Robert Lougher . -+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2011 -+ * Robert Lougher . - * - * This file is part of JamVM. - * -@@ -95,8 +95,12 @@ done: - ldmfd sp!, {r2, r3} - - /* Call the function */ -+#if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) - mov lr, pc - bx ip -+#else -+ blx ip -+#endif - - subs r4, r4, #8 /* Pop argument area */ - /* (minus 8 for r2/r3) */ -diff --git a/src/os/linux/arm/callNativeEABIHard.S b/src/os/linux/arm/callNativeEABIHard.S -new file mode 100644 -index 0000000..5d5785b ---- /dev/null -+++ b/src/os/linux/arm/callNativeEABIHard.S -@@ -0,0 +1,315 @@ -+/* -+ * Copyright (C) 2011, 2012 Robert Lougher . -+ * -+ * This file is part of JamVM. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * as published by the Free Software Foundation; either version 2, -+ * or (at your option) any later version. -+ * -+ * This program 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 General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -+ */ -+ -+ .text -+ .syntax unified -+ .arch armv7-a -+ .thumb -+ .align 2 -+ .global callJNIMethod -+ .type callJNIMethod,function -+ -+/* -+ * Arguments passed in: -+ * -+ * r0 JNIEnv -+ * r1 class or NULL -+ * r2 sig -+ * r3 extra arg -+ * sp + 0 ostack -+ * sp + 4 function pntr -+ * sp + 8 args count -+ */ -+ -+/* Register usage : -+ * -+ * r11 function pntr -+ * lr ostack pntr -+ * ip args pntr -+ * r8 sig pntr -+ * r10 extra stack -+ * r6 fp backfill -+ * r4 fp reg -+ * r7 int reg -+ * r5 scratch -+ * r3, r2 outgoing int args -+ * r1 outgoing class or this pntr -+ * r0 outgoing JNIEnv (as passed in) -+ * -+ * s0 - s16 (d0 - d7) outgoing float args -+ */ -+ -+callJNIMethod: -+ stmfd sp!, {r4, r5, r6, r7, r8, r10, r11, lr} -+ ldr lr, [sp, #32] /* get ostack pntr */ -+ ldr r11, [sp, #36] /* get function pntr */ -+ -+ cmp r1, #0 /* is method non-static? */ -+ it eq -+ ldreq r1, [lr], #4 /* yes, load r1 with "this" */ -+ -+ mov r10, r3 -+ subs sp, sp, r3 /* allocate room for stacked */ -+ add r8, r2, #1 /* init sig pntr -- skipping '(' */ -+ -+ mov ip, sp /* init loop pntr */ -+ -+ mov r7, #2 -+ mov r4, #16 -+ mov r6, #0 -+ -+scan_sig: -+ ldrb r5, [r8], #1 -+ -+ cmp r5, #41 /* ')' */ -+ beq done -+ -+ cmp r5, #70 /* 'F' */ -+ beq float -+ -+ cmp r5, #68 /* 'D' */ -+ beq double -+ -+ cmp r5, #74 /* 'J' */ -+ beq long -+ -+skip_brackets: -+ cmp r5, #91 /* '[' */ -+ itt eq -+ ldrbeq r5, [r8], #1 -+ beq skip_brackets -+ -+ cmp r5, #76 /* 'L' */ -+ bne int -+ -+skip_ref: -+ ldrb r5, [r8], #1 -+ cmp r5, #59 /* ';' */ -+ bne skip_ref -+ -+int: -+ cbz r7, stack_int -+ -+ subs r7, r7, #1 -+ ite ne -+ ldrne r2, [lr], #4 -+ ldreq r3, [lr], #4 -+ -+ b scan_sig -+ -+float: -+ cbz r6, no_backfill -+ -+ sub r5, r6, #1 -+ mov r6, #0 -+ b load_float -+ -+no_backfill: -+ cbz r4, stack_int -+ -+ sub r4, r4, #1 -+ mov r5, r4 -+ -+load_float: -+ add lr, lr, #4 -+ tbb [pc, r5] -+ -+float_table: -+ .byte (s15-float_table)/2 -+ .byte (s14-float_table)/2 -+ .byte (s13-float_table)/2 -+ .byte (s12-float_table)/2 -+ .byte (s11-float_table)/2 -+ .byte (s10-float_table)/2 -+ .byte (s9-float_table)/2 -+ .byte (s8-float_table)/2 -+ .byte (s7-float_table)/2 -+ .byte (s6-float_table)/2 -+ .byte (s5-float_table)/2 -+ .byte (s4-float_table)/2 -+ .byte (s3-float_table)/2 -+ .byte (s2-float_table)/2 -+ .byte (s1-float_table)/2 -+ .byte (s0-float_table)/2 -+ -+stack_int: -+ ldr r5, [lr], #4 -+ str r5, [ip], #4 -+ b scan_sig -+ -+s0: -+ vldr s0, [lr, #-4] -+ b scan_sig -+s1: -+ vldr s1, [lr, #-4] -+ b scan_sig -+s2: -+ vldr s2, [lr, #-4] -+ b scan_sig -+s3: -+ vldr s3, [lr, #-4] -+ b scan_sig -+s4: -+ vldr s4, [lr, #-4] -+ b scan_sig -+s5: -+ vldr s5, [lr, #-4] -+ b scan_sig -+s6: -+ vldr s6, [lr, #-4] -+ b scan_sig -+s7: -+ vldr s7, [lr, #-4] -+ b scan_sig -+s8: -+ vldr s8, [lr, #-4] -+ b scan_sig -+s9: -+ vldr s9, [lr, #-4] -+ b scan_sig -+s10: -+ vldr s10, [lr, #-4] -+ b scan_sig -+s11: -+ vldr s11, [lr, #-4] -+ b scan_sig -+s12: -+ vldr s12, [lr, #-4] -+ b scan_sig -+s13: -+ vldr s13, [lr, #-4] -+ b scan_sig -+s14: -+ vldr s14, [lr, #-4] -+ b scan_sig -+s15: -+ vldr s15, [lr, #-4] -+ b scan_sig -+ -+long: -+ cmp r7, #2 -+ mov r7, #0 -+ bne stack_long -+ -+ ldmia lr!, {r2, r3} -+ b scan_sig -+ -+double: -+ lsrs r5, r4, #1 -+ it cs -+ movcs r6, r4 -+ -+ lsls r4, r5, #1 -+ beq stack_double -+ -+ sub r4, r4, #2 -+ add lr, lr, #8 -+ tbb [pc, r5] -+ -+double_table: -+ .byte 0 -+ .byte (d7-double_table)/2 -+ .byte (d6-double_table)/2 -+ .byte (d5-double_table)/2 -+ .byte (d4-double_table)/2 -+ .byte (d3-double_table)/2 -+ .byte (d2-double_table)/2 -+ .byte (d1-double_table)/2 -+ .byte (d0-double_table)/2 -+ .align 2 -+d0: -+ vldr d0, [lr, #-8] -+ b scan_sig -+d1: -+ vldr d1, [lr, #-8] -+ b scan_sig -+d2: -+ vldr d2, [lr, #-8] -+ b scan_sig -+d3: -+ vldr d3, [lr, #-8] -+ b scan_sig -+d4: -+ vldr d4, [lr, #-8] -+ b scan_sig -+d5: -+ vldr d5, [lr, #-8] -+ b scan_sig -+d6: -+ vldr d6, [lr, #-8] -+ b scan_sig -+d7: -+ vldr d7, [lr, #-8] -+ b scan_sig -+ -+stack_double: -+ mov r6, #0 -+ -+stack_long: -+ /* Ensure address is 8 byte aligned */ -+ add ip, ip, #7 -+ bic ip, ip, #7 -+ -+ ldr r5, [lr], #4 -+ str r5, [ip], #4 -+ ldr r5, [lr], #4 -+ str r5, [ip], #4 -+ b scan_sig -+ -+done: -+ /* Call the function */ -+ blx r11 -+ -+ add sp, sp, r10 /* Pop argument area */ -+ -+ ldr r4, [sp, #32] /* Reload ostack for */ -+ /* address of return value */ -+ -+ ldrb r5, [r8] /* Return type */ -+ -+ cmp r5, #86 /* 'V' */ -+ beq return -+ -+ cmp r5, #68 /* 'D' */ -+ beq return_double -+ -+ cmp r5, #70 /* 'F' */ -+ beq return_float -+ -+ str r0, [r4], #4 /* Low word */ -+ -+ cmp r5, #74 /* 'J' */ -+ it eq -+ streq r1, [r4], #4 /* High word */ -+ -+return: -+ mov r0, r4 /* return ostack */ -+ ldmfd sp!, {r4, r5, r6, r7, r8, r10, r11, lr} -+ bx lr -+ -+return_float: -+ vstr s0, [r4] -+ add r4, r4, #4 -+ b return -+ -+return_double: -+ vstr d0, [r4] -+ add r4, r4, #8 -+ b return -diff --git a/src/os/linux/arm/callNativeEABIHardARM.S b/src/os/linux/arm/callNativeEABIHardARM.S -new file mode 100644 -index 0000000..3a31acd ---- /dev/null -+++ b/src/os/linux/arm/callNativeEABIHardARM.S -@@ -0,0 +1,266 @@ -+/* -+ * Copyright (C) 2011, 2012 Robert Lougher . -+ * -+ * This file is part of JamVM. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * as published by the Free Software Foundation; either version 2, -+ * or (at your option) any later version. -+ * -+ * This program 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 General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -+ */ -+ -+ .text -+ .align 2 -+ .global callJNIMethod -+ .type callJNIMethod,function -+ -+/* -+ * Arguments passed in: -+ * -+ * r0 JNIEnv -+ * r1 class or NULL -+ * r2 sig -+ * r3 extra arg -+ * sp + 0 ostack -+ * sp + 4 function pntr -+ * sp + 8 args count -+ */ -+ -+/* Register usage : -+ * -+ * lr ostack pntr -+ * ip scratch -+ * r11 function pntr -+ * r10 fp backfill -+ * r8 fp reg -+ * r7 int reg -+ * r6 args pntr -+ * r5 sig pntr -+ * r4 extra stack -+ * r3, r2 outgoing int args -+ * r1 outgoing class or this pntr -+ * r0 outgoing JNIEnv (as passed in) -+ * -+ * s0 - s16 (d0 - d7) outgoing float args -+ */ -+ -+callJNIMethod: -+ stmfd sp!, {r4, r5, r6, r7, r8, r10, r11, lr} -+ ldr lr, [sp, #32] /* get ostack pntr */ -+ ldr r11, [sp, #36] /* get function pntr */ -+ -+ cmp r1, #0 /* is method non-static? */ -+ ldreq r1, [lr], #4 /* yes, load r1 with "this" */ -+ -+ mov r4, r3 -+ sub sp, sp, r4 /* allocate room for stacked */ -+ add r5, r2, #1 /* init sig pntr -- skipping '(' */ -+ -+ mov r6, sp /* init loop pntr */ -+ -+ mov r7, #2 -+ mov r8, #16 -+ mov r10, #0 -+ -+scan_sig: -+ ldrb ip, [r5], #1 -+ -+ cmp ip, #41 /* ')' */ -+ beq done -+ -+ cmp ip, #70 /* 'F' */ -+ beq float -+ -+ cmp ip, #68 /* 'D' */ -+ beq double -+ -+ cmp ip, #74 /* 'J' */ -+ beq long -+ -+skip_brackets: -+ cmp ip, #91 /* '[' */ -+ ldreqb ip, [r5], #1 -+ beq skip_brackets -+ -+ cmp ip, #76 /* 'L' */ -+ bne int -+ -+skip_ref: -+ ldrb ip, [r5], #1 -+ cmp ip, #59 /* ';' */ -+ bne skip_ref -+ -+int: -+ cmp r7, #0 -+ beq stack_int -+ -+ subs r7, r7, #1 -+ -+ ldrne r2, [lr], #4 -+ ldreq r3, [lr], #4 -+ -+ b scan_sig -+ -+stack_int: -+ ldr ip, [lr], #4 -+ str ip, [r6], #4 -+ b scan_sig -+ -+float: -+ cmp r10, #0 -+ beq no_backfill -+ -+ sub ip, r10, #1 -+ mov r10, #0 -+ b load_float -+ -+no_backfill: -+ cmp r8, #0 -+ beq stack_int -+ -+ sub r8, r8, #1 -+ mov ip, r8 -+ -+load_float: -+ add lr, lr, #4 -+ add pc, pc, ip, lsl #3 -+ nop -+ -+ flds s15, [lr, #-4] -+ b scan_sig -+ flds s14, [lr, #-4] -+ b scan_sig -+ flds s13, [lr, #-4] -+ b scan_sig -+ flds s12, [lr, #-4] -+ b scan_sig -+ flds s11, [lr, #-4] -+ b scan_sig -+ flds s10, [lr, #-4] -+ b scan_sig -+ flds s9, [lr, #-4] -+ b scan_sig -+ flds s8, [lr, #-4] -+ b scan_sig -+ flds s7, [lr, #-4] -+ b scan_sig -+ flds s6, [lr, #-4] -+ b scan_sig -+ flds s5, [lr, #-4] -+ b scan_sig -+ flds s4, [lr, #-4] -+ b scan_sig -+ flds s3, [lr, #-4] -+ b scan_sig -+ flds s2, [lr, #-4] -+ b scan_sig -+ flds s1, [lr, #-4] -+ b scan_sig -+ flds s0, [lr, #-4] -+ b scan_sig -+ -+long: -+ cmp r7, #2 -+ mov r7, #0 -+ bne stack_long -+ -+ ldr r2, [lr], #4 -+ ldr r3, [lr], #4 -+ b scan_sig -+ -+double: -+ lsrs ip, r8, #1 -+ movcs r10, r8 -+ -+ lsls r8, ip, #1 -+ beq stack_double -+ -+ sub r8, r8, #2 -+ add lr, lr, #8 -+ add pc, pc, ip, lsl #3 -+ nop -+ nop -+ nop -+ -+ fldd d7, [lr, #-8] -+ b scan_sig -+ fldd d6, [lr, #-8] -+ b scan_sig -+ fldd d5, [lr, #-8] -+ b scan_sig -+ fldd d4, [lr, #-8] -+ b scan_sig -+ fldd d3, [lr, #-8] -+ b scan_sig -+ fldd d2, [lr, #-8] -+ b scan_sig -+ fldd d1, [lr, #-8] -+ b scan_sig -+ fldd d0, [lr, #-8] -+ b scan_sig -+ -+stack_double: -+ mov r10, #0 -+ -+stack_long: -+ /* Ensure address is 8 byte aligned */ -+ add r6, r6, #7 -+ bic r6, r6, #7 -+ -+ ldr ip, [lr], #4 -+ str ip, [r6], #4 -+ ldr ip, [lr], #4 -+ str ip, [r6], #4 -+ b scan_sig -+ -+done: -+ /* Call the function */ -+#if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) -+ mov lr, pc -+ bx r11 -+#else -+ blx r11 -+#endif -+ -+ add sp, sp, r4 /* Pop argument area */ -+ ldr r4, [sp, #32] /* Reload ostack for */ -+ /* address of return value */ -+ ldrb ip, [r5] /* Return type */ -+ -+ cmp ip, #86 /* 'V' */ -+ beq return -+ -+ cmp ip, #68 /* 'D' */ -+ beq return_double -+ -+ cmp ip, #70 /* 'F' */ -+ beq return_float -+ -+ str r0, [r4], #4 /* Low word */ -+ -+ cmp ip, #74 /* 'J' */ -+ streq r1, [r4], #4 /* High word */ -+ -+return: -+ mov r0, r4 /* return ostack */ -+ ldmfd sp!, {r4, r5, r6, r7, r8, r10, r11, lr} -+ bx lr -+ -+return_float: -+ add r4, r4, #4 -+ fsts s0, [r4, #-4] -+ b return -+ -+return_double: -+ add r4, r4, #8 -+ fstd d0, [r4, #-8] -+ b return -diff --git a/src/os/linux/arm/dll_md.c b/src/os/linux/arm/dll_md.c -index f5df90e..39bdf7c 100644 ---- a/src/os/linux/arm/dll_md.c -+++ b/src/os/linux/arm/dll_md.c -@@ -1,6 +1,6 @@ - /* -- * Copyright (C) 2003, 2004, 2005, 2006, 2007 -- * Robert Lougher . -+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2011 -+ * Robert Lougher . - * - * This file is part of JamVM. - * -@@ -31,6 +31,61 @@ - * out stack requirements and then to push arguments. To - * save the first scan at call time, the signature is pre- - * scanned and stack requirement stored in the extra argument. */ -+ -+#ifdef __ARM_PCS_VFP -+int nativeExtraArg(MethodBlock *mb) { -+ char *sig = mb->type; -+ int fp_backfill = 0; -+ int stack_args = 0; -+ int int_args = 2; -+ int fp_args = 16; -+ -+ while(*++sig != ')') -+ switch(*sig) { -+ case 'J': -+ if(int_args < 2) -+ stack_args = (stack_args + 15) & ~7; -+ int_args = 0; -+ break; -+ -+ case 'D': -+ fp_backfill |= fp_args & 1; -+ fp_args &= ~1; -+ -+ if(fp_args == 0) { -+ stack_args = (stack_args + 15) & ~7; -+ fp_backfill = 0; -+ } else -+ fp_args -= 2; -+ break; -+ -+ case 'F': -+ if(fp_backfill) -+ fp_backfill = 0; -+ else { -+ if(fp_args == 0) -+ stack_args += 4; -+ else -+ fp_args--; -+ } -+ break; -+ -+ default: -+ if(int_args == 0) -+ stack_args += 4; -+ else -+ int_args--; -+ -+ if(*sig == '[') -+ while(*++sig == '['); -+ if(*sig == 'L') -+ while(*++sig != ';'); -+ break; -+ } -+ -+ return (stack_args + 7) & ~7; -+} -+#else - int nativeExtraArg(MethodBlock *mb) { - char *sig = mb->type; - int args = 0; -@@ -57,7 +112,7 @@ int nativeExtraArg(MethodBlock *mb) { - native method, so minimum stack requirement is 8 bytes. */ - return args < 8 ? 8 : args; - } -- -+#endif - #else - - /* Under OABI, arguments can be copied onto the stack "as is" --- -2.17.1 - -- cgit v1.2.3