1 From 67faeb7d58e0d25a50d36788ed49ed383b92e090 Mon Sep 17 00:00:00 2001
2 From: Efraim Flashner <efraim@flashner.co.il>
3 Date: Mon, 26 Mar 2018 11:08:17 +0300
4 Subject: [PATCH] add ARMv7 support
7 src/arch/arm.h | 75 +++++-
8 src/os/linux/arm/Makefile.am | 9 +-
9 src/os/linux/arm/Makefile.in | 166 ++++++++----
10 src/os/linux/arm/callNative.S | 12 +-
11 src/os/linux/arm/callNativeEABI.S | 8 +-
12 src/os/linux/arm/callNativeEABIHard.S | 315 +++++++++++++++++++++++
13 src/os/linux/arm/callNativeEABIHardARM.S | 266 +++++++++++++++++++
14 src/os/linux/arm/dll_md.c | 61 ++++-
15 8 files changed, 843 insertions(+), 69 deletions(-)
16 create mode 100644 src/os/linux/arm/callNativeEABIHard.S
17 create mode 100644 src/os/linux/arm/callNativeEABIHardARM.S
19 diff --git a/src/arch/arm.h b/src/arch/arm.h
20 index ccf68c4..d2c0318 100644
25 - * Copyright (C) 2003, 2004, 2005, 2006, 2007
26 - * Robert Lougher <rob@lougher.org.uk>.
27 + * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
28 + * 2014 Robert Lougher <rob@jamvm.org.uk>.
30 * This file is part of JamVM.
36 -/* Override default min and max heap sizes. ARM machines are
37 - usually embedded, and the standard defaults are too large. */
38 -#define DEFAULT_MAX_HEAP 16*MB
39 +/* Override minimum min heap size. The initial heap size is a ratio
40 + of the physical memory, but it must be at least the minimum min
41 + size. The normal setting is too large for ARM machines as they
42 + are usually embedded. */
43 +#define MIN_MIN_HEAP 1*MB
45 +/* Likewise, override the default min/max heap sizes used when the
46 + size of physical memory is not available */
47 #define DEFAULT_MIN_HEAP 1*MB
48 +#define DEFAULT_MAX_HEAP 64*MB
51 #define HANDLER_TABLE_T static const void
53 /* Needed for i386 -- empty here */
56 +#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7A__)
57 +#define COMPARE_AND_SWAP_32(addr, old_val, new_val) \
59 + int result, read_val; \
60 + __asm__ __volatile__ (" \
65 + strex %0, %4, [%2]; \
70 + : "=&r" (result), "=&r" (read_val) \
71 + : "r" (addr), "r" (old_val), "r" (new_val) \
72 + : "cc", "memory"); \
76 +#define COMPARE_AND_SWAP(addr, old_val, new_val) \
77 + COMPARE_AND_SWAP_32(addr, old_val, new_val)
79 +#define LOCKWORD_READ(addr) *addr
80 +#define LOCKWORD_WRITE(addr, value) *addr = value
81 +#define LOCKWORD_COMPARE_AND_SWAP(addr, old_val, new_val) \
82 + COMPARE_AND_SWAP(addr, old_val, new_val)
86 #define LOCKWORD_COMPARE_AND_SWAP(addr, old_val, new_val) \
88 int result, read_val; \
89 @@ -94,7 +130,7 @@ do { \
90 : "r" (addr), "r" (new_val) \
97 #define FLUSH_CACHE(addr, length) \
98 @@ -124,8 +160,33 @@ do { \
102 +#define GEN_REL_JMP(target_addr, patch_addr, patch_size) \
104 + int patched = FALSE; \
106 + if(patch_size >= 4) { \
107 + /* Guard against the pointer difference being \
108 + larger than the signed range */ \
109 + long long offset = (uintptr_t)(target_addr) - \
110 + (uintptr_t)(patch_addr) - 8; \
112 + if(offset >= -1<<25 && offset < 1<<25) { \
113 + *(int*)(patch_addr) = offset>>2 & 0x00ffffff \
121 +#ifdef __ARM_ARCH_7A__
122 +#define MBARRIER() __asm__ __volatile__ ("dmb" ::: "memory")
123 +#define UNLOCK_MBARRIER() __asm__ __volatile__ ("dmb" ::: "memory")
124 +#define JMM_LOCK_MBARRIER() __asm__ __volatile__ ("dmb" ::: "memory")
125 +#define JMM_UNLOCK_MBARRIER() __asm__ __volatile__ ("dmb" ::: "memory")
127 #define MBARRIER() __asm__ __volatile__ ("" ::: "memory")
128 #define UNLOCK_MBARRIER() __asm__ __volatile__ ("" ::: "memory")
129 #define JMM_LOCK_MBARRIER() __asm__ __volatile__ ("" ::: "memory")
130 #define JMM_UNLOCK_MBARRIER() __asm__ __volatile__ ("" ::: "memory")
133 diff --git a/src/os/linux/arm/Makefile.am b/src/os/linux/arm/Makefile.am
134 index d18ea5a..74e7786 100644
135 --- a/src/os/linux/arm/Makefile.am
136 +++ b/src/os/linux/arm/Makefile.am
139 -## Copyright (C) 2003, 2004, 2005, 2006, 2007
140 -## Robert Lougher <rob@lougher.org.uk>.
141 +## Copyright (C) 2003, 2004, 2005, 2006, 2007, 2010, 2011, 2012
142 +## Robert Lougher <rob@jamvm.org.uk>.
144 ## This file is part of JamVM.
147 ## Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
150 -EXTRA_DIST = callNativeOABI.S callNativeEABI.S
151 +EXTRA_DIST = callNativeOABI.S callNativeEABI.S callNativeEABIHard.S \
152 + callNativeEABIHardARM.S
154 noinst_LTLIBRARIES = libnative.la
155 libnative_la_SOURCES = init.c dll_md.c callNative.S
157 -AM_CPPFLAGS = -I$(top_builddir)/src
158 +AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src
159 AM_CCASFLAGS = -I$(top_builddir)/src
160 diff --git a/src/os/linux/arm/Makefile.in b/src/os/linux/arm/Makefile.in
161 index 63b21ad..6d44ea9 100644
162 --- a/src/os/linux/arm/Makefile.in
163 +++ b/src/os/linux/arm/Makefile.in
165 -# Makefile.in generated by automake 1.10 from Makefile.am.
166 +# Makefile.in generated by automake 1.11.6 from Makefile.am.
169 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
170 -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
171 +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
173 # This Makefile.in is free software; the Free Software Foundation
174 # gives unlimited permission to copy and/or distribute it,
175 # with or without modifications, as long as this notice is preserved.
183 + case $$MAKEFLAGS in \
185 + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
186 + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
188 + for am__flg in $$MAKEFLAGS; do \
189 + case $$am__flg in \
191 + *n*) am__dry=yes; break;; \
195 + test $$am__dry = yes; \
197 pkgdatadir = $(datadir)/@PACKAGE@
198 -pkglibdir = $(libdir)/@PACKAGE@
199 pkgincludedir = $(includedir)/@PACKAGE@
200 +pkglibdir = $(libdir)/@PACKAGE@
201 +pkglibexecdir = $(libexecdir)/@PACKAGE@
202 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
203 install_sh_DATA = $(install_sh) -c -m 644
204 install_sh_PROGRAM = $(install_sh) -c
205 @@ -42,13 +61,15 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
206 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
207 CONFIG_HEADER = $(top_builddir)/src/config.h
209 +CONFIG_CLEAN_VPATH_FILES =
210 LTLIBRARIES = $(noinst_LTLIBRARIES)
211 libnative_la_LIBADD =
212 am_libnative_la_OBJECTS = init.lo dll_md.lo callNative.lo
213 libnative_la_OBJECTS = $(am_libnative_la_OBJECTS)
214 -DEFAULT_INCLUDES = -I. -I$(top_builddir)/src@am__isrc@
215 +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
216 depcomp = $(SHELL) $(top_srcdir)/depcomp
217 am__depfiles_maybe = depfiles
219 CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
220 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)
221 LTCPPASCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
222 @@ -65,6 +86,11 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
224 SOURCES = $(libnative_la_SOURCES)
225 DIST_SOURCES = $(libnative_la_SOURCES)
226 +am__can_run_installinfo = \
227 + case $$AM_UPDATE_INFO_DIR in \
229 + *) (install-info --version) >/dev/null 2>&1;; \
233 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
234 @@ -84,21 +110,18 @@ CCDEPMODE = @CCDEPMODE@
237 CPPFLAGS = @CPPFLAGS@
240 -CXXDEPMODE = @CXXDEPMODE@
241 -CXXFLAGS = @CXXFLAGS@
242 CYGPATH_W = @CYGPATH_W@
247 +DSYMUTIL = @DSYMUTIL@
259 INSTALL_DATA = @INSTALL_DATA@
260 @@ -106,21 +129,30 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
261 INSTALL_SCRIPT = @INSTALL_SCRIPT@
262 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
271 LTLIBOBJS = @LTLIBOBJS@
273 MAKEINFO = @MAKEINFO@
274 +MANIFEST_TOOL = @MANIFEST_TOOL@
283 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
284 PACKAGE_NAME = @PACKAGE_NAME@
285 PACKAGE_STRING = @PACKAGE_STRING@
286 PACKAGE_TARNAME = @PACKAGE_TARNAME@
287 +PACKAGE_URL = @PACKAGE_URL@
288 PACKAGE_VERSION = @PACKAGE_VERSION@
289 PATH_SEPARATOR = @PATH_SEPARATOR@
291 @@ -133,9 +165,9 @@ abs_builddir = @abs_builddir@
292 abs_srcdir = @abs_srcdir@
293 abs_top_builddir = @abs_top_builddir@
294 abs_top_srcdir = @abs_top_srcdir@
295 +ac_ct_AR = @ac_ct_AR@
296 ac_ct_CC = @ac_ct_CC@
297 -ac_ct_CXX = @ac_ct_CXX@
298 -ac_ct_F77 = @ac_ct_F77@
299 +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
300 am__include = @am__include@
301 am__leading_dot = @am__leading_dot@
302 am__quote = @am__quote@
303 @@ -149,6 +181,7 @@ build_cpu = @build_cpu@
304 build_os = @build_os@
305 build_vendor = @build_vendor@
306 builddir = @builddir@
307 +classlib = @classlib@
309 datarootdir = @datarootdir@
311 @@ -181,15 +214,18 @@ sharedstatedir = @sharedstatedir@
313 sysconfdir = @sysconfdir@
314 target_alias = @target_alias@
315 +top_build_prefix = @top_build_prefix@
316 top_builddir = @top_builddir@
317 top_srcdir = @top_srcdir@
318 use_zip_no = @use_zip_no@
319 use_zip_yes = @use_zip_yes@
320 with_classpath_install_dir = @with_classpath_install_dir@
321 -EXTRA_DIST = callNativeOABI.S callNativeEABI.S
322 +EXTRA_DIST = callNativeOABI.S callNativeEABI.S callNativeEABIHard.S \
323 + callNativeEABIHardARM.S
325 noinst_LTLIBRARIES = libnative.la
326 libnative_la_SOURCES = init.c dll_md.c callNative.S
327 -AM_CPPFLAGS = -I$(top_builddir)/src
328 +AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src
329 AM_CCASFLAGS = -I$(top_builddir)/src
332 @@ -199,14 +235,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
334 case '$(am__configure_deps)' in \
336 - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
338 + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
339 + && { if test -f $@; then exit 0; else break; fi; }; \
343 - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/os/linux/arm/Makefile'; \
344 - cd $(top_srcdir) && \
345 - $(AUTOMAKE) --gnu src/os/linux/arm/Makefile
346 + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/os/linux/arm/Makefile'; \
347 + $(am__cd) $(top_srcdir) && \
348 + $(AUTOMAKE) --gnu src/os/linux/arm/Makefile
350 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
352 @@ -224,6 +260,7 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
353 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
354 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
355 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
356 +$(am__aclocal_m4_deps):
358 clean-noinstLTLIBRARIES:
359 -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
360 @@ -233,7 +270,7 @@ clean-noinstLTLIBRARIES:
361 echo "rm -f \"$${dir}/so_locations\""; \
362 rm -f "$${dir}/so_locations"; \
364 -libnative.la: $(libnative_la_OBJECTS) $(libnative_la_DEPENDENCIES)
365 +libnative.la: $(libnative_la_OBJECTS) $(libnative_la_DEPENDENCIES) $(EXTRA_libnative_la_DEPENDENCIES)
366 $(LINK) $(libnative_la_OBJECTS) $(libnative_la_LIBADD) $(LIBS)
369 @@ -248,42 +285,42 @@ distclean-compile:
372 @am__fastdepCCAS_TRUE@ $(CPPASCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
373 -@am__fastdepCCAS_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
374 +@am__fastdepCCAS_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
375 @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
376 @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@
377 @am__fastdepCCAS_FALSE@ $(CPPASCOMPILE) -c -o $@ $<
380 @am__fastdepCCAS_TRUE@ $(CPPASCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
381 -@am__fastdepCCAS_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
382 +@am__fastdepCCAS_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
383 @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
384 @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@
385 @am__fastdepCCAS_FALSE@ $(CPPASCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
388 @am__fastdepCCAS_TRUE@ $(LTCPPASCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
389 -@am__fastdepCCAS_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
390 +@am__fastdepCCAS_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
391 @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
392 @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@
393 @am__fastdepCCAS_FALSE@ $(LTCPPASCOMPILE) -c -o $@ $<
396 @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
397 -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
398 +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
399 @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
400 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
401 @am__fastdepCC_FALSE@ $(COMPILE) -c $<
404 @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
405 -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
406 +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
407 @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
408 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
409 @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
412 @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
413 -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
414 +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
415 @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
416 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
417 @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
418 @@ -299,45 +336,49 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
419 unique=`for i in $$list; do \
420 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
422 - $(AWK) ' { files[$$0] = 1; } \
423 - END { for (i in files) print i; }'`; \
424 + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
425 + END { if (nonempty) { for (i in files) print i; }; }'`; \
429 TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
430 $(TAGS_FILES) $(LISP)
434 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
435 unique=`for i in $$list; do \
436 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
438 - $(AWK) ' { files[$$0] = 1; } \
439 - END { for (i in files) print i; }'`; \
440 - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
441 + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
442 + END { if (nonempty) { for (i in files) print i; }; }'`; \
444 + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
445 test -n "$$unique" || unique=$$empty_fix; \
446 - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
448 + if test $$# -gt 0; then \
449 + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
452 + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
457 CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
458 $(TAGS_FILES) $(LISP)
461 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
462 unique=`for i in $$list; do \
463 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
465 - $(AWK) ' { files[$$0] = 1; } \
466 - END { for (i in files) print i; }'`; \
467 - test -z "$(CTAGS_ARGS)$$tags$$unique" \
468 + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
469 + END { if (nonempty) { for (i in files) print i; }; }'`; \
470 + test -z "$(CTAGS_ARGS)$$unique" \
471 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
476 here=`$(am__cd) $(top_builddir) && pwd` \
477 - && cd $(top_srcdir) \
478 - && gtags -i $(GTAGS_ARGS) $$here
479 + && $(am__cd) $(top_srcdir) \
480 + && gtags -i $(GTAGS_ARGS) "$$here"
483 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
484 @@ -358,13 +399,17 @@ distdir: $(DISTFILES)
485 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
486 if test -d $$d/$$file; then \
487 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
488 + if test -d "$(distdir)/$$file"; then \
489 + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
491 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
492 - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
493 + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
494 + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
496 - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
497 + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
499 - test -f $(distdir)/$$file \
500 - || cp -p $$d/$$file $(distdir)/$$file \
501 + test -f "$(distdir)/$$file" \
502 + || cp -p $$d/$$file "$(distdir)/$$file" \
506 @@ -382,16 +427,22 @@ install-am: all-am
508 installcheck: installcheck-am
510 - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
511 - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
512 - `test -z '$(STRIP)' || \
513 - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
514 + if test -z '$(STRIP)'; then \
515 + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
516 + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
519 + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
520 + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
521 + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
528 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
529 + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
531 maintainer-clean-generic:
532 @echo "This command is intended for maintainers to use"
533 @@ -413,6 +464,8 @@ dvi-am:
542 @@ -421,18 +474,28 @@ install-data-am:
544 install-dvi: install-dvi-am
550 install-html: install-html-am
554 install-info: install-info-am
560 install-pdf: install-pdf-am
564 install-ps: install-ps-am
570 maintainer-clean: maintainer-clean-am
571 @@ -470,6 +533,7 @@ uninstall-am:
572 mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
573 pdf pdf-am ps ps-am tags uninstall uninstall-am
576 # Tell versions [3.59,3.63) of GNU make to not export all variables.
577 # Otherwise a system limit (for SysV at least) may be exceeded.
579 diff --git a/src/os/linux/arm/callNative.S b/src/os/linux/arm/callNative.S
580 index 39ab6d3..245afd1 100644
581 --- a/src/os/linux/arm/callNative.S
582 +++ b/src/os/linux/arm/callNative.S
585 - * Copyright (C) 2003, 2004, 2005, 2006, 2007
586 - * Robert Lougher <rob@lougher.org.uk>.
587 + * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2011, 2012
588 + * Robert Lougher <rob@jamvm.org.uk>.
590 * This file is part of JamVM.
596 +#ifdef __ARM_PCS_VFP
597 +#ifdef __ARM_ARCH_7A__
598 +#include "callNativeEABIHard.S"
600 +#include "callNativeEABIHardARM.S"
603 #include "callNativeEABI.S"
606 #include "callNativeOABI.S"
608 diff --git a/src/os/linux/arm/callNativeEABI.S b/src/os/linux/arm/callNativeEABI.S
609 index 5effa57..3a7539e 100644
610 --- a/src/os/linux/arm/callNativeEABI.S
611 +++ b/src/os/linux/arm/callNativeEABI.S
614 - * Copyright (C) 2003, 2004, 2005, 2006, 2007
615 - * Robert Lougher <rob@lougher.org.uk>.
616 + * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2011
617 + * Robert Lougher <rob@jamvm.org.uk>.
619 * This file is part of JamVM.
621 @@ -95,8 +95,12 @@ done:
624 /* Call the function */
625 +#if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__)
632 subs r4, r4, #8 /* Pop argument area */
633 /* (minus 8 for r2/r3) */
634 diff --git a/src/os/linux/arm/callNativeEABIHard.S b/src/os/linux/arm/callNativeEABIHard.S
636 index 0000000..5d5785b
638 +++ b/src/os/linux/arm/callNativeEABIHard.S
641 + * Copyright (C) 2011, 2012 Robert Lougher <rob@jamvm.org.uk>.
643 + * This file is part of JamVM.
645 + * This program is free software; you can redistribute it and/or
646 + * modify it under the terms of the GNU General Public License
647 + * as published by the Free Software Foundation; either version 2,
648 + * or (at your option) any later version.
650 + * This program is distributed in the hope that it will be useful,
651 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
652 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
653 + * GNU General Public License for more details.
655 + * You should have received a copy of the GNU General Public License
656 + * along with this program; if not, write to the Free Software
657 + * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
665 + .global callJNIMethod
666 + .type callJNIMethod,function
669 + * Arguments passed in:
676 + * sp + 4 function pntr
677 + * sp + 8 args count
682 + * r11 function pntr
691 + * r3, r2 outgoing int args
692 + * r1 outgoing class or this pntr
693 + * r0 outgoing JNIEnv (as passed in)
695 + * s0 - s16 (d0 - d7) outgoing float args
699 + stmfd sp!, {r4, r5, r6, r7, r8, r10, r11, lr}
700 + ldr lr, [sp, #32] /* get ostack pntr */
701 + ldr r11, [sp, #36] /* get function pntr */
703 + cmp r1, #0 /* is method non-static? */
705 + ldreq r1, [lr], #4 /* yes, load r1 with "this" */
708 + subs sp, sp, r3 /* allocate room for stacked */
709 + add r8, r2, #1 /* init sig pntr -- skipping '(' */
711 + mov ip, sp /* init loop pntr */
720 + cmp r5, #41 /* ')' */
723 + cmp r5, #70 /* 'F' */
726 + cmp r5, #68 /* 'D' */
729 + cmp r5, #74 /* 'J' */
733 + cmp r5, #91 /* '[' */
735 + ldrbeq r5, [r8], #1
738 + cmp r5, #76 /* 'L' */
743 + cmp r5, #59 /* ';' */
757 + cbz r6, no_backfill
774 + .byte (s15-float_table)/2
775 + .byte (s14-float_table)/2
776 + .byte (s13-float_table)/2
777 + .byte (s12-float_table)/2
778 + .byte (s11-float_table)/2
779 + .byte (s10-float_table)/2
780 + .byte (s9-float_table)/2
781 + .byte (s8-float_table)/2
782 + .byte (s7-float_table)/2
783 + .byte (s6-float_table)/2
784 + .byte (s5-float_table)/2
785 + .byte (s4-float_table)/2
786 + .byte (s3-float_table)/2
787 + .byte (s2-float_table)/2
788 + .byte (s1-float_table)/2
789 + .byte (s0-float_table)/2
827 + vldr s10, [lr, #-4]
830 + vldr s11, [lr, #-4]
833 + vldr s12, [lr, #-4]
836 + vldr s13, [lr, #-4]
839 + vldr s14, [lr, #-4]
842 + vldr s15, [lr, #-4]
850 + ldmia lr!, {r2, r3}
867 + .byte (d7-double_table)/2
868 + .byte (d6-double_table)/2
869 + .byte (d5-double_table)/2
870 + .byte (d4-double_table)/2
871 + .byte (d3-double_table)/2
872 + .byte (d2-double_table)/2
873 + .byte (d1-double_table)/2
874 + .byte (d0-double_table)/2
905 + /* Ensure address is 8 byte aligned */
916 + /* Call the function */
919 + add sp, sp, r10 /* Pop argument area */
921 + ldr r4, [sp, #32] /* Reload ostack for */
922 + /* address of return value */
924 + ldrb r5, [r8] /* Return type */
926 + cmp r5, #86 /* 'V' */
929 + cmp r5, #68 /* 'D' */
932 + cmp r5, #70 /* 'F' */
935 + str r0, [r4], #4 /* Low word */
937 + cmp r5, #74 /* 'J' */
939 + streq r1, [r4], #4 /* High word */
942 + mov r0, r4 /* return ostack */
943 + ldmfd sp!, {r4, r5, r6, r7, r8, r10, r11, lr}
955 diff --git a/src/os/linux/arm/callNativeEABIHardARM.S b/src/os/linux/arm/callNativeEABIHardARM.S
957 index 0000000..3a31acd
959 +++ b/src/os/linux/arm/callNativeEABIHardARM.S
962 + * Copyright (C) 2011, 2012 Robert Lougher <rob@jamvm.org.uk>.
964 + * This file is part of JamVM.
966 + * This program is free software; you can redistribute it and/or
967 + * modify it under the terms of the GNU General Public License
968 + * as published by the Free Software Foundation; either version 2,
969 + * or (at your option) any later version.
971 + * This program is distributed in the hope that it will be useful,
972 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
973 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
974 + * GNU General Public License for more details.
976 + * You should have received a copy of the GNU General Public License
977 + * along with this program; if not, write to the Free Software
978 + * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
983 + .global callJNIMethod
984 + .type callJNIMethod,function
987 + * Arguments passed in:
994 + * sp + 4 function pntr
995 + * sp + 8 args count
1002 + * r11 function pntr
1009 + * r3, r2 outgoing int args
1010 + * r1 outgoing class or this pntr
1011 + * r0 outgoing JNIEnv (as passed in)
1013 + * s0 - s16 (d0 - d7) outgoing float args
1017 + stmfd sp!, {r4, r5, r6, r7, r8, r10, r11, lr}
1018 + ldr lr, [sp, #32] /* get ostack pntr */
1019 + ldr r11, [sp, #36] /* get function pntr */
1021 + cmp r1, #0 /* is method non-static? */
1022 + ldreq r1, [lr], #4 /* yes, load r1 with "this" */
1025 + sub sp, sp, r4 /* allocate room for stacked */
1026 + add r5, r2, #1 /* init sig pntr -- skipping '(' */
1028 + mov r6, sp /* init loop pntr */
1037 + cmp ip, #41 /* ')' */
1040 + cmp ip, #70 /* 'F' */
1043 + cmp ip, #68 /* 'D' */
1046 + cmp ip, #74 /* 'J' */
1050 + cmp ip, #91 /* '[' */
1051 + ldreqb ip, [r5], #1
1054 + cmp ip, #76 /* 'L' */
1059 + cmp ip, #59 /* ';' */
1068 + ldrne r2, [lr], #4
1069 + ldreq r3, [lr], #4
1095 + add pc, pc, ip, lsl #3
1098 + flds s15, [lr, #-4]
1100 + flds s14, [lr, #-4]
1102 + flds s13, [lr, #-4]
1104 + flds s12, [lr, #-4]
1106 + flds s11, [lr, #-4]
1108 + flds s10, [lr, #-4]
1110 + flds s9, [lr, #-4]
1112 + flds s8, [lr, #-4]
1114 + flds s7, [lr, #-4]
1116 + flds s6, [lr, #-4]
1118 + flds s5, [lr, #-4]
1120 + flds s4, [lr, #-4]
1122 + flds s3, [lr, #-4]
1124 + flds s2, [lr, #-4]
1126 + flds s1, [lr, #-4]
1128 + flds s0, [lr, #-4]
1149 + add pc, pc, ip, lsl #3
1154 + fldd d7, [lr, #-8]
1156 + fldd d6, [lr, #-8]
1158 + fldd d5, [lr, #-8]
1160 + fldd d4, [lr, #-8]
1162 + fldd d3, [lr, #-8]
1164 + fldd d2, [lr, #-8]
1166 + fldd d1, [lr, #-8]
1168 + fldd d0, [lr, #-8]
1175 + /* Ensure address is 8 byte aligned */
1186 + /* Call the function */
1187 +#if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__)
1194 + add sp, sp, r4 /* Pop argument area */
1195 + ldr r4, [sp, #32] /* Reload ostack for */
1196 + /* address of return value */
1197 + ldrb ip, [r5] /* Return type */
1199 + cmp ip, #86 /* 'V' */
1202 + cmp ip, #68 /* 'D' */
1205 + cmp ip, #70 /* 'F' */
1208 + str r0, [r4], #4 /* Low word */
1210 + cmp ip, #74 /* 'J' */
1211 + streq r1, [r4], #4 /* High word */
1214 + mov r0, r4 /* return ostack */
1215 + ldmfd sp!, {r4, r5, r6, r7, r8, r10, r11, lr}
1220 + fsts s0, [r4, #-4]
1225 + fstd d0, [r4, #-8]
1227 diff --git a/src/os/linux/arm/dll_md.c b/src/os/linux/arm/dll_md.c
1228 index f5df90e..39bdf7c 100644
1229 --- a/src/os/linux/arm/dll_md.c
1230 +++ b/src/os/linux/arm/dll_md.c
1233 - * Copyright (C) 2003, 2004, 2005, 2006, 2007
1234 - * Robert Lougher <rob@lougher.org.uk>.
1235 + * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2011
1236 + * Robert Lougher <rob@jamvm.org.uk>.
1238 * This file is part of JamVM.
1241 * out stack requirements and then to push arguments. To
1242 * save the first scan at call time, the signature is pre-
1243 * scanned and stack requirement stored in the extra argument. */
1245 +#ifdef __ARM_PCS_VFP
1246 +int nativeExtraArg(MethodBlock *mb) {
1247 + char *sig = mb->type;
1248 + int fp_backfill = 0;
1249 + int stack_args = 0;
1253 + while(*++sig != ')')
1257 + stack_args = (stack_args + 15) & ~7;
1262 + fp_backfill |= fp_args & 1;
1265 + if(fp_args == 0) {
1266 + stack_args = (stack_args + 15) & ~7;
1290 + while(*++sig == '[');
1292 + while(*++sig != ';');
1296 + return (stack_args + 7) & ~7;
1299 int nativeExtraArg(MethodBlock *mb) {
1300 char *sig = mb->type;
1302 @@ -57,7 +112,7 @@ int nativeExtraArg(MethodBlock *mb) {
1303 native method, so minimum stack requirement is 8 bytes. */
1304 return args < 8 ? 8 : args;
1310 /* Under OABI, arguments can be copied onto the stack "as is"