gnu: Add Combinatorial BLAS.
[jackhill/guix/guix.git] / gnu / packages / patches / jamvm-arm.patch
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
5
6 ---
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
18
19 diff --git a/src/arch/arm.h b/src/arch/arm.h
20 index ccf68c4..d2c0318 100644
21 --- a/src/arch/arm.h
22 +++ b/src/arch/arm.h
23 @@ -1,6 +1,6 @@
24 /*
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>.
29 *
30 * This file is part of JamVM.
31 *
32 @@ -21,10 +21,16 @@
33
34 #define OS_ARCH "arm"
35
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
44 +
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
49
50 #ifdef DIRECT
51 #define HANDLER_TABLE_T static const void
52 @@ -51,6 +57,36 @@
53 /* Needed for i386 -- empty here */
54 #define FPU_HACK
55
56 +#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7A__)
57 +#define COMPARE_AND_SWAP_32(addr, old_val, new_val) \
58 +({ \
59 + int result, read_val; \
60 + __asm__ __volatile__ (" \
61 + 1: mov %0, #0; \
62 + ldrex %1, [%2]; \
63 + cmp %3, %1; \
64 + bne 2f; \
65 + strex %0, %4, [%2]; \
66 + cmp %0, #1; \
67 + beq 1b; \
68 + mov %0, #1; \
69 + 2:" \
70 + : "=&r" (result), "=&r" (read_val) \
71 + : "r" (addr), "r" (old_val), "r" (new_val) \
72 + : "cc", "memory"); \
73 + result; \
74 +})
75 +
76 +#define COMPARE_AND_SWAP(addr, old_val, new_val) \
77 + COMPARE_AND_SWAP_32(addr, old_val, new_val)
78 +
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)
83 +
84 +#else
85 +
86 #define LOCKWORD_COMPARE_AND_SWAP(addr, old_val, new_val) \
87 ({ \
88 int result, read_val; \
89 @@ -94,7 +130,7 @@ do { \
90 : "r" (addr), "r" (new_val) \
91 : "cc", "memory"); \
92 } while(0)
93 -
94 +#endif
95
96 #ifdef __ARM_EABI__
97 #define FLUSH_CACHE(addr, length) \
98 @@ -124,8 +160,33 @@ do { \
99 }
100 #endif
101
102 +#define GEN_REL_JMP(target_addr, patch_addr, patch_size) \
103 +({ \
104 + int patched = FALSE; \
105 + \
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; \
111 + \
112 + if(offset >= -1<<25 && offset < 1<<25) { \
113 + *(int*)(patch_addr) = offset>>2 & 0x00ffffff \
114 + | 0xea000000; \
115 + patched = TRUE; \
116 + } \
117 + } \
118 + patched; \
119 +})
120 +
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")
126 +#else
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")
131 -
132 +#endif
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
137 @@ -1,6 +1,6 @@
138 ##
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>.
143 ##
144 ## This file is part of JamVM.
145 ##
146 @@ -19,10 +19,11 @@
147 ## Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
148 ##
149
150 -EXTRA_DIST = callNativeOABI.S callNativeEABI.S
151 +EXTRA_DIST = callNativeOABI.S callNativeEABI.S callNativeEABIHard.S \
152 + callNativeEABIHardARM.S
153
154 noinst_LTLIBRARIES = libnative.la
155 libnative_la_SOURCES = init.c dll_md.c callNative.S
156
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
164 @@ -1,8 +1,9 @@
165 -# Makefile.in generated by automake 1.10 from Makefile.am.
166 +# Makefile.in generated by automake 1.11.6 from Makefile.am.
167 # @configure_input@
168
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
172 +# Foundation, Inc.
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.
176 @@ -15,9 +16,27 @@
177 @SET_MAKE@
178
179 VPATH = @srcdir@
180 +am__make_dryrun = \
181 + { \
182 + am__dry=no; \
183 + case $$MAKEFLAGS in \
184 + *\\[\ \ ]*) \
185 + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
186 + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
187 + *) \
188 + for am__flg in $$MAKEFLAGS; do \
189 + case $$am__flg in \
190 + *=*|--*) ;; \
191 + *n*) am__dry=yes; break;; \
192 + esac; \
193 + done;; \
194 + esac; \
195 + test $$am__dry = yes; \
196 + }
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
208 CONFIG_CLEAN_FILES =
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
218 +am__mv = mv -f
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) \
223 $(LDFLAGS) -o $@
224 SOURCES = $(libnative_la_SOURCES)
225 DIST_SOURCES = $(libnative_la_SOURCES)
226 +am__can_run_installinfo = \
227 + case $$AM_UPDATE_INFO_DIR in \
228 + n|no|NO) false;; \
229 + *) (install-info --version) >/dev/null 2>&1;; \
230 + esac
231 ETAGS = etags
232 CTAGS = ctags
233 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
234 @@ -84,21 +110,18 @@ CCDEPMODE = @CCDEPMODE@
235 CFLAGS = @CFLAGS@
236 CPP = @CPP@
237 CPPFLAGS = @CPPFLAGS@
238 -CXX = @CXX@
239 -CXXCPP = @CXXCPP@
240 -CXXDEPMODE = @CXXDEPMODE@
241 -CXXFLAGS = @CXXFLAGS@
242 CYGPATH_W = @CYGPATH_W@
243 DEFS = @DEFS@
244 DEPDIR = @DEPDIR@
245 -ECHO = @ECHO@
246 +DLLTOOL = @DLLTOOL@
247 +DSYMUTIL = @DSYMUTIL@
248 +DUMPBIN = @DUMPBIN@
249 ECHO_C = @ECHO_C@
250 ECHO_N = @ECHO_N@
251 ECHO_T = @ECHO_T@
252 EGREP = @EGREP@
253 EXEEXT = @EXEEXT@
254 -F77 = @F77@
255 -FFLAGS = @FFLAGS@
256 +FGREP = @FGREP@
257 GREP = @GREP@
258 INSTALL = @INSTALL@
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@
263 JAVAC = @JAVAC@
264 +LD = @LD@
265 LDFLAGS = @LDFLAGS@
266 LIBOBJS = @LIBOBJS@
267 LIBS = @LIBS@
268 LIBTOOL = @LIBTOOL@
269 +LIPO = @LIPO@
270 LN_S = @LN_S@
271 LTLIBOBJS = @LTLIBOBJS@
272 MAINT = @MAINT@
273 MAKEINFO = @MAKEINFO@
274 +MANIFEST_TOOL = @MANIFEST_TOOL@
275 MKDIR_P = @MKDIR_P@
276 +NM = @NM@
277 +NMEDIT = @NMEDIT@
278 +OBJDUMP = @OBJDUMP@
279 OBJEXT = @OBJEXT@
280 +OTOOL = @OTOOL@
281 +OTOOL64 = @OTOOL64@
282 PACKAGE = @PACKAGE@
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@
290 RANLIB = @RANLIB@
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@
308 datadir = @datadir@
309 datarootdir = @datarootdir@
310 docdir = @docdir@
311 @@ -181,15 +214,18 @@ sharedstatedir = @sharedstatedir@
312 srcdir = @srcdir@
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
324 +
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
330 all: all-am
331
332 @@ -199,14 +235,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
333 @for dep in $?; do \
334 case '$(am__configure_deps)' in \
335 *$$dep*) \
336 - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
337 - && exit 0; \
338 + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
339 + && { if test -f $@; then exit 0; else break; fi; }; \
340 exit 1;; \
341 esac; \
342 done; \
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
349 .PRECIOUS: Makefile
350 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
351 @case '$?' in \
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):
357
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"; \
363 done
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)
367
368 mostlyclean-compile:
369 @@ -248,42 +285,42 @@ distclean-compile:
370
371 .S.o:
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 $@ $<
378
379 .S.obj:
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) '$<'`
386
387 .S.lo:
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 $@ $<
394
395 .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 $<
402
403 .c.obj:
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) '$<'`
410
411 .c.lo:
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; \
421 done | \
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; }; }'`; \
426 mkid -fID $$unique
427 tags: TAGS
428
429 TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
430 $(TAGS_FILES) $(LISP)
431 - tags=; \
432 + set x; \
433 here=`pwd`; \
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; \
437 done | \
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; }; }'`; \
443 + shift; \
444 + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
445 test -n "$$unique" || unique=$$empty_fix; \
446 - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
447 - $$tags $$unique; \
448 + if test $$# -gt 0; then \
449 + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
450 + "$$@" $$unique; \
451 + else \
452 + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
453 + $$unique; \
454 + fi; \
455 fi
456 ctags: CTAGS
457 CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
458 $(TAGS_FILES) $(LISP)
459 - tags=; \
460 - here=`pwd`; \
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; \
464 done | \
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) \
472 - $$tags $$unique
473 + $$unique
474
475 GTAGS:
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"
481
482 distclean-tags:
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 {} \;; \
490 + fi; \
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 {} \;; \
495 fi; \
496 - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
497 + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
498 else \
499 - test -f $(distdir)/$$file \
500 - || cp -p $$d/$$file $(distdir)/$$file \
501 + test -f "$(distdir)/$$file" \
502 + || cp -p $$d/$$file "$(distdir)/$$file" \
503 || exit 1; \
504 fi; \
505 done
506 @@ -382,16 +427,22 @@ install-am: all-am
507
508 installcheck: installcheck-am
509 install-strip:
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 \
517 + install; \
518 + else \
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; \
522 + fi
523 mostlyclean-generic:
524
525 clean-generic:
526
527 distclean-generic:
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)
530
531 maintainer-clean-generic:
532 @echo "This command is intended for maintainers to use"
533 @@ -413,6 +464,8 @@ dvi-am:
534
535 html: html-am
536
537 +html-am:
538 +
539 info: info-am
540
541 info-am:
542 @@ -421,18 +474,28 @@ install-data-am:
543
544 install-dvi: install-dvi-am
545
546 +install-dvi-am:
547 +
548 install-exec-am:
549
550 install-html: install-html-am
551
552 +install-html-am:
553 +
554 install-info: install-info-am
555
556 +install-info-am:
557 +
558 install-man:
559
560 install-pdf: install-pdf-am
561
562 +install-pdf-am:
563 +
564 install-ps: install-ps-am
565
566 +install-ps-am:
567 +
568 installcheck-am:
569
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
574
575 +
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.
578 .NOEXPORT:
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
583 @@ -1,6 +1,6 @@
584 /*
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>.
589 *
590 * This file is part of JamVM.
591 *
592 @@ -23,7 +23,15 @@
593
594 #ifndef USE_FFI
595 #ifdef __ARM_EABI__
596 +#ifdef __ARM_PCS_VFP
597 +#ifdef __ARM_ARCH_7A__
598 +#include "callNativeEABIHard.S"
599 +#else
600 +#include "callNativeEABIHardARM.S"
601 +#endif
602 +#else
603 #include "callNativeEABI.S"
604 +#endif
605 #else
606 #include "callNativeOABI.S"
607 #endif
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
612 @@ -1,6 +1,6 @@
613 /*
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>.
618 *
619 * This file is part of JamVM.
620 *
621 @@ -95,8 +95,12 @@ done:
622 ldmfd sp!, {r2, r3}
623
624 /* Call the function */
625 +#if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__)
626 mov lr, pc
627 bx ip
628 +#else
629 + blx ip
630 +#endif
631
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
635 new file mode 100644
636 index 0000000..5d5785b
637 --- /dev/null
638 +++ b/src/os/linux/arm/callNativeEABIHard.S
639 @@ -0,0 +1,315 @@
640 +/*
641 + * Copyright (C) 2011, 2012 Robert Lougher <rob@jamvm.org.uk>.
642 + *
643 + * This file is part of JamVM.
644 + *
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.
649 + *
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.
654 + *
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.
658 + */
659 +
660 + .text
661 + .syntax unified
662 + .arch armv7-a
663 + .thumb
664 + .align 2
665 + .global callJNIMethod
666 + .type callJNIMethod,function
667 +
668 +/*
669 + * Arguments passed in:
670 + *
671 + * r0 JNIEnv
672 + * r1 class or NULL
673 + * r2 sig
674 + * r3 extra arg
675 + * sp + 0 ostack
676 + * sp + 4 function pntr
677 + * sp + 8 args count
678 + */
679 +
680 +/* Register usage :
681 + *
682 + * r11 function pntr
683 + * lr ostack pntr
684 + * ip args pntr
685 + * r8 sig pntr
686 + * r10 extra stack
687 + * r6 fp backfill
688 + * r4 fp reg
689 + * r7 int reg
690 + * r5 scratch
691 + * r3, r2 outgoing int args
692 + * r1 outgoing class or this pntr
693 + * r0 outgoing JNIEnv (as passed in)
694 + *
695 + * s0 - s16 (d0 - d7) outgoing float args
696 + */
697 +
698 +callJNIMethod:
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 */
702 +
703 + cmp r1, #0 /* is method non-static? */
704 + it eq
705 + ldreq r1, [lr], #4 /* yes, load r1 with "this" */
706 +
707 + mov r10, r3
708 + subs sp, sp, r3 /* allocate room for stacked */
709 + add r8, r2, #1 /* init sig pntr -- skipping '(' */
710 +
711 + mov ip, sp /* init loop pntr */
712 +
713 + mov r7, #2
714 + mov r4, #16
715 + mov r6, #0
716 +
717 +scan_sig:
718 + ldrb r5, [r8], #1
719 +
720 + cmp r5, #41 /* ')' */
721 + beq done
722 +
723 + cmp r5, #70 /* 'F' */
724 + beq float
725 +
726 + cmp r5, #68 /* 'D' */
727 + beq double
728 +
729 + cmp r5, #74 /* 'J' */
730 + beq long
731 +
732 +skip_brackets:
733 + cmp r5, #91 /* '[' */
734 + itt eq
735 + ldrbeq r5, [r8], #1
736 + beq skip_brackets
737 +
738 + cmp r5, #76 /* 'L' */
739 + bne int
740 +
741 +skip_ref:
742 + ldrb r5, [r8], #1
743 + cmp r5, #59 /* ';' */
744 + bne skip_ref
745 +
746 +int:
747 + cbz r7, stack_int
748 +
749 + subs r7, r7, #1
750 + ite ne
751 + ldrne r2, [lr], #4
752 + ldreq r3, [lr], #4
753 +
754 + b scan_sig
755 +
756 +float:
757 + cbz r6, no_backfill
758 +
759 + sub r5, r6, #1
760 + mov r6, #0
761 + b load_float
762 +
763 +no_backfill:
764 + cbz r4, stack_int
765 +
766 + sub r4, r4, #1
767 + mov r5, r4
768 +
769 +load_float:
770 + add lr, lr, #4
771 + tbb [pc, r5]
772 +
773 +float_table:
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
790 +
791 +stack_int:
792 + ldr r5, [lr], #4
793 + str r5, [ip], #4
794 + b scan_sig
795 +
796 +s0:
797 + vldr s0, [lr, #-4]
798 + b scan_sig
799 +s1:
800 + vldr s1, [lr, #-4]
801 + b scan_sig
802 +s2:
803 + vldr s2, [lr, #-4]
804 + b scan_sig
805 +s3:
806 + vldr s3, [lr, #-4]
807 + b scan_sig
808 +s4:
809 + vldr s4, [lr, #-4]
810 + b scan_sig
811 +s5:
812 + vldr s5, [lr, #-4]
813 + b scan_sig
814 +s6:
815 + vldr s6, [lr, #-4]
816 + b scan_sig
817 +s7:
818 + vldr s7, [lr, #-4]
819 + b scan_sig
820 +s8:
821 + vldr s8, [lr, #-4]
822 + b scan_sig
823 +s9:
824 + vldr s9, [lr, #-4]
825 + b scan_sig
826 +s10:
827 + vldr s10, [lr, #-4]
828 + b scan_sig
829 +s11:
830 + vldr s11, [lr, #-4]
831 + b scan_sig
832 +s12:
833 + vldr s12, [lr, #-4]
834 + b scan_sig
835 +s13:
836 + vldr s13, [lr, #-4]
837 + b scan_sig
838 +s14:
839 + vldr s14, [lr, #-4]
840 + b scan_sig
841 +s15:
842 + vldr s15, [lr, #-4]
843 + b scan_sig
844 +
845 +long:
846 + cmp r7, #2
847 + mov r7, #0
848 + bne stack_long
849 +
850 + ldmia lr!, {r2, r3}
851 + b scan_sig
852 +
853 +double:
854 + lsrs r5, r4, #1
855 + it cs
856 + movcs r6, r4
857 +
858 + lsls r4, r5, #1
859 + beq stack_double
860 +
861 + sub r4, r4, #2
862 + add lr, lr, #8
863 + tbb [pc, r5]
864 +
865 +double_table:
866 + .byte 0
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
875 + .align 2
876 +d0:
877 + vldr d0, [lr, #-8]
878 + b scan_sig
879 +d1:
880 + vldr d1, [lr, #-8]
881 + b scan_sig
882 +d2:
883 + vldr d2, [lr, #-8]
884 + b scan_sig
885 +d3:
886 + vldr d3, [lr, #-8]
887 + b scan_sig
888 +d4:
889 + vldr d4, [lr, #-8]
890 + b scan_sig
891 +d5:
892 + vldr d5, [lr, #-8]
893 + b scan_sig
894 +d6:
895 + vldr d6, [lr, #-8]
896 + b scan_sig
897 +d7:
898 + vldr d7, [lr, #-8]
899 + b scan_sig
900 +
901 +stack_double:
902 + mov r6, #0
903 +
904 +stack_long:
905 + /* Ensure address is 8 byte aligned */
906 + add ip, ip, #7
907 + bic ip, ip, #7
908 +
909 + ldr r5, [lr], #4
910 + str r5, [ip], #4
911 + ldr r5, [lr], #4
912 + str r5, [ip], #4
913 + b scan_sig
914 +
915 +done:
916 + /* Call the function */
917 + blx r11
918 +
919 + add sp, sp, r10 /* Pop argument area */
920 +
921 + ldr r4, [sp, #32] /* Reload ostack for */
922 + /* address of return value */
923 +
924 + ldrb r5, [r8] /* Return type */
925 +
926 + cmp r5, #86 /* 'V' */
927 + beq return
928 +
929 + cmp r5, #68 /* 'D' */
930 + beq return_double
931 +
932 + cmp r5, #70 /* 'F' */
933 + beq return_float
934 +
935 + str r0, [r4], #4 /* Low word */
936 +
937 + cmp r5, #74 /* 'J' */
938 + it eq
939 + streq r1, [r4], #4 /* High word */
940 +
941 +return:
942 + mov r0, r4 /* return ostack */
943 + ldmfd sp!, {r4, r5, r6, r7, r8, r10, r11, lr}
944 + bx lr
945 +
946 +return_float:
947 + vstr s0, [r4]
948 + add r4, r4, #4
949 + b return
950 +
951 +return_double:
952 + vstr d0, [r4]
953 + add r4, r4, #8
954 + b return
955 diff --git a/src/os/linux/arm/callNativeEABIHardARM.S b/src/os/linux/arm/callNativeEABIHardARM.S
956 new file mode 100644
957 index 0000000..3a31acd
958 --- /dev/null
959 +++ b/src/os/linux/arm/callNativeEABIHardARM.S
960 @@ -0,0 +1,266 @@
961 +/*
962 + * Copyright (C) 2011, 2012 Robert Lougher <rob@jamvm.org.uk>.
963 + *
964 + * This file is part of JamVM.
965 + *
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.
970 + *
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.
975 + *
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.
979 + */
980 +
981 + .text
982 + .align 2
983 + .global callJNIMethod
984 + .type callJNIMethod,function
985 +
986 +/*
987 + * Arguments passed in:
988 + *
989 + * r0 JNIEnv
990 + * r1 class or NULL
991 + * r2 sig
992 + * r3 extra arg
993 + * sp + 0 ostack
994 + * sp + 4 function pntr
995 + * sp + 8 args count
996 + */
997 +
998 +/* Register usage :
999 + *
1000 + * lr ostack pntr
1001 + * ip scratch
1002 + * r11 function pntr
1003 + * r10 fp backfill
1004 + * r8 fp reg
1005 + * r7 int reg
1006 + * r6 args pntr
1007 + * r5 sig pntr
1008 + * r4 extra stack
1009 + * r3, r2 outgoing int args
1010 + * r1 outgoing class or this pntr
1011 + * r0 outgoing JNIEnv (as passed in)
1012 + *
1013 + * s0 - s16 (d0 - d7) outgoing float args
1014 + */
1015 +
1016 +callJNIMethod:
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 */
1020 +
1021 + cmp r1, #0 /* is method non-static? */
1022 + ldreq r1, [lr], #4 /* yes, load r1 with "this" */
1023 +
1024 + mov r4, r3
1025 + sub sp, sp, r4 /* allocate room for stacked */
1026 + add r5, r2, #1 /* init sig pntr -- skipping '(' */
1027 +
1028 + mov r6, sp /* init loop pntr */
1029 +
1030 + mov r7, #2
1031 + mov r8, #16
1032 + mov r10, #0
1033 +
1034 +scan_sig:
1035 + ldrb ip, [r5], #1
1036 +
1037 + cmp ip, #41 /* ')' */
1038 + beq done
1039 +
1040 + cmp ip, #70 /* 'F' */
1041 + beq float
1042 +
1043 + cmp ip, #68 /* 'D' */
1044 + beq double
1045 +
1046 + cmp ip, #74 /* 'J' */
1047 + beq long
1048 +
1049 +skip_brackets:
1050 + cmp ip, #91 /* '[' */
1051 + ldreqb ip, [r5], #1
1052 + beq skip_brackets
1053 +
1054 + cmp ip, #76 /* 'L' */
1055 + bne int
1056 +
1057 +skip_ref:
1058 + ldrb ip, [r5], #1
1059 + cmp ip, #59 /* ';' */
1060 + bne skip_ref
1061 +
1062 +int:
1063 + cmp r7, #0
1064 + beq stack_int
1065 +
1066 + subs r7, r7, #1
1067 +
1068 + ldrne r2, [lr], #4
1069 + ldreq r3, [lr], #4
1070 +
1071 + b scan_sig
1072 +
1073 +stack_int:
1074 + ldr ip, [lr], #4
1075 + str ip, [r6], #4
1076 + b scan_sig
1077 +
1078 +float:
1079 + cmp r10, #0
1080 + beq no_backfill
1081 +
1082 + sub ip, r10, #1
1083 + mov r10, #0
1084 + b load_float
1085 +
1086 +no_backfill:
1087 + cmp r8, #0
1088 + beq stack_int
1089 +
1090 + sub r8, r8, #1
1091 + mov ip, r8
1092 +
1093 +load_float:
1094 + add lr, lr, #4
1095 + add pc, pc, ip, lsl #3
1096 + nop
1097 +
1098 + flds s15, [lr, #-4]
1099 + b scan_sig
1100 + flds s14, [lr, #-4]
1101 + b scan_sig
1102 + flds s13, [lr, #-4]
1103 + b scan_sig
1104 + flds s12, [lr, #-4]
1105 + b scan_sig
1106 + flds s11, [lr, #-4]
1107 + b scan_sig
1108 + flds s10, [lr, #-4]
1109 + b scan_sig
1110 + flds s9, [lr, #-4]
1111 + b scan_sig
1112 + flds s8, [lr, #-4]
1113 + b scan_sig
1114 + flds s7, [lr, #-4]
1115 + b scan_sig
1116 + flds s6, [lr, #-4]
1117 + b scan_sig
1118 + flds s5, [lr, #-4]
1119 + b scan_sig
1120 + flds s4, [lr, #-4]
1121 + b scan_sig
1122 + flds s3, [lr, #-4]
1123 + b scan_sig
1124 + flds s2, [lr, #-4]
1125 + b scan_sig
1126 + flds s1, [lr, #-4]
1127 + b scan_sig
1128 + flds s0, [lr, #-4]
1129 + b scan_sig
1130 +
1131 +long:
1132 + cmp r7, #2
1133 + mov r7, #0
1134 + bne stack_long
1135 +
1136 + ldr r2, [lr], #4
1137 + ldr r3, [lr], #4
1138 + b scan_sig
1139 +
1140 +double:
1141 + lsrs ip, r8, #1
1142 + movcs r10, r8
1143 +
1144 + lsls r8, ip, #1
1145 + beq stack_double
1146 +
1147 + sub r8, r8, #2
1148 + add lr, lr, #8
1149 + add pc, pc, ip, lsl #3
1150 + nop
1151 + nop
1152 + nop
1153 +
1154 + fldd d7, [lr, #-8]
1155 + b scan_sig
1156 + fldd d6, [lr, #-8]
1157 + b scan_sig
1158 + fldd d5, [lr, #-8]
1159 + b scan_sig
1160 + fldd d4, [lr, #-8]
1161 + b scan_sig
1162 + fldd d3, [lr, #-8]
1163 + b scan_sig
1164 + fldd d2, [lr, #-8]
1165 + b scan_sig
1166 + fldd d1, [lr, #-8]
1167 + b scan_sig
1168 + fldd d0, [lr, #-8]
1169 + b scan_sig
1170 +
1171 +stack_double:
1172 + mov r10, #0
1173 +
1174 +stack_long:
1175 + /* Ensure address is 8 byte aligned */
1176 + add r6, r6, #7
1177 + bic r6, r6, #7
1178 +
1179 + ldr ip, [lr], #4
1180 + str ip, [r6], #4
1181 + ldr ip, [lr], #4
1182 + str ip, [r6], #4
1183 + b scan_sig
1184 +
1185 +done:
1186 + /* Call the function */
1187 +#if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__)
1188 + mov lr, pc
1189 + bx r11
1190 +#else
1191 + blx r11
1192 +#endif
1193 +
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 */
1198 +
1199 + cmp ip, #86 /* 'V' */
1200 + beq return
1201 +
1202 + cmp ip, #68 /* 'D' */
1203 + beq return_double
1204 +
1205 + cmp ip, #70 /* 'F' */
1206 + beq return_float
1207 +
1208 + str r0, [r4], #4 /* Low word */
1209 +
1210 + cmp ip, #74 /* 'J' */
1211 + streq r1, [r4], #4 /* High word */
1212 +
1213 +return:
1214 + mov r0, r4 /* return ostack */
1215 + ldmfd sp!, {r4, r5, r6, r7, r8, r10, r11, lr}
1216 + bx lr
1217 +
1218 +return_float:
1219 + add r4, r4, #4
1220 + fsts s0, [r4, #-4]
1221 + b return
1222 +
1223 +return_double:
1224 + add r4, r4, #8
1225 + fstd d0, [r4, #-8]
1226 + b return
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
1231 @@ -1,6 +1,6 @@
1232 /*
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>.
1237 *
1238 * This file is part of JamVM.
1239 *
1240 @@ -31,6 +31,61 @@
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. */
1244 +
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;
1250 + int int_args = 2;
1251 + int fp_args = 16;
1252 +
1253 + while(*++sig != ')')
1254 + switch(*sig) {
1255 + case 'J':
1256 + if(int_args < 2)
1257 + stack_args = (stack_args + 15) & ~7;
1258 + int_args = 0;
1259 + break;
1260 +
1261 + case 'D':
1262 + fp_backfill |= fp_args & 1;
1263 + fp_args &= ~1;
1264 +
1265 + if(fp_args == 0) {
1266 + stack_args = (stack_args + 15) & ~7;
1267 + fp_backfill = 0;
1268 + } else
1269 + fp_args -= 2;
1270 + break;
1271 +
1272 + case 'F':
1273 + if(fp_backfill)
1274 + fp_backfill = 0;
1275 + else {
1276 + if(fp_args == 0)
1277 + stack_args += 4;
1278 + else
1279 + fp_args--;
1280 + }
1281 + break;
1282 +
1283 + default:
1284 + if(int_args == 0)
1285 + stack_args += 4;
1286 + else
1287 + int_args--;
1288 +
1289 + if(*sig == '[')
1290 + while(*++sig == '[');
1291 + if(*sig == 'L')
1292 + while(*++sig != ';');
1293 + break;
1294 + }
1295 +
1296 + return (stack_args + 7) & ~7;
1297 +}
1298 +#else
1299 int nativeExtraArg(MethodBlock *mb) {
1300 char *sig = mb->type;
1301 int args = 0;
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;
1305 }
1306 -
1307 +#endif
1308 #else
1309
1310 /* Under OABI, arguments can be copied onto the stack "as is"
1311 --
1312 2.17.1
1313