author | Wolfgang Rosenauer <wr@rosenauer.org> |
Sun, 16 Mar 2014 10:38:59 +0100 | |
changeset 710 | 5341dc98d26c |
permissions | -rw-r--r-- |
710
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1 |
# HG changeset patch |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2 |
# Parent 16cf73a02802e3b4a77ccd77794346441638e2a7 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3 |
# User Ulrich Weigand <uweigand@de.ibm.com> |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
4 |
Bug 976648 - powerpc64le-linux support - libffi backport |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
5 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
6 |
diff --git a/js/src/ctypes/libffi/aclocal.m4 b/js/src/ctypes/libffi/aclocal.m4 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
7 |
--- a/js/src/ctypes/libffi/aclocal.m4 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
8 |
+++ b/js/src/ctypes/libffi/aclocal.m4 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
9 |
@@ -1277,31 +1277,34 @@ ia64-*-hpux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
10 |
LD="${LD-ld} -64" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
11 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
12 |
esac |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
13 |
fi |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
14 |
fi |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
15 |
rm -rf conftest* |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
16 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
17 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
18 |
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
19 |
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
20 |
s390*-*linux*|s390*-*tpf*|sparc*-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
21 |
# Find out which ABI we are using. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
22 |
echo 'int i;' > conftest.$ac_ext |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
23 |
if AC_TRY_EVAL(ac_compile); then |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
24 |
case `/usr/bin/file conftest.o` in |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
25 |
*32-bit*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
26 |
case $host in |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
27 |
x86_64-*kfreebsd*-gnu) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
28 |
LD="${LD-ld} -m elf_i386_fbsd" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
29 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
30 |
x86_64-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
31 |
LD="${LD-ld} -m elf_i386" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
32 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
33 |
- ppc64-*linux*|powerpc64-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
34 |
+ powerpc64le-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
35 |
+ LD="${LD-ld} -m elf32lppclinux" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
36 |
+ ;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
37 |
+ powerpc64-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
38 |
LD="${LD-ld} -m elf32ppclinux" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
39 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
40 |
s390x-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
41 |
LD="${LD-ld} -m elf_s390" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
42 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
43 |
sparc64-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
44 |
LD="${LD-ld} -m elf32_sparc" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
45 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
46 |
@@ -1310,17 +1313,20 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux* |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
47 |
*64-bit*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
48 |
case $host in |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
49 |
x86_64-*kfreebsd*-gnu) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
50 |
LD="${LD-ld} -m elf_x86_64_fbsd" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
51 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
52 |
x86_64-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
53 |
LD="${LD-ld} -m elf_x86_64" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
54 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
55 |
- ppc*-*linux*|powerpc*-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
56 |
+ powerpcle-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
57 |
+ LD="${LD-ld} -m elf64lppc" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
58 |
+ ;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
59 |
+ powerpc-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
60 |
LD="${LD-ld} -m elf64ppc" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
61 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
62 |
s390*-*linux*|s390*-*tpf*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
63 |
LD="${LD-ld} -m elf64_s390" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
64 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
65 |
sparc*-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
66 |
LD="${LD-ld} -m elf64_sparc" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
67 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
68 |
diff --git a/js/src/ctypes/libffi/configure b/js/src/ctypes/libffi/configure |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
69 |
--- a/js/src/ctypes/libffi/configure |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
70 |
+++ b/js/src/ctypes/libffi/configure |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
71 |
@@ -6293,17 +6293,17 @@ ia64-*-hpux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
72 |
LD="${LD-ld} -64" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
73 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
74 |
esac |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
75 |
fi |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
76 |
fi |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
77 |
rm -rf conftest* |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
78 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
79 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
80 |
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
81 |
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
82 |
s390*-*linux*|s390*-*tpf*|sparc*-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
83 |
# Find out which ABI we are using. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
84 |
echo 'int i;' > conftest.$ac_ext |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
85 |
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
86 |
(eval $ac_compile) 2>&5 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
87 |
ac_status=$? |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
88 |
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
89 |
test $ac_status = 0; }; then |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
90 |
@@ -6311,17 +6311,20 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux* |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
91 |
*32-bit*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
92 |
case $host in |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
93 |
x86_64-*kfreebsd*-gnu) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
94 |
LD="${LD-ld} -m elf_i386_fbsd" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
95 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
96 |
x86_64-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
97 |
LD="${LD-ld} -m elf_i386" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
98 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
99 |
- ppc64-*linux*|powerpc64-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
100 |
+ powerpc64le-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
101 |
+ LD="${LD-ld} -m elf32lppclinux" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
102 |
+ ;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
103 |
+ powerpc64-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
104 |
LD="${LD-ld} -m elf32ppclinux" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
105 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
106 |
s390x-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
107 |
LD="${LD-ld} -m elf_s390" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
108 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
109 |
sparc64-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
110 |
LD="${LD-ld} -m elf32_sparc" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
111 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
112 |
@@ -6330,17 +6333,20 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux* |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
113 |
*64-bit*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
114 |
case $host in |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
115 |
x86_64-*kfreebsd*-gnu) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
116 |
LD="${LD-ld} -m elf_x86_64_fbsd" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
117 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
118 |
x86_64-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
119 |
LD="${LD-ld} -m elf_x86_64" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
120 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
121 |
- ppc*-*linux*|powerpc*-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
122 |
+ powerpcle-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
123 |
+ LD="${LD-ld} -m elf64lppc" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
124 |
+ ;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
125 |
+ powerpc-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
126 |
LD="${LD-ld} -m elf64ppc" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
127 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
128 |
s390*-*linux*|s390*-*tpf*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
129 |
LD="${LD-ld} -m elf64_s390" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
130 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
131 |
sparc*-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
132 |
LD="${LD-ld} -m elf64_sparc" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
133 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
134 |
diff --git a/js/src/ctypes/libffi/m4/libtool.m4 b/js/src/ctypes/libffi/m4/libtool.m4 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
135 |
--- a/js/src/ctypes/libffi/m4/libtool.m4 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
136 |
+++ b/js/src/ctypes/libffi/m4/libtool.m4 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
137 |
@@ -1262,31 +1262,34 @@ ia64-*-hpux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
138 |
LD="${LD-ld} -64" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
139 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
140 |
esac |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
141 |
fi |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
142 |
fi |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
143 |
rm -rf conftest* |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
144 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
145 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
146 |
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
147 |
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
148 |
s390*-*linux*|s390*-*tpf*|sparc*-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
149 |
# Find out which ABI we are using. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
150 |
echo 'int i;' > conftest.$ac_ext |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
151 |
if AC_TRY_EVAL(ac_compile); then |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
152 |
case `/usr/bin/file conftest.o` in |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
153 |
*32-bit*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
154 |
case $host in |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
155 |
x86_64-*kfreebsd*-gnu) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
156 |
LD="${LD-ld} -m elf_i386_fbsd" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
157 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
158 |
x86_64-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
159 |
LD="${LD-ld} -m elf_i386" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
160 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
161 |
- ppc64-*linux*|powerpc64-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
162 |
+ powerpc64le-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
163 |
+ LD="${LD-ld} -m elf32lppclinux" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
164 |
+ ;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
165 |
+ powerpc64-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
166 |
LD="${LD-ld} -m elf32ppclinux" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
167 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
168 |
s390x-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
169 |
LD="${LD-ld} -m elf_s390" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
170 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
171 |
sparc64-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
172 |
LD="${LD-ld} -m elf32_sparc" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
173 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
174 |
@@ -1295,17 +1298,20 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux* |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
175 |
*64-bit*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
176 |
case $host in |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
177 |
x86_64-*kfreebsd*-gnu) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
178 |
LD="${LD-ld} -m elf_x86_64_fbsd" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
179 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
180 |
x86_64-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
181 |
LD="${LD-ld} -m elf_x86_64" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
182 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
183 |
- ppc*-*linux*|powerpc*-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
184 |
+ powerpcle-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
185 |
+ LD="${LD-ld} -m elf64lppc" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
186 |
+ ;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
187 |
+ powerpc-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
188 |
LD="${LD-ld} -m elf64ppc" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
189 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
190 |
s390*-*linux*|s390*-*tpf*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
191 |
LD="${LD-ld} -m elf64_s390" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
192 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
193 |
sparc*-*linux*) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
194 |
LD="${LD-ld} -m elf64_sparc" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
195 |
;; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
196 |
diff --git a/js/src/ctypes/libffi/src/powerpc/ffi.c b/js/src/ctypes/libffi/src/powerpc/ffi.c |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
197 |
--- a/js/src/ctypes/libffi/src/powerpc/ffi.c |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
198 |
+++ b/js/src/ctypes/libffi/src/powerpc/ffi.c |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
199 |
@@ -1,12 +1,14 @@ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
200 |
/* ----------------------------------------------------------------------- |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
201 |
- ffi.c - Copyright (c) 1998 Geoffrey Keating |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
202 |
- Copyright (C) 2007, 2008 Free Software Foundation, Inc |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
203 |
- Copyright (C) 2008 Red Hat, Inc |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
204 |
+ ffi.c - Copyright (C) 2011 Anthony Green |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
205 |
+ Copyright (C) 2011 Kyle Moffett |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
206 |
+ Copyright (C) 2008 Red Hat, Inc |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
207 |
+ Copyright (C) 2007, 2008 Free Software Foundation, Inc |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
208 |
+ Copyright (c) 1998 Geoffrey Keating |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
209 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
210 |
PowerPC Foreign Function Interface |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
211 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
212 |
Permission is hereby granted, free of charge, to any person obtaining |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
213 |
a copy of this software and associated documentation files (the |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
214 |
``Software''), to deal in the Software without restriction, including |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
215 |
without limitation the rights to use, copy, modify, merge, publish, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
216 |
distribute, sublicense, and/or sell copies of the Software, and to |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
217 |
@@ -34,42 +36,39 @@ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
218 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
219 |
extern void ffi_closure_SYSV (void); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
220 |
extern void FFI_HIDDEN ffi_closure_LINUX64 (void); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
221 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
222 |
enum { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
223 |
/* The assembly depends on these exact flags. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
224 |
FLAG_RETURNS_SMST = 1 << (31-31), /* Used for FFI_SYSV small structs. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
225 |
FLAG_RETURNS_NOTHING = 1 << (31-30), /* These go in cr7 */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
226 |
+#ifndef __NO_FPRS__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
227 |
FLAG_RETURNS_FP = 1 << (31-29), |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
228 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
229 |
FLAG_RETURNS_64BITS = 1 << (31-28), |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
230 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
231 |
FLAG_RETURNS_128BITS = 1 << (31-27), /* cr6 */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
232 |
- FLAG_SYSV_SMST_R4 = 1 << (31-26), /* use r4 for FFI_SYSV 8 byte |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
233 |
- structs. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
234 |
- FLAG_SYSV_SMST_R3 = 1 << (31-25), /* use r3 for FFI_SYSV 4 byte |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
235 |
- structs. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
236 |
- /* Bits (31-24) through (31-19) store shift value for SMST */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
237 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
238 |
FLAG_ARG_NEEDS_COPY = 1 << (31- 7), |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
239 |
+ FLAG_ARG_NEEDS_PSAVE = FLAG_ARG_NEEDS_COPY, /* Used by ELFv2 */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
240 |
+#ifndef __NO_FPRS__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
241 |
FLAG_FP_ARGUMENTS = 1 << (31- 6), /* cr1.eq; specified by ABI */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
242 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
243 |
FLAG_4_GPR_ARGUMENTS = 1 << (31- 5), |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
244 |
FLAG_RETVAL_REFERENCE = 1 << (31- 4) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
245 |
}; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
246 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
247 |
/* About the SYSV ABI. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
248 |
-unsigned int NUM_GPR_ARG_REGISTERS = 8; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
249 |
+#define ASM_NEEDS_REGISTERS 4 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
250 |
+#define NUM_GPR_ARG_REGISTERS 8 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
251 |
#ifndef __NO_FPRS__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
252 |
-unsigned int NUM_FPR_ARG_REGISTERS = 8; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
253 |
-#else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
254 |
-unsigned int NUM_FPR_ARG_REGISTERS = 0; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
255 |
+# define NUM_FPR_ARG_REGISTERS 8 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
256 |
#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
257 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
258 |
-enum { ASM_NEEDS_REGISTERS = 4 }; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
259 |
- |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
260 |
/* ffi_prep_args_SYSV is called by the assembly routine once stack space |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
261 |
has been allocated for the function's arguments. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
262 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
263 |
The stack layout we want looks like this: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
264 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
265 |
| Return address from ffi_call_SYSV 4bytes | higher addresses |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
266 |
|--------------------------------------------| |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
267 |
| Previous backchain pointer 4 | stack pointer here |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
268 |
@@ -108,100 +107,119 @@ ffi_prep_args_SYSV (extended_cif *ecif, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
269 |
/* 'stacktop' points at the previous backchain pointer. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
270 |
valp stacktop; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
271 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
272 |
/* 'gpr_base' points at the space for gpr3, and grows upwards as |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
273 |
we use GPR registers. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
274 |
valp gpr_base; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
275 |
int intarg_count; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
276 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
277 |
+#ifndef __NO_FPRS__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
278 |
/* 'fpr_base' points at the space for fpr1, and grows upwards as |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
279 |
we use FPR registers. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
280 |
valp fpr_base; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
281 |
int fparg_count; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
282 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
283 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
284 |
/* 'copy_space' grows down as we put structures in it. It should |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
285 |
stay 16-byte aligned. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
286 |
valp copy_space; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
287 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
288 |
/* 'next_arg' grows up as we put parameters in it. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
289 |
valp next_arg; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
290 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
291 |
- int i, ii MAYBE_UNUSED; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
292 |
+ int i; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
293 |
ffi_type **ptr; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
294 |
+#ifndef __NO_FPRS__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
295 |
double double_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
296 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
297 |
union { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
298 |
void **v; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
299 |
char **c; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
300 |
signed char **sc; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
301 |
unsigned char **uc; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
302 |
signed short **ss; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
303 |
unsigned short **us; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
304 |
unsigned int **ui; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
305 |
long long **ll; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
306 |
float **f; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
307 |
double **d; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
308 |
} p_argv; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
309 |
size_t struct_copy_size; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
310 |
unsigned gprvalue; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
311 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
312 |
- if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
313 |
- NUM_FPR_ARG_REGISTERS = 0; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
314 |
- |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
315 |
stacktop.c = (char *) stack + bytes; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
316 |
gpr_base.u = stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
317 |
intarg_count = 0; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
318 |
+#ifndef __NO_FPRS__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
319 |
fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
320 |
fparg_count = 0; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
321 |
copy_space.c = ((flags & FLAG_FP_ARGUMENTS) ? fpr_base.c : gpr_base.c); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
322 |
+#else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
323 |
+ copy_space.c = gpr_base.c; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
324 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
325 |
next_arg.u = stack + 2; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
326 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
327 |
/* Check that everything starts aligned properly. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
328 |
- FFI_ASSERT (((unsigned) (char *) stack & 0xF) == 0); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
329 |
- FFI_ASSERT (((unsigned) copy_space.c & 0xF) == 0); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
330 |
- FFI_ASSERT (((unsigned) stacktop.c & 0xF) == 0); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
331 |
+ FFI_ASSERT (((unsigned long) (char *) stack & 0xF) == 0); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
332 |
+ FFI_ASSERT (((unsigned long) copy_space.c & 0xF) == 0); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
333 |
+ FFI_ASSERT (((unsigned long) stacktop.c & 0xF) == 0); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
334 |
FFI_ASSERT ((bytes & 0xF) == 0); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
335 |
FFI_ASSERT (copy_space.c >= next_arg.c); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
336 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
337 |
/* Deal with return values that are actually pass-by-reference. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
338 |
if (flags & FLAG_RETVAL_REFERENCE) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
339 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
340 |
*gpr_base.u++ = (unsigned long) (char *) ecif->rvalue; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
341 |
intarg_count++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
342 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
343 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
344 |
/* Now for the arguments. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
345 |
p_argv.v = ecif->avalue; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
346 |
for (ptr = ecif->cif->arg_types, i = ecif->cif->nargs; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
347 |
i > 0; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
348 |
i--, ptr++, p_argv.v++) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
349 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
350 |
- switch ((*ptr)->type) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
351 |
- { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
352 |
+ unsigned short typenum = (*ptr)->type; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
353 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
354 |
+ /* We may need to handle some values depending on ABI */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
355 |
+ if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
356 |
+ if (typenum == FFI_TYPE_FLOAT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
357 |
+ typenum = FFI_TYPE_UINT32; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
358 |
+ if (typenum == FFI_TYPE_DOUBLE) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
359 |
+ typenum = FFI_TYPE_UINT64; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
360 |
+ if (typenum == FFI_TYPE_LONGDOUBLE) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
361 |
+ typenum = FFI_TYPE_UINT128; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
362 |
+ } else if (ecif->cif->abi != FFI_LINUX) { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
363 |
+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
364 |
+ if (typenum == FFI_TYPE_LONGDOUBLE) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
365 |
+ typenum = FFI_TYPE_STRUCT; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
366 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
367 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
368 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
369 |
+ /* Now test the translated value */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
370 |
+ switch (typenum) { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
371 |
+#ifndef __NO_FPRS__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
372 |
case FFI_TYPE_FLOAT: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
373 |
/* With FFI_LINUX_SOFT_FLOAT floats are handled like UINT32. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
374 |
- if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
375 |
- goto soft_float_prep; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
376 |
double_tmp = **p_argv.f; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
377 |
if (fparg_count >= NUM_FPR_ARG_REGISTERS) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
378 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
379 |
*next_arg.f = (float) double_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
380 |
next_arg.u += 1; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
381 |
intarg_count++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
382 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
383 |
else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
384 |
*fpr_base.d++ = double_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
385 |
fparg_count++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
386 |
FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
387 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
388 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
389 |
case FFI_TYPE_DOUBLE: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
390 |
/* With FFI_LINUX_SOFT_FLOAT doubles are handled like UINT64. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
391 |
- if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
392 |
- goto soft_double_prep; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
393 |
double_tmp = **p_argv.d; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
394 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
395 |
if (fparg_count >= NUM_FPR_ARG_REGISTERS) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
396 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
397 |
if (intarg_count >= NUM_GPR_ARG_REGISTERS |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
398 |
&& intarg_count % 2 != 0) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
399 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
400 |
intarg_count++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
401 |
@@ -213,53 +231,16 @@ ffi_prep_args_SYSV (extended_cif *ecif, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
402 |
else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
403 |
*fpr_base.d++ = double_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
404 |
fparg_count++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
405 |
FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
406 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
407 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
408 |
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
409 |
case FFI_TYPE_LONGDOUBLE: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
410 |
- if ((ecif->cif->abi != FFI_LINUX) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
411 |
- && (ecif->cif->abi != FFI_LINUX_SOFT_FLOAT)) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
412 |
- goto do_struct; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
413 |
- /* The soft float ABI for long doubles works like this, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
414 |
- a long double is passed in four consecutive gprs if available. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
415 |
- A maximum of 2 long doubles can be passed in gprs. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
416 |
- If we do not have 4 gprs left, the long double is passed on the |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
417 |
- stack, 4-byte aligned. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
418 |
- if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
419 |
- { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
420 |
- unsigned int int_tmp = (*p_argv.ui)[0]; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
421 |
- if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
422 |
- { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
423 |
- if (intarg_count < NUM_GPR_ARG_REGISTERS) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
424 |
- intarg_count += NUM_GPR_ARG_REGISTERS - intarg_count; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
425 |
- *next_arg.u = int_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
426 |
- next_arg.u++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
427 |
- for (ii = 1; ii < 4; ii++) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
428 |
- { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
429 |
- int_tmp = (*p_argv.ui)[ii]; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
430 |
- *next_arg.u = int_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
431 |
- next_arg.u++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
432 |
- } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
433 |
- } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
434 |
- else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
435 |
- { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
436 |
- *gpr_base.u++ = int_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
437 |
- for (ii = 1; ii < 4; ii++) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
438 |
- { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
439 |
- int_tmp = (*p_argv.ui)[ii]; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
440 |
- *gpr_base.u++ = int_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
441 |
- } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
442 |
- } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
443 |
- intarg_count +=4; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
444 |
- } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
445 |
- else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
446 |
- { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
447 |
double_tmp = (*p_argv.d)[0]; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
448 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
449 |
if (fparg_count >= NUM_FPR_ARG_REGISTERS - 1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
450 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
451 |
if (intarg_count >= NUM_GPR_ARG_REGISTERS |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
452 |
&& intarg_count % 2 != 0) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
453 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
454 |
intarg_count++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
455 |
@@ -275,23 +256,50 @@ ffi_prep_args_SYSV (extended_cif *ecif, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
456 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
457 |
*fpr_base.d++ = double_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
458 |
double_tmp = (*p_argv.d)[1]; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
459 |
*fpr_base.d++ = double_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
460 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
461 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
462 |
fparg_count += 2; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
463 |
FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
464 |
- } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
465 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
466 |
#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
467 |
+#endif /* have FPRs */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
468 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
469 |
+ /* |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
470 |
+ * The soft float ABI for long doubles works like this, a long double |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
471 |
+ * is passed in four consecutive GPRs if available. A maximum of 2 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
472 |
+ * long doubles can be passed in gprs. If we do not have 4 GPRs |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
473 |
+ * left, the long double is passed on the stack, 4-byte aligned. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
474 |
+ */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
475 |
+ case FFI_TYPE_UINT128: { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
476 |
+ unsigned int int_tmp = (*p_argv.ui)[0]; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
477 |
+ unsigned int ii; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
478 |
+ if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3) { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
479 |
+ if (intarg_count < NUM_GPR_ARG_REGISTERS) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
480 |
+ intarg_count += NUM_GPR_ARG_REGISTERS - intarg_count; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
481 |
+ *(next_arg.u++) = int_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
482 |
+ for (ii = 1; ii < 4; ii++) { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
483 |
+ int_tmp = (*p_argv.ui)[ii]; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
484 |
+ *(next_arg.u++) = int_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
485 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
486 |
+ } else { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
487 |
+ *(gpr_base.u++) = int_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
488 |
+ for (ii = 1; ii < 4; ii++) { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
489 |
+ int_tmp = (*p_argv.ui)[ii]; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
490 |
+ *(gpr_base.u++) = int_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
491 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
492 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
493 |
+ intarg_count += 4; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
494 |
+ break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
495 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
496 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
497 |
case FFI_TYPE_UINT64: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
498 |
case FFI_TYPE_SINT64: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
499 |
- soft_double_prep: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
500 |
if (intarg_count == NUM_GPR_ARG_REGISTERS-1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
501 |
intarg_count++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
502 |
if (intarg_count >= NUM_GPR_ARG_REGISTERS) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
503 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
504 |
if (intarg_count % 2 != 0) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
505 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
506 |
intarg_count++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
507 |
next_arg.u++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
508 |
@@ -314,19 +322,16 @@ ffi_prep_args_SYSV (extended_cif *ecif, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
509 |
gpr_base.u++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
510 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
511 |
*gpr_base.ll++ = **p_argv.ll; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
512 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
513 |
intarg_count += 2; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
514 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
515 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
516 |
case FFI_TYPE_STRUCT: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
517 |
-#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
518 |
- do_struct: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
519 |
-#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
520 |
struct_copy_size = ((*ptr)->size + 15) & ~0xF; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
521 |
copy_space.c -= struct_copy_size; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
522 |
memcpy (copy_space.c, *p_argv.c, (*ptr)->size); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
523 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
524 |
gprvalue = (unsigned long) copy_space.c; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
525 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
526 |
FFI_ASSERT (copy_space.c > next_arg.c); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
527 |
FFI_ASSERT (flags & FLAG_ARG_NEEDS_COPY); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
528 |
@@ -344,45 +349,91 @@ ffi_prep_args_SYSV (extended_cif *ecif, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
529 |
case FFI_TYPE_SINT16: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
530 |
gprvalue = **p_argv.ss; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
531 |
goto putgpr; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
532 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
533 |
case FFI_TYPE_INT: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
534 |
case FFI_TYPE_UINT32: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
535 |
case FFI_TYPE_SINT32: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
536 |
case FFI_TYPE_POINTER: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
537 |
- soft_float_prep: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
538 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
539 |
gprvalue = **p_argv.ui; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
540 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
541 |
putgpr: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
542 |
if (intarg_count >= NUM_GPR_ARG_REGISTERS) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
543 |
*next_arg.u++ = gprvalue; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
544 |
else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
545 |
*gpr_base.u++ = gprvalue; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
546 |
intarg_count++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
547 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
548 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
549 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
550 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
551 |
/* Check that we didn't overrun the stack... */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
552 |
FFI_ASSERT (copy_space.c >= next_arg.c); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
553 |
FFI_ASSERT (gpr_base.u <= stacktop.u - ASM_NEEDS_REGISTERS); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
554 |
+ /* The assert below is testing that the number of integer arguments agrees |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
555 |
+ with the number found in ffi_prep_cif_machdep(). However, intarg_count |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
556 |
+ is incremented whenever we place an FP arg on the stack, so account for |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
557 |
+ that before our assert test. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
558 |
+#ifndef __NO_FPRS__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
559 |
+ if (fparg_count > NUM_FPR_ARG_REGISTERS) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
560 |
+ intarg_count -= fparg_count - NUM_FPR_ARG_REGISTERS; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
561 |
FFI_ASSERT (fpr_base.u |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
562 |
<= stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
563 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
564 |
FFI_ASSERT (flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
565 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
566 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
567 |
/* About the LINUX64 ABI. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
568 |
enum { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
569 |
NUM_GPR_ARG_REGISTERS64 = 8, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
570 |
NUM_FPR_ARG_REGISTERS64 = 13 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
571 |
}; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
572 |
enum { ASM_NEEDS_REGISTERS64 = 4 }; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
573 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
574 |
+#if _CALL_ELF == 2 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
575 |
+static unsigned int |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
576 |
+discover_homogeneous_aggregate (const ffi_type *t, unsigned int *elnum) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
577 |
+{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
578 |
+ switch (t->type) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
579 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
580 |
+ case FFI_TYPE_FLOAT: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
581 |
+ case FFI_TYPE_DOUBLE: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
582 |
+ *elnum = 1; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
583 |
+ return (int) t->type; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
584 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
585 |
+ case FFI_TYPE_STRUCT:; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
586 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
587 |
+ unsigned int base_elt = 0, total_elnum = 0; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
588 |
+ ffi_type **el = t->elements; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
589 |
+ while (*el) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
590 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
591 |
+ unsigned int el_elt, el_elnum = 0; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
592 |
+ el_elt = discover_homogeneous_aggregate (*el, &el_elnum); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
593 |
+ if (el_elt == 0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
594 |
+ || (base_elt && base_elt != el_elt)) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
595 |
+ return 0; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
596 |
+ base_elt = el_elt; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
597 |
+ total_elnum += el_elnum; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
598 |
+ if (total_elnum > 8) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
599 |
+ return 0; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
600 |
+ el++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
601 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
602 |
+ *elnum = total_elnum; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
603 |
+ return base_elt; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
604 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
605 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
606 |
+ default: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
607 |
+ return 0; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
608 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
609 |
+} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
610 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
611 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
612 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
613 |
/* ffi_prep_args64 is called by the assembly routine once stack space |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
614 |
has been allocated for the function's arguments. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
615 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
616 |
The stack layout we want looks like this: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
617 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
618 |
| Ret addr from ffi_call_LINUX64 8bytes | higher addresses |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
619 |
|--------------------------------------------| |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
620 |
| CR save area 8bytes | |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
621 |
@@ -418,141 +469,216 @@ ffi_prep_args64 (extended_cif *ecif, uns |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
622 |
const unsigned long bytes = ecif->cif->bytes; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
623 |
const unsigned long flags = ecif->cif->flags; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
624 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
625 |
typedef union { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
626 |
char *c; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
627 |
unsigned long *ul; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
628 |
float *f; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
629 |
double *d; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
630 |
+ size_t p; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
631 |
} valp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
632 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
633 |
/* 'stacktop' points at the previous backchain pointer. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
634 |
valp stacktop; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
635 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
636 |
/* 'next_arg' points at the space for gpr3, and grows upwards as |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
637 |
we use GPR registers, then continues at rest. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
638 |
valp gpr_base; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
639 |
valp gpr_end; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
640 |
valp rest; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
641 |
valp next_arg; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
642 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
643 |
/* 'fpr_base' points at the space for fpr3, and grows upwards as |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
644 |
we use FPR registers. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
645 |
valp fpr_base; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
646 |
- int fparg_count; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
647 |
+ unsigned int fparg_count; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
648 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
649 |
- int i, words; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
650 |
+ unsigned int i, words, nargs, nfixedargs; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
651 |
ffi_type **ptr; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
652 |
double double_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
653 |
union { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
654 |
void **v; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
655 |
char **c; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
656 |
signed char **sc; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
657 |
unsigned char **uc; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
658 |
signed short **ss; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
659 |
unsigned short **us; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
660 |
signed int **si; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
661 |
unsigned int **ui; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
662 |
unsigned long **ul; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
663 |
float **f; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
664 |
double **d; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
665 |
} p_argv; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
666 |
unsigned long gprvalue; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
667 |
+#ifdef __STRUCT_PARM_ALIGN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
668 |
+ unsigned long align; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
669 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
670 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
671 |
stacktop.c = (char *) stack + bytes; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
672 |
gpr_base.ul = stacktop.ul - ASM_NEEDS_REGISTERS64 - NUM_GPR_ARG_REGISTERS64; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
673 |
gpr_end.ul = gpr_base.ul + NUM_GPR_ARG_REGISTERS64; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
674 |
+#if _CALL_ELF == 2 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
675 |
+ rest.ul = stack + 4 + NUM_GPR_ARG_REGISTERS64; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
676 |
+#else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
677 |
rest.ul = stack + 6 + NUM_GPR_ARG_REGISTERS64; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
678 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
679 |
fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS64; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
680 |
fparg_count = 0; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
681 |
next_arg.ul = gpr_base.ul; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
682 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
683 |
/* Check that everything starts aligned properly. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
684 |
FFI_ASSERT (((unsigned long) (char *) stack & 0xF) == 0); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
685 |
FFI_ASSERT (((unsigned long) stacktop.c & 0xF) == 0); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
686 |
FFI_ASSERT ((bytes & 0xF) == 0); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
687 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
688 |
/* Deal with return values that are actually pass-by-reference. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
689 |
if (flags & FLAG_RETVAL_REFERENCE) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
690 |
*next_arg.ul++ = (unsigned long) (char *) ecif->rvalue; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
691 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
692 |
/* Now for the arguments. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
693 |
p_argv.v = ecif->avalue; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
694 |
- for (ptr = ecif->cif->arg_types, i = ecif->cif->nargs; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
695 |
- i > 0; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
696 |
- i--, ptr++, p_argv.v++) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
697 |
+ nargs = ecif->cif->nargs; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
698 |
+ nfixedargs = ecif->cif->nfixedargs; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
699 |
+ for (ptr = ecif->cif->arg_types, i = 0; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
700 |
+ i < nargs; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
701 |
+ i++, ptr++, p_argv.v++) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
702 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
703 |
+ unsigned int elt, elnum; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
704 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
705 |
switch ((*ptr)->type) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
706 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
707 |
case FFI_TYPE_FLOAT: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
708 |
double_tmp = **p_argv.f; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
709 |
- *next_arg.f = (float) double_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
710 |
+ if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
711 |
+ *fpr_base.d++ = double_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
712 |
+ else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
713 |
+ *next_arg.f = (float) double_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
714 |
if (++next_arg.ul == gpr_end.ul) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
715 |
next_arg.ul = rest.ul; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
716 |
- if (fparg_count < NUM_FPR_ARG_REGISTERS64) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
717 |
- *fpr_base.d++ = double_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
718 |
fparg_count++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
719 |
FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
720 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
721 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
722 |
case FFI_TYPE_DOUBLE: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
723 |
double_tmp = **p_argv.d; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
724 |
- *next_arg.d = double_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
725 |
+ if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
726 |
+ *fpr_base.d++ = double_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
727 |
+ else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
728 |
+ *next_arg.d = double_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
729 |
if (++next_arg.ul == gpr_end.ul) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
730 |
next_arg.ul = rest.ul; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
731 |
- if (fparg_count < NUM_FPR_ARG_REGISTERS64) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
732 |
- *fpr_base.d++ = double_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
733 |
fparg_count++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
734 |
FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
735 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
736 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
737 |
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
738 |
case FFI_TYPE_LONGDOUBLE: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
739 |
double_tmp = (*p_argv.d)[0]; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
740 |
- *next_arg.d = double_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
741 |
+ if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
742 |
+ *fpr_base.d++ = double_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
743 |
+ else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
744 |
+ *next_arg.d = double_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
745 |
if (++next_arg.ul == gpr_end.ul) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
746 |
next_arg.ul = rest.ul; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
747 |
- if (fparg_count < NUM_FPR_ARG_REGISTERS64) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
748 |
- *fpr_base.d++ = double_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
749 |
fparg_count++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
750 |
double_tmp = (*p_argv.d)[1]; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
751 |
- *next_arg.d = double_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
752 |
+ if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
753 |
+ *fpr_base.d++ = double_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
754 |
+ else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
755 |
+ *next_arg.d = double_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
756 |
if (++next_arg.ul == gpr_end.ul) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
757 |
next_arg.ul = rest.ul; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
758 |
- if (fparg_count < NUM_FPR_ARG_REGISTERS64) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
759 |
- *fpr_base.d++ = double_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
760 |
fparg_count++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
761 |
FFI_ASSERT (__LDBL_MANT_DIG__ == 106); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
762 |
FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
763 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
764 |
#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
765 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
766 |
case FFI_TYPE_STRUCT: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
767 |
- words = ((*ptr)->size + 7) / 8; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
768 |
- if (next_arg.ul >= gpr_base.ul && next_arg.ul + words > gpr_end.ul) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
769 |
+#ifdef __STRUCT_PARM_ALIGN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
770 |
+ align = (*ptr)->alignment; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
771 |
+ if (align > __STRUCT_PARM_ALIGN__) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
772 |
+ align = __STRUCT_PARM_ALIGN__; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
773 |
+ if (align > 1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
774 |
+ next_arg.p = ALIGN (next_arg.p, align); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
775 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
776 |
+ elt = 0; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
777 |
+#if _CALL_ELF == 2 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
778 |
+ elt = discover_homogeneous_aggregate (*ptr, &elnum); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
779 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
780 |
+ if (elt) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
781 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
782 |
- size_t first = gpr_end.c - next_arg.c; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
783 |
- memcpy (next_arg.c, *p_argv.c, first); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
784 |
- memcpy (rest.c, *p_argv.c + first, (*ptr)->size - first); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
785 |
- next_arg.c = rest.c + words * 8 - first; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
786 |
+ union { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
787 |
+ void *v; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
788 |
+ float *f; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
789 |
+ double *d; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
790 |
+ } arg; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
791 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
792 |
+ arg.v = *p_argv.v; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
793 |
+ if (elt == FFI_TYPE_FLOAT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
794 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
795 |
+ do |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
796 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
797 |
+ double_tmp = *arg.f++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
798 |
+ if (fparg_count < NUM_FPR_ARG_REGISTERS64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
799 |
+ && i < nfixedargs) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
800 |
+ *fpr_base.d++ = double_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
801 |
+ else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
802 |
+ *next_arg.f = (float) double_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
803 |
+ if (++next_arg.f == gpr_end.f) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
804 |
+ next_arg.f = rest.f; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
805 |
+ fparg_count++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
806 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
807 |
+ while (--elnum != 0); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
808 |
+ if ((next_arg.p & 3) != 0) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
809 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
810 |
+ if (++next_arg.f == gpr_end.f) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
811 |
+ next_arg.f = rest.f; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
812 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
813 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
814 |
+ else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
815 |
+ do |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
816 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
817 |
+ double_tmp = *arg.d++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
818 |
+ if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
819 |
+ *fpr_base.d++ = double_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
820 |
+ else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
821 |
+ *next_arg.d = double_tmp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
822 |
+ if (++next_arg.d == gpr_end.d) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
823 |
+ next_arg.d = rest.d; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
824 |
+ fparg_count++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
825 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
826 |
+ while (--elnum != 0); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
827 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
828 |
else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
829 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
830 |
- char *where = next_arg.c; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
831 |
+ words = ((*ptr)->size + 7) / 8; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
832 |
+ if (next_arg.ul >= gpr_base.ul && next_arg.ul + words > gpr_end.ul) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
833 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
834 |
+ size_t first = gpr_end.c - next_arg.c; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
835 |
+ memcpy (next_arg.c, *p_argv.c, first); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
836 |
+ memcpy (rest.c, *p_argv.c + first, (*ptr)->size - first); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
837 |
+ next_arg.c = rest.c + words * 8 - first; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
838 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
839 |
+ else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
840 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
841 |
+ char *where = next_arg.c; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
842 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
843 |
- /* Structures with size less than eight bytes are passed |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
844 |
- left-padded. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
845 |
- if ((*ptr)->size < 8) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
846 |
- where += 8 - (*ptr)->size; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
847 |
- |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
848 |
- memcpy (where, *p_argv.c, (*ptr)->size); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
849 |
- next_arg.ul += words; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
850 |
- if (next_arg.ul == gpr_end.ul) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
851 |
- next_arg.ul = rest.ul; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
852 |
+#ifndef __LITTLE_ENDIAN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
853 |
+ /* Structures with size less than eight bytes are passed |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
854 |
+ left-padded. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
855 |
+ if ((*ptr)->size < 8) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
856 |
+ where += 8 - (*ptr)->size; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
857 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
858 |
+ memcpy (where, *p_argv.c, (*ptr)->size); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
859 |
+ next_arg.ul += words; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
860 |
+ if (next_arg.ul == gpr_end.ul) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
861 |
+ next_arg.ul = rest.ul; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
862 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
863 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
864 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
865 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
866 |
case FFI_TYPE_UINT8: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
867 |
gprvalue = **p_argv.uc; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
868 |
goto putgpr; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
869 |
case FFI_TYPE_SINT8: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
870 |
gprvalue = **p_argv.sc; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
871 |
@@ -586,53 +712,55 @@ ffi_prep_args64 (extended_cif *ecif, uns |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
872 |
FFI_ASSERT (flags & FLAG_4_GPR_ARGUMENTS |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
873 |
|| (next_arg.ul >= gpr_base.ul |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
874 |
&& next_arg.ul <= gpr_base.ul + 4)); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
875 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
876 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
877 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
878 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
879 |
/* Perform machine dependent cif processing */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
880 |
-ffi_status |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
881 |
-ffi_prep_cif_machdep (ffi_cif *cif) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
882 |
+static ffi_status |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
883 |
+ffi_prep_cif_machdep_core (ffi_cif *cif) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
884 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
885 |
/* All this is for the SYSV and LINUX64 ABI. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
886 |
- int i; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
887 |
ffi_type **ptr; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
888 |
unsigned bytes; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
889 |
- int fparg_count = 0, intarg_count = 0; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
890 |
- unsigned flags = 0; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
891 |
+ unsigned i, fparg_count = 0, intarg_count = 0; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
892 |
+ unsigned flags = cif->flags; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
893 |
unsigned struct_copy_size = 0; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
894 |
unsigned type = cif->rtype->type; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
895 |
unsigned size = cif->rtype->size; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
896 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
897 |
- if (cif->abi == FFI_LINUX_SOFT_FLOAT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
898 |
- NUM_FPR_ARG_REGISTERS = 0; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
899 |
- |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
900 |
+ /* The machine-independent calculation of cif->bytes doesn't work |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
901 |
+ for us. Redo the calculation. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
902 |
if (cif->abi != FFI_LINUX64) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
903 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
904 |
- /* All the machine-independent calculation of cif->bytes will be wrong. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
905 |
- Redo the calculation for SYSV. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
906 |
- |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
907 |
/* Space for the frame pointer, callee's LR, and the asm's temp regs. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
908 |
bytes = (2 + ASM_NEEDS_REGISTERS) * sizeof (int); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
909 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
910 |
/* Space for the GPR registers. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
911 |
bytes += NUM_GPR_ARG_REGISTERS * sizeof (int); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
912 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
913 |
else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
914 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
915 |
/* 64-bit ABI. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
916 |
+#if _CALL_ELF == 2 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
917 |
+ /* Space for backchain, CR, LR, TOC and the asm's temp regs. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
918 |
+ bytes = (4 + ASM_NEEDS_REGISTERS64) * sizeof (long); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
919 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
920 |
+ /* Space for the general registers. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
921 |
+ bytes += NUM_GPR_ARG_REGISTERS64 * sizeof (long); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
922 |
+#else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
923 |
/* Space for backchain, CR, LR, cc/ld doubleword, TOC and the asm's temp |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
924 |
regs. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
925 |
bytes = (6 + ASM_NEEDS_REGISTERS64) * sizeof (long); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
926 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
927 |
/* Space for the mandatory parm save area and general registers. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
928 |
bytes += 2 * NUM_GPR_ARG_REGISTERS64 * sizeof (long); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
929 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
930 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
931 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
932 |
/* Return value handling. The rules for SYSV are as follows: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
933 |
- 32-bit (or less) integer values are returned in gpr3; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
934 |
- Structures of size <= 4 bytes also returned in gpr3; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
935 |
- 64-bit integer values and structures between 5 and 8 bytes are returned |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
936 |
in gpr3 and gpr4; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
937 |
- Single/double FP values are returned in fpr1; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
938 |
@@ -641,71 +769,93 @@ ffi_prep_cif_machdep (ffi_cif *cif) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
939 |
- long doubles (if not equivalent to double) are returned in |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
940 |
fpr1,fpr2 for Linux and as for large structs for SysV. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
941 |
For LINUX64: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
942 |
- integer values in gpr3; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
943 |
- Structures/Unions by reference; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
944 |
- Single/double FP values in fpr1, long double in fpr1,fpr2. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
945 |
- soft-float float/doubles are treated as UINT32/UINT64 respectivley. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
946 |
- soft-float long doubles are returned in gpr3-gpr6. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
947 |
+ /* First translate for softfloat/nonlinux */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
948 |
+ if (cif->abi == FFI_LINUX_SOFT_FLOAT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
949 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
950 |
+ if (type == FFI_TYPE_FLOAT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
951 |
+ type = FFI_TYPE_UINT32; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
952 |
+ if (type == FFI_TYPE_DOUBLE) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
953 |
+ type = FFI_TYPE_UINT64; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
954 |
+ if (type == FFI_TYPE_LONGDOUBLE) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
955 |
+ type = FFI_TYPE_UINT128; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
956 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
957 |
+ else if (cif->abi != FFI_LINUX |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
958 |
+ && cif->abi != FFI_LINUX64) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
959 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
960 |
+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
961 |
+ if (type == FFI_TYPE_LONGDOUBLE) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
962 |
+ type = FFI_TYPE_STRUCT; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
963 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
964 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
965 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
966 |
switch (type) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
967 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
968 |
+#ifndef __NO_FPRS__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
969 |
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
970 |
case FFI_TYPE_LONGDOUBLE: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
971 |
- if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
972 |
- && cif->abi != FFI_LINUX_SOFT_FLOAT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
973 |
- goto byref; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
974 |
flags |= FLAG_RETURNS_128BITS; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
975 |
/* Fall through. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
976 |
#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
977 |
case FFI_TYPE_DOUBLE: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
978 |
flags |= FLAG_RETURNS_64BITS; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
979 |
/* Fall through. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
980 |
case FFI_TYPE_FLOAT: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
981 |
- /* With FFI_LINUX_SOFT_FLOAT no fp registers are used. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
982 |
- if (cif->abi != FFI_LINUX_SOFT_FLOAT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
983 |
- flags |= FLAG_RETURNS_FP; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
984 |
+ flags |= FLAG_RETURNS_FP; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
985 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
986 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
987 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
988 |
+ case FFI_TYPE_UINT128: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
989 |
+ flags |= FLAG_RETURNS_128BITS; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
990 |
+ /* Fall through. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
991 |
case FFI_TYPE_UINT64: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
992 |
case FFI_TYPE_SINT64: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
993 |
flags |= FLAG_RETURNS_64BITS; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
994 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
995 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
996 |
case FFI_TYPE_STRUCT: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
997 |
- if (cif->abi == FFI_SYSV) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
998 |
+ /* |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
999 |
+ * The final SYSV ABI says that structures smaller or equal 8 bytes |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1000 |
+ * are returned in r3/r4. The FFI_GCC_SYSV ABI instead returns them |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1001 |
+ * in memory. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1002 |
+ * |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1003 |
+ * NOTE: The assembly code can safely assume that it just needs to |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1004 |
+ * store both r3 and r4 into a 8-byte word-aligned buffer, as |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1005 |
+ * we allocate a temporary buffer in ffi_call() if this flag is |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1006 |
+ * set. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1007 |
+ */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1008 |
+ if (cif->abi == FFI_SYSV && size <= 8) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1009 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1010 |
- /* The final SYSV ABI says that structures smaller or equal 8 bytes |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1011 |
- are returned in r3/r4. The FFI_GCC_SYSV ABI instead returns them |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1012 |
- in memory. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1013 |
- |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1014 |
- /* Treat structs with size <= 8 bytes. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1015 |
- if (size <= 8) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1016 |
+ flags |= FLAG_RETURNS_SMST; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1017 |
+ break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1018 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1019 |
+#if _CALL_ELF == 2 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1020 |
+ if (cif->abi == FFI_LINUX64) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1021 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1022 |
+ unsigned int elt, elnum; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1023 |
+ elt = discover_homogeneous_aggregate (cif->rtype, &elnum); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1024 |
+ if (elt) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1025 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1026 |
+ if (elt == FFI_TYPE_DOUBLE) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1027 |
+ flags |= FLAG_RETURNS_64BITS; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1028 |
+ flags |= FLAG_RETURNS_FP | FLAG_RETURNS_SMST; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1029 |
+ break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1030 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1031 |
+ if (size <= 16) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1032 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1033 |
flags |= FLAG_RETURNS_SMST; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1034 |
- /* These structs are returned in r3. We pack the type and the |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1035 |
- precalculated shift value (needed in the sysv.S) into flags. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1036 |
- The same applies for the structs returned in r3/r4. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1037 |
- if (size <= 4) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1038 |
- { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1039 |
- flags |= FLAG_SYSV_SMST_R3; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1040 |
- flags |= 8 * (4 - size) << 8; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1041 |
- break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1042 |
- } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1043 |
- /* These structs are returned in r3 and r4. See above. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1044 |
- if (size <= 8) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1045 |
- { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1046 |
- flags |= FLAG_SYSV_SMST_R3 | FLAG_SYSV_SMST_R4; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1047 |
- flags |= 8 * (8 - size) << 8; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1048 |
- break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1049 |
- } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1050 |
+ break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1051 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1052 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1053 |
-#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1054 |
- byref: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1055 |
#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1056 |
intarg_count++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1057 |
flags |= FLAG_RETVAL_REFERENCE; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1058 |
/* Fall through. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1059 |
case FFI_TYPE_VOID: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1060 |
flags |= FLAG_RETURNS_NOTHING; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1061 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1062 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1063 |
@@ -717,218 +867,334 @@ ffi_prep_cif_machdep (ffi_cif *cif) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1064 |
if (cif->abi != FFI_LINUX64) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1065 |
/* The first NUM_GPR_ARG_REGISTERS words of integer arguments, and the |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1066 |
first NUM_FPR_ARG_REGISTERS fp arguments, go in registers; the rest |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1067 |
goes on the stack. Structures and long doubles (if not equivalent |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1068 |
to double) are passed as a pointer to a copy of the structure. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1069 |
Stuff on the stack needs to keep proper alignment. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1070 |
for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1071 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1072 |
- switch ((*ptr)->type) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1073 |
- { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1074 |
+ unsigned short typenum = (*ptr)->type; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1075 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1076 |
+ /* We may need to handle some values depending on ABI */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1077 |
+ if (cif->abi == FFI_LINUX_SOFT_FLOAT) { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1078 |
+ if (typenum == FFI_TYPE_FLOAT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1079 |
+ typenum = FFI_TYPE_UINT32; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1080 |
+ if (typenum == FFI_TYPE_DOUBLE) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1081 |
+ typenum = FFI_TYPE_UINT64; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1082 |
+ if (typenum == FFI_TYPE_LONGDOUBLE) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1083 |
+ typenum = FFI_TYPE_UINT128; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1084 |
+ } else if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64) { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1085 |
+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1086 |
+ if (typenum == FFI_TYPE_LONGDOUBLE) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1087 |
+ typenum = FFI_TYPE_STRUCT; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1088 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1089 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1090 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1091 |
+ switch (typenum) { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1092 |
+#ifndef __NO_FPRS__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1093 |
case FFI_TYPE_FLOAT: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1094 |
- /* With FFI_LINUX_SOFT_FLOAT floats are handled like UINT32. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1095 |
- if (cif->abi == FFI_LINUX_SOFT_FLOAT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1096 |
- goto soft_float_cif; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1097 |
fparg_count++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1098 |
/* floating singles are not 8-aligned on stack */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1099 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1100 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1101 |
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1102 |
case FFI_TYPE_LONGDOUBLE: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1103 |
- if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1104 |
- goto do_struct; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1105 |
- if (cif->abi == FFI_LINUX_SOFT_FLOAT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1106 |
- { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1107 |
- if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1108 |
- || intarg_count < NUM_GPR_ARG_REGISTERS) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1109 |
- /* A long double in FFI_LINUX_SOFT_FLOAT can use only |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1110 |
- a set of four consecutive gprs. If we have not enough, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1111 |
- we have to adjust the intarg_count value. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1112 |
- intarg_count += NUM_GPR_ARG_REGISTERS - intarg_count; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1113 |
- intarg_count += 4; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1114 |
- break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1115 |
- } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1116 |
- else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1117 |
- fparg_count++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1118 |
+ fparg_count++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1119 |
/* Fall thru */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1120 |
#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1121 |
case FFI_TYPE_DOUBLE: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1122 |
- /* With FFI_LINUX_SOFT_FLOAT doubles are handled like UINT64. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1123 |
- if (cif->abi == FFI_LINUX_SOFT_FLOAT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1124 |
- goto soft_double_cif; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1125 |
fparg_count++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1126 |
/* If this FP arg is going on the stack, it must be |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1127 |
8-byte-aligned. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1128 |
if (fparg_count > NUM_FPR_ARG_REGISTERS |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1129 |
&& intarg_count >= NUM_GPR_ARG_REGISTERS |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1130 |
&& intarg_count % 2 != 0) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1131 |
intarg_count++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1132 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1133 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1134 |
+ case FFI_TYPE_UINT128: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1135 |
+ /* |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1136 |
+ * A long double in FFI_LINUX_SOFT_FLOAT can use only a set |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1137 |
+ * of four consecutive gprs. If we do not have enough, we |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1138 |
+ * have to adjust the intarg_count value. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1139 |
+ */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1140 |
+ if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1141 |
+ && intarg_count < NUM_GPR_ARG_REGISTERS) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1142 |
+ intarg_count = NUM_GPR_ARG_REGISTERS; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1143 |
+ intarg_count += 4; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1144 |
+ break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1145 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1146 |
case FFI_TYPE_UINT64: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1147 |
case FFI_TYPE_SINT64: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1148 |
- soft_double_cif: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1149 |
/* 'long long' arguments are passed as two words, but |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1150 |
either both words must fit in registers or both go |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1151 |
on the stack. If they go on the stack, they must |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1152 |
be 8-byte-aligned. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1153 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1154 |
Also, only certain register pairs can be used for |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1155 |
passing long long int -- specifically (r3,r4), (r5,r6), |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1156 |
(r7,r8), (r9,r10). |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1157 |
*/ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1158 |
if (intarg_count == NUM_GPR_ARG_REGISTERS-1 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1159 |
|| intarg_count % 2 != 0) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1160 |
intarg_count++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1161 |
intarg_count += 2; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1162 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1163 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1164 |
case FFI_TYPE_STRUCT: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1165 |
-#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1166 |
- do_struct: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1167 |
-#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1168 |
/* We must allocate space for a copy of these to enforce |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1169 |
pass-by-value. Pad the space up to a multiple of 16 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1170 |
bytes (the maximum alignment required for anything under |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1171 |
the SYSV ABI). */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1172 |
struct_copy_size += ((*ptr)->size + 15) & ~0xF; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1173 |
/* Fall through (allocate space for the pointer). */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1174 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1175 |
- default: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1176 |
- soft_float_cif: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1177 |
+ case FFI_TYPE_POINTER: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1178 |
+ case FFI_TYPE_INT: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1179 |
+ case FFI_TYPE_UINT32: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1180 |
+ case FFI_TYPE_SINT32: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1181 |
+ case FFI_TYPE_UINT16: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1182 |
+ case FFI_TYPE_SINT16: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1183 |
+ case FFI_TYPE_UINT8: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1184 |
+ case FFI_TYPE_SINT8: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1185 |
/* Everything else is passed as a 4-byte word in a GPR, either |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1186 |
the object itself or a pointer to it. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1187 |
intarg_count++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1188 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1189 |
+ default: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1190 |
+ FFI_ASSERT (0); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1191 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1192 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1193 |
else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1194 |
for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1195 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1196 |
+ unsigned int elt, elnum; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1197 |
+#ifdef __STRUCT_PARM_ALIGN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1198 |
+ unsigned int align; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1199 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1200 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1201 |
switch ((*ptr)->type) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1202 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1203 |
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1204 |
case FFI_TYPE_LONGDOUBLE: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1205 |
- if (cif->abi == FFI_LINUX_SOFT_FLOAT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1206 |
- intarg_count += 4; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1207 |
- else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1208 |
- { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1209 |
- fparg_count += 2; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1210 |
- intarg_count += 2; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1211 |
- } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1212 |
+ fparg_count += 2; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1213 |
+ intarg_count += 2; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1214 |
+ if (fparg_count > NUM_FPR_ARG_REGISTERS64) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1215 |
+ flags |= FLAG_ARG_NEEDS_PSAVE; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1216 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1217 |
#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1218 |
case FFI_TYPE_FLOAT: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1219 |
case FFI_TYPE_DOUBLE: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1220 |
fparg_count++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1221 |
intarg_count++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1222 |
+ if (fparg_count > NUM_FPR_ARG_REGISTERS64) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1223 |
+ flags |= FLAG_ARG_NEEDS_PSAVE; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1224 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1225 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1226 |
case FFI_TYPE_STRUCT: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1227 |
+#ifdef __STRUCT_PARM_ALIGN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1228 |
+ align = (*ptr)->alignment; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1229 |
+ if (align > __STRUCT_PARM_ALIGN__) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1230 |
+ align = __STRUCT_PARM_ALIGN__; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1231 |
+ align = align / 8; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1232 |
+ if (align > 1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1233 |
+ intarg_count = ALIGN (intarg_count, align); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1234 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1235 |
intarg_count += ((*ptr)->size + 7) / 8; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1236 |
+ elt = 0; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1237 |
+#if _CALL_ELF == 2 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1238 |
+ elt = discover_homogeneous_aggregate (*ptr, &elnum); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1239 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1240 |
+ if (elt) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1241 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1242 |
+ fparg_count += elnum; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1243 |
+ if (fparg_count > NUM_FPR_ARG_REGISTERS64) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1244 |
+ flags |= FLAG_ARG_NEEDS_PSAVE; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1245 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1246 |
+ else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1247 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1248 |
+ if (intarg_count > NUM_GPR_ARG_REGISTERS64) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1249 |
+ flags |= FLAG_ARG_NEEDS_PSAVE; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1250 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1251 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1252 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1253 |
- default: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1254 |
+ case FFI_TYPE_POINTER: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1255 |
+ case FFI_TYPE_UINT64: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1256 |
+ case FFI_TYPE_SINT64: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1257 |
+ case FFI_TYPE_INT: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1258 |
+ case FFI_TYPE_UINT32: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1259 |
+ case FFI_TYPE_SINT32: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1260 |
+ case FFI_TYPE_UINT16: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1261 |
+ case FFI_TYPE_SINT16: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1262 |
+ case FFI_TYPE_UINT8: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1263 |
+ case FFI_TYPE_SINT8: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1264 |
/* Everything else is passed as a 8-byte word in a GPR, either |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1265 |
the object itself or a pointer to it. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1266 |
intarg_count++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1267 |
+ if (intarg_count > NUM_GPR_ARG_REGISTERS64) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1268 |
+ flags |= FLAG_ARG_NEEDS_PSAVE; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1269 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1270 |
+ default: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1271 |
+ FFI_ASSERT (0); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1272 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1273 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1274 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1275 |
+#ifndef __NO_FPRS__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1276 |
if (fparg_count != 0) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1277 |
flags |= FLAG_FP_ARGUMENTS; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1278 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1279 |
if (intarg_count > 4) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1280 |
flags |= FLAG_4_GPR_ARGUMENTS; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1281 |
if (struct_copy_size != 0) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1282 |
flags |= FLAG_ARG_NEEDS_COPY; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1283 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1284 |
if (cif->abi != FFI_LINUX64) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1285 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1286 |
+#ifndef __NO_FPRS__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1287 |
/* Space for the FPR registers, if needed. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1288 |
if (fparg_count != 0) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1289 |
bytes += NUM_FPR_ARG_REGISTERS * sizeof (double); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1290 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1291 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1292 |
/* Stack space. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1293 |
if (intarg_count > NUM_GPR_ARG_REGISTERS) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1294 |
bytes += (intarg_count - NUM_GPR_ARG_REGISTERS) * sizeof (int); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1295 |
+#ifndef __NO_FPRS__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1296 |
if (fparg_count > NUM_FPR_ARG_REGISTERS) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1297 |
bytes += (fparg_count - NUM_FPR_ARG_REGISTERS) * sizeof (double); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1298 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1299 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1300 |
else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1301 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1302 |
+#ifndef __NO_FPRS__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1303 |
/* Space for the FPR registers, if needed. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1304 |
if (fparg_count != 0) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1305 |
bytes += NUM_FPR_ARG_REGISTERS64 * sizeof (double); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1306 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1307 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1308 |
/* Stack space. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1309 |
+#if _CALL_ELF == 2 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1310 |
+ if ((flags & FLAG_ARG_NEEDS_PSAVE) != 0) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1311 |
+ bytes += intarg_count * sizeof (long); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1312 |
+#else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1313 |
if (intarg_count > NUM_GPR_ARG_REGISTERS64) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1314 |
bytes += (intarg_count - NUM_GPR_ARG_REGISTERS64) * sizeof (long); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1315 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1316 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1317 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1318 |
/* The stack space allocated needs to be a multiple of 16 bytes. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1319 |
bytes = (bytes + 15) & ~0xF; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1320 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1321 |
/* Add in the space for the copied structures. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1322 |
bytes += struct_copy_size; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1323 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1324 |
cif->flags = flags; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1325 |
cif->bytes = bytes; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1326 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1327 |
return FFI_OK; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1328 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1329 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1330 |
+ffi_status |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1331 |
+ffi_prep_cif_machdep (ffi_cif *cif) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1332 |
+{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1333 |
+ cif->nfixedargs = cif->nargs; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1334 |
+ return ffi_prep_cif_machdep_core (cif); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1335 |
+} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1336 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1337 |
+ffi_status |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1338 |
+ffi_prep_cif_machdep_var (ffi_cif *cif, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1339 |
+ unsigned int nfixedargs, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1340 |
+ unsigned int ntotalargs MAYBE_UNUSED) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1341 |
+{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1342 |
+ cif->nfixedargs = nfixedargs; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1343 |
+#if _CALL_ELF == 2 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1344 |
+ if (cif->abi == FFI_LINUX64) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1345 |
+ cif->flags |= FLAG_ARG_NEEDS_PSAVE; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1346 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1347 |
+ return ffi_prep_cif_machdep_core (cif); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1348 |
+} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1349 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1350 |
extern void ffi_call_SYSV(extended_cif *, unsigned, unsigned, unsigned *, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1351 |
void (*fn)(void)); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1352 |
extern void FFI_HIDDEN ffi_call_LINUX64(extended_cif *, unsigned long, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1353 |
unsigned long, unsigned long *, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1354 |
void (*fn)(void)); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1355 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1356 |
void |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1357 |
ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1358 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1359 |
+ /* |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1360 |
+ * The final SYSV ABI says that structures smaller or equal 8 bytes |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1361 |
+ * are returned in r3/r4. The FFI_GCC_SYSV ABI instead returns them |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1362 |
+ * in memory. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1363 |
+ * |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1364 |
+ * We bounce-buffer SYSV small struct return values so that sysv.S |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1365 |
+ * can write r3 and r4 to memory without worrying about struct size. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1366 |
+ * |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1367 |
+ * For ELFv2 ABI, use a bounce buffer for homogeneous structs too, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1368 |
+ * for similar reasons. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1369 |
+ */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1370 |
+ unsigned long smst_buffer[8]; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1371 |
extended_cif ecif; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1372 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1373 |
ecif.cif = cif; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1374 |
ecif.avalue = avalue; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1375 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1376 |
- /* If the return value is a struct and we don't have a return */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1377 |
- /* value address then we need to make one */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1378 |
- |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1379 |
- if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1380 |
- { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1381 |
- ecif.rvalue = alloca(cif->rtype->size); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1382 |
- } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1383 |
- else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1384 |
- ecif.rvalue = rvalue; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1385 |
- |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1386 |
+ ecif.rvalue = rvalue; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1387 |
+ if ((cif->flags & FLAG_RETURNS_SMST) != 0) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1388 |
+ ecif.rvalue = smst_buffer; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1389 |
+ /* Ensure that we have a valid struct return value. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1390 |
+ FIXME: Isn't this just papering over a user problem? */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1391 |
+ else if (!rvalue && cif->rtype->type == FFI_TYPE_STRUCT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1392 |
+ ecif.rvalue = alloca (cif->rtype->size); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1393 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1394 |
switch (cif->abi) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1395 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1396 |
#ifndef POWERPC64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1397 |
+# ifndef __NO_FPRS__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1398 |
case FFI_SYSV: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1399 |
case FFI_GCC_SYSV: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1400 |
case FFI_LINUX: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1401 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1402 |
case FFI_LINUX_SOFT_FLOAT: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1403 |
ffi_call_SYSV (&ecif, -cif->bytes, cif->flags, ecif.rvalue, fn); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1404 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1405 |
#else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1406 |
case FFI_LINUX64: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1407 |
ffi_call_LINUX64 (&ecif, -(long) cif->bytes, cif->flags, ecif.rvalue, fn); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1408 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1409 |
#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1410 |
default: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1411 |
FFI_ASSERT (0); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1412 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1413 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1414 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1415 |
+ /* Check for a bounce-buffered return value */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1416 |
+ if (rvalue && ecif.rvalue == smst_buffer) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1417 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1418 |
+ unsigned int rsize = cif->rtype->size; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1419 |
+#ifndef __LITTLE_ENDIAN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1420 |
+ /* The SYSV ABI returns a structure of up to 4 bytes in size |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1421 |
+ left-padded in r3. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1422 |
+ if (cif->abi == FFI_SYSV && rsize <= 4) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1423 |
+ memcpy (rvalue, (char *) smst_buffer + 4 - rsize, rsize); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1424 |
+ /* The SYSV ABI returns a structure of up to 8 bytes in size |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1425 |
+ left-padded in r3/r4, and the ELFv2 ABI similarly returns a |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1426 |
+ structure of up to 8 bytes in size left-padded in r3. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1427 |
+ else if (rsize <= 8) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1428 |
+ memcpy (rvalue, (char *) smst_buffer + 8 - rsize, rsize); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1429 |
+ else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1430 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1431 |
+ memcpy (rvalue, smst_buffer, rsize); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1432 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1433 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1434 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1435 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1436 |
-#ifndef POWERPC64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1437 |
+#if !defined POWERPC64 || _CALL_ELF == 2 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1438 |
#define MIN_CACHE_LINE_SIZE 8 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1439 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1440 |
static void |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1441 |
flush_icache (char *wraddr, char *xaddr, int size) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1442 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1443 |
int i; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1444 |
for (i = 0; i < size; i += MIN_CACHE_LINE_SIZE) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1445 |
__asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1446 |
@@ -942,26 +1208,48 @@ flush_icache (char *wraddr, char *xaddr, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1447 |
ffi_status |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1448 |
ffi_prep_closure_loc (ffi_closure *closure, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1449 |
ffi_cif *cif, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1450 |
void (*fun) (ffi_cif *, void *, void **, void *), |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1451 |
void *user_data, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1452 |
void *codeloc) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1453 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1454 |
#ifdef POWERPC64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1455 |
+# if _CALL_ELF == 2 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1456 |
+ unsigned int *tramp = (unsigned int *) &closure->tramp[0]; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1457 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1458 |
+ if (cif->abi != FFI_LINUX64) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1459 |
+ return FFI_BAD_ABI; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1460 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1461 |
+ tramp[0] = 0xe96c0018; /* 0: ld 11,2f-0b(12) */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1462 |
+ tramp[1] = 0xe98c0010; /* ld 12,1f-0b(12) */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1463 |
+ tramp[2] = 0x7d8903a6; /* mtctr 12 */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1464 |
+ tramp[3] = 0x4e800420; /* bctr */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1465 |
+ /* 1: .quad function_addr */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1466 |
+ /* 2: .quad context */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1467 |
+ *(void **) &tramp[4] = (void *) ffi_closure_LINUX64; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1468 |
+ *(void **) &tramp[6] = codeloc; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1469 |
+ flush_icache ((char *)tramp, (char *)codeloc, FFI_TRAMPOLINE_SIZE); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1470 |
+# else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1471 |
void **tramp = (void **) &closure->tramp[0]; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1472 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1473 |
- FFI_ASSERT (cif->abi == FFI_LINUX64); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1474 |
+ if (cif->abi != FFI_LINUX64) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1475 |
+ return FFI_BAD_ABI; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1476 |
/* Copy function address and TOC from ffi_closure_LINUX64. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1477 |
memcpy (tramp, (char *) ffi_closure_LINUX64, 16); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1478 |
tramp[2] = codeloc; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1479 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1480 |
#else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1481 |
unsigned int *tramp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1482 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1483 |
- FFI_ASSERT (cif->abi == FFI_GCC_SYSV || cif->abi == FFI_SYSV); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1484 |
+ if (! (cif->abi == FFI_GCC_SYSV |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1485 |
+ || cif->abi == FFI_SYSV |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1486 |
+ || cif->abi == FFI_LINUX |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1487 |
+ || cif->abi == FFI_LINUX_SOFT_FLOAT)) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1488 |
+ return FFI_BAD_ABI; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1489 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1490 |
tramp = (unsigned int *) &closure->tramp[0]; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1491 |
tramp[0] = 0x7c0802a6; /* mflr r0 */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1492 |
tramp[1] = 0x4800000d; /* bl 10 <trampoline_initial+0x10> */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1493 |
tramp[4] = 0x7d6802a6; /* mflr r11 */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1494 |
tramp[5] = 0x7c0803a6; /* mtlr r0 */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1495 |
tramp[6] = 0x800b0000; /* lwz r0,0(r11) */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1496 |
tramp[7] = 0x816b0004; /* lwz r11,4(r11) */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1497 |
@@ -1006,110 +1294,215 @@ ffi_closure_helper_SYSV (ffi_closure *cl |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1498 |
/* rvalue is the pointer to space for return value in closure assembly */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1499 |
/* pgr is the pointer to where r3-r10 are stored in ffi_closure_SYSV */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1500 |
/* pfr is the pointer to where f1-f8 are stored in ffi_closure_SYSV */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1501 |
/* pst is the pointer to outgoing parameter stack in original caller */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1502 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1503 |
void ** avalue; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1504 |
ffi_type ** arg_types; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1505 |
long i, avn; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1506 |
- long nf; /* number of floating registers already used */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1507 |
- long ng; /* number of general registers already used */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1508 |
- ffi_cif * cif; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1509 |
- double temp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1510 |
- unsigned size; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1511 |
+#ifndef __NO_FPRS__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1512 |
+ long nf = 0; /* number of floating registers already used */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1513 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1514 |
+ long ng = 0; /* number of general registers already used */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1515 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1516 |
- cif = closure->cif; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1517 |
+ ffi_cif *cif = closure->cif; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1518 |
+ unsigned size = cif->rtype->size; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1519 |
+ unsigned short rtypenum = cif->rtype->type; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1520 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1521 |
avalue = alloca (cif->nargs * sizeof (void *)); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1522 |
- size = cif->rtype->size; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1523 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1524 |
- nf = 0; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1525 |
- ng = 0; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1526 |
+ /* First translate for softfloat/nonlinux */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1527 |
+ if (cif->abi == FFI_LINUX_SOFT_FLOAT) { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1528 |
+ if (rtypenum == FFI_TYPE_FLOAT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1529 |
+ rtypenum = FFI_TYPE_UINT32; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1530 |
+ if (rtypenum == FFI_TYPE_DOUBLE) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1531 |
+ rtypenum = FFI_TYPE_UINT64; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1532 |
+ if (rtypenum == FFI_TYPE_LONGDOUBLE) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1533 |
+ rtypenum = FFI_TYPE_UINT128; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1534 |
+ } else if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64) { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1535 |
+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1536 |
+ if (rtypenum == FFI_TYPE_LONGDOUBLE) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1537 |
+ rtypenum = FFI_TYPE_STRUCT; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1538 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1539 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1540 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1541 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1542 |
/* Copy the caller's structure return value address so that the closure |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1543 |
returns the data directly to the caller. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1544 |
For FFI_SYSV the result is passed in r3/r4 if the struct size is less |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1545 |
or equal 8 bytes. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1546 |
- |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1547 |
- if ((cif->rtype->type == FFI_TYPE_STRUCT |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1548 |
- && !((cif->abi == FFI_SYSV) && (size <= 8))) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1549 |
-#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1550 |
- || (cif->rtype->type == FFI_TYPE_LONGDOUBLE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1551 |
- && cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1552 |
-#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1553 |
- ) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1554 |
- { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1555 |
+ if (rtypenum == FFI_TYPE_STRUCT && ((cif->abi != FFI_SYSV) || (size > 8))) { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1556 |
rvalue = (void *) *pgr; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1557 |
ng++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1558 |
pgr++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1559 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1560 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1561 |
i = 0; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1562 |
avn = cif->nargs; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1563 |
arg_types = cif->arg_types; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1564 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1565 |
/* Grab the addresses of the arguments from the stack frame. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1566 |
- while (i < avn) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1567 |
- { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1568 |
- switch (arg_types[i]->type) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1569 |
- { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1570 |
+ while (i < avn) { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1571 |
+ unsigned short typenum = arg_types[i]->type; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1572 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1573 |
+ /* We may need to handle some values depending on ABI */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1574 |
+ if (cif->abi == FFI_LINUX_SOFT_FLOAT) { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1575 |
+ if (typenum == FFI_TYPE_FLOAT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1576 |
+ typenum = FFI_TYPE_UINT32; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1577 |
+ if (typenum == FFI_TYPE_DOUBLE) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1578 |
+ typenum = FFI_TYPE_UINT64; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1579 |
+ if (typenum == FFI_TYPE_LONGDOUBLE) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1580 |
+ typenum = FFI_TYPE_UINT128; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1581 |
+ } else if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64) { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1582 |
+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1583 |
+ if (typenum == FFI_TYPE_LONGDOUBLE) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1584 |
+ typenum = FFI_TYPE_STRUCT; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1585 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1586 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1587 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1588 |
+ switch (typenum) { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1589 |
+#ifndef __NO_FPRS__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1590 |
+ case FFI_TYPE_FLOAT: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1591 |
+ /* unfortunately float values are stored as doubles |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1592 |
+ * in the ffi_closure_SYSV code (since we don't check |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1593 |
+ * the type in that routine). |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1594 |
+ */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1595 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1596 |
+ /* there are 8 64bit floating point registers */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1597 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1598 |
+ if (nf < 8) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1599 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1600 |
+ double temp = pfr->d; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1601 |
+ pfr->f = (float) temp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1602 |
+ avalue[i] = pfr; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1603 |
+ nf++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1604 |
+ pfr++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1605 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1606 |
+ else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1607 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1608 |
+ /* FIXME? here we are really changing the values |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1609 |
+ * stored in the original calling routines outgoing |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1610 |
+ * parameter stack. This is probably a really |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1611 |
+ * naughty thing to do but... |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1612 |
+ */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1613 |
+ avalue[i] = pst; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1614 |
+ pst += 1; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1615 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1616 |
+ break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1617 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1618 |
+ case FFI_TYPE_DOUBLE: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1619 |
+ /* On the outgoing stack all values are aligned to 8 */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1620 |
+ /* there are 8 64bit floating point registers */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1621 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1622 |
+ if (nf < 8) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1623 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1624 |
+ avalue[i] = pfr; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1625 |
+ nf++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1626 |
+ pfr++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1627 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1628 |
+ else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1629 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1630 |
+ if (((long) pst) & 4) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1631 |
+ pst++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1632 |
+ avalue[i] = pst; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1633 |
+ pst += 2; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1634 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1635 |
+ break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1636 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1637 |
+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1638 |
+ case FFI_TYPE_LONGDOUBLE: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1639 |
+ if (nf < 7) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1640 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1641 |
+ avalue[i] = pfr; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1642 |
+ pfr += 2; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1643 |
+ nf += 2; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1644 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1645 |
+ else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1646 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1647 |
+ if (((long) pst) & 4) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1648 |
+ pst++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1649 |
+ avalue[i] = pst; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1650 |
+ pst += 4; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1651 |
+ nf = 8; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1652 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1653 |
+ break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1654 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1655 |
+#endif /* have FPRS */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1656 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1657 |
+ case FFI_TYPE_UINT128: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1658 |
+ /* |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1659 |
+ * Test if for the whole long double, 4 gprs are available. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1660 |
+ * otherwise the stuff ends up on the stack. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1661 |
+ */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1662 |
+ if (ng < 5) { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1663 |
+ avalue[i] = pgr; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1664 |
+ pgr += 4; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1665 |
+ ng += 4; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1666 |
+ } else { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1667 |
+ avalue[i] = pst; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1668 |
+ pst += 4; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1669 |
+ ng = 8+4; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1670 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1671 |
+ break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1672 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1673 |
case FFI_TYPE_SINT8: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1674 |
case FFI_TYPE_UINT8: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1675 |
+#ifndef __LITTLE_ENDIAN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1676 |
/* there are 8 gpr registers used to pass values */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1677 |
if (ng < 8) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1678 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1679 |
avalue[i] = (char *) pgr + 3; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1680 |
ng++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1681 |
pgr++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1682 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1683 |
else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1684 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1685 |
avalue[i] = (char *) pst + 3; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1686 |
pst++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1687 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1688 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1689 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1690 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1691 |
case FFI_TYPE_SINT16: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1692 |
case FFI_TYPE_UINT16: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1693 |
+#ifndef __LITTLE_ENDIAN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1694 |
/* there are 8 gpr registers used to pass values */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1695 |
if (ng < 8) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1696 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1697 |
avalue[i] = (char *) pgr + 2; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1698 |
ng++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1699 |
pgr++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1700 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1701 |
else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1702 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1703 |
avalue[i] = (char *) pst + 2; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1704 |
pst++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1705 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1706 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1707 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1708 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1709 |
case FFI_TYPE_SINT32: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1710 |
case FFI_TYPE_UINT32: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1711 |
case FFI_TYPE_POINTER: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1712 |
- soft_float_closure: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1713 |
/* there are 8 gpr registers used to pass values */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1714 |
if (ng < 8) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1715 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1716 |
avalue[i] = pgr; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1717 |
ng++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1718 |
pgr++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1719 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1720 |
else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1721 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1722 |
avalue[i] = pst; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1723 |
pst++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1724 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1725 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1726 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1727 |
case FFI_TYPE_STRUCT: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1728 |
-#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1729 |
- do_struct: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1730 |
-#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1731 |
/* Structs are passed by reference. The address will appear in a |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1732 |
gpr if it is one of the first 8 arguments. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1733 |
if (ng < 8) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1734 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1735 |
avalue[i] = (void *) *pgr; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1736 |
ng++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1737 |
pgr++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1738 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1739 |
@@ -1117,17 +1510,16 @@ ffi_closure_helper_SYSV (ffi_closure *cl |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1740 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1741 |
avalue[i] = (void *) *pst; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1742 |
pst++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1743 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1744 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1745 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1746 |
case FFI_TYPE_SINT64: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1747 |
case FFI_TYPE_UINT64: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1748 |
- soft_double_closure: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1749 |
/* passing long long ints are complex, they must |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1750 |
* be passed in suitable register pairs such as |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1751 |
* (r3,r4) or (r5,r6) or (r6,r7), or (r7,r8) or (r9,r10) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1752 |
* and if the entire pair aren't available then the outgoing |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1753 |
* parameter stack is used for both but an alignment of 8 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1754 |
* must will be kept. So we must either look in pgr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1755 |
* or pst to find the correct address for this type |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1756 |
* of parameter. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1757 |
@@ -1149,277 +1541,239 @@ ffi_closure_helper_SYSV (ffi_closure *cl |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1758 |
if (((long) pst) & 4) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1759 |
pst++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1760 |
avalue[i] = pst; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1761 |
pst += 2; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1762 |
ng = 8; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1763 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1764 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1765 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1766 |
- case FFI_TYPE_FLOAT: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1767 |
- /* With FFI_LINUX_SOFT_FLOAT floats are handled like UINT32. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1768 |
- if (cif->abi == FFI_LINUX_SOFT_FLOAT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1769 |
- goto soft_float_closure; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1770 |
- /* unfortunately float values are stored as doubles |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1771 |
- * in the ffi_closure_SYSV code (since we don't check |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1772 |
- * the type in that routine). |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1773 |
- */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1774 |
- |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1775 |
- /* there are 8 64bit floating point registers */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1776 |
- |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1777 |
- if (nf < 8) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1778 |
- { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1779 |
- temp = pfr->d; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1780 |
- pfr->f = (float) temp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1781 |
- avalue[i] = pfr; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1782 |
- nf++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1783 |
- pfr++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1784 |
- } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1785 |
- else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1786 |
- { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1787 |
- /* FIXME? here we are really changing the values |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1788 |
- * stored in the original calling routines outgoing |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1789 |
- * parameter stack. This is probably a really |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1790 |
- * naughty thing to do but... |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1791 |
- */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1792 |
- avalue[i] = pst; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1793 |
- pst += 1; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1794 |
- } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1795 |
- break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1796 |
- |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1797 |
- case FFI_TYPE_DOUBLE: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1798 |
- /* With FFI_LINUX_SOFT_FLOAT doubles are handled like UINT64. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1799 |
- if (cif->abi == FFI_LINUX_SOFT_FLOAT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1800 |
- goto soft_double_closure; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1801 |
- /* On the outgoing stack all values are aligned to 8 */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1802 |
- /* there are 8 64bit floating point registers */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1803 |
- |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1804 |
- if (nf < 8) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1805 |
- { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1806 |
- avalue[i] = pfr; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1807 |
- nf++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1808 |
- pfr++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1809 |
- } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1810 |
- else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1811 |
- { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1812 |
- if (((long) pst) & 4) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1813 |
- pst++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1814 |
- avalue[i] = pst; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1815 |
- pst += 2; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1816 |
- } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1817 |
- break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1818 |
- |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1819 |
-#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1820 |
- case FFI_TYPE_LONGDOUBLE: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1821 |
- if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1822 |
- goto do_struct; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1823 |
- if (cif->abi == FFI_LINUX_SOFT_FLOAT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1824 |
- { /* Test if for the whole long double, 4 gprs are available. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1825 |
- otherwise the stuff ends up on the stack. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1826 |
- if (ng < 5) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1827 |
- { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1828 |
- avalue[i] = pgr; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1829 |
- pgr += 4; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1830 |
- ng += 4; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1831 |
- } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1832 |
- else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1833 |
- { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1834 |
- avalue[i] = pst; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1835 |
- pst += 4; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1836 |
- ng = 8; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1837 |
- } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1838 |
- break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1839 |
- } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1840 |
- if (nf < 7) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1841 |
- { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1842 |
- avalue[i] = pfr; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1843 |
- pfr += 2; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1844 |
- nf += 2; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1845 |
- } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1846 |
- else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1847 |
- { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1848 |
- if (((long) pst) & 4) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1849 |
- pst++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1850 |
- avalue[i] = pst; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1851 |
- pst += 4; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1852 |
- nf = 8; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1853 |
- } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1854 |
- break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1855 |
-#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1856 |
- |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1857 |
default: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1858 |
- FFI_ASSERT (0); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1859 |
+ FFI_ASSERT (0); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1860 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1861 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1862 |
i++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1863 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1864 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1865 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1866 |
(closure->fun) (cif, rvalue, avalue, closure->user_data); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1867 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1868 |
/* Tell ffi_closure_SYSV how to perform return type promotions. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1869 |
Because the FFI_SYSV ABI returns the structures <= 8 bytes in r3/r4 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1870 |
we have to tell ffi_closure_SYSV how to treat them. We combine the base |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1871 |
type FFI_SYSV_TYPE_SMALL_STRUCT - 1 with the size of the struct. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1872 |
So a one byte struct gets the return type 16. Return type 1 to 15 are |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1873 |
already used and we never have a struct with size zero. That is the reason |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1874 |
for the subtraction of 1. See the comment in ffitarget.h about ordering. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1875 |
*/ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1876 |
- if (cif->abi == FFI_SYSV && cif->rtype->type == FFI_TYPE_STRUCT |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1877 |
- && size <= 8) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1878 |
+ if (cif->abi == FFI_SYSV && rtypenum == FFI_TYPE_STRUCT && size <= 8) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1879 |
return (FFI_SYSV_TYPE_SMALL_STRUCT - 1) + size; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1880 |
-#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1881 |
- else if (cif->rtype->type == FFI_TYPE_LONGDOUBLE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1882 |
- && cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1883 |
- return FFI_TYPE_STRUCT; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1884 |
-#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1885 |
- /* With FFI_LINUX_SOFT_FLOAT floats and doubles are handled like UINT32 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1886 |
- respectivley UINT64. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1887 |
- if (cif->abi == FFI_LINUX_SOFT_FLOAT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1888 |
- { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1889 |
- switch (cif->rtype->type) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1890 |
- { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1891 |
- case FFI_TYPE_FLOAT: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1892 |
- return FFI_TYPE_UINT32; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1893 |
- break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1894 |
- case FFI_TYPE_DOUBLE: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1895 |
- return FFI_TYPE_UINT64; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1896 |
- break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1897 |
-#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1898 |
- case FFI_TYPE_LONGDOUBLE: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1899 |
- return FFI_TYPE_UINT128; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1900 |
- break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1901 |
-#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1902 |
- default: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1903 |
- return cif->rtype->type; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1904 |
- } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1905 |
- } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1906 |
- else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1907 |
- { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1908 |
- return cif->rtype->type; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1909 |
- } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1910 |
+ return rtypenum; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1911 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1912 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1913 |
int FFI_HIDDEN ffi_closure_helper_LINUX64 (ffi_closure *, void *, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1914 |
unsigned long *, ffi_dblfl *); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1915 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1916 |
int FFI_HIDDEN |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1917 |
ffi_closure_helper_LINUX64 (ffi_closure *closure, void *rvalue, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1918 |
unsigned long *pst, ffi_dblfl *pfr) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1919 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1920 |
/* rvalue is the pointer to space for return value in closure assembly */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1921 |
/* pst is the pointer to parameter save area |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1922 |
(r3-r10 are stored into its first 8 slots by ffi_closure_LINUX64) */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1923 |
/* pfr is the pointer to where f1-f13 are stored in ffi_closure_LINUX64 */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1924 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1925 |
void **avalue; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1926 |
ffi_type **arg_types; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1927 |
- long i, avn; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1928 |
+ unsigned long i, avn, nfixedargs; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1929 |
ffi_cif *cif; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1930 |
ffi_dblfl *end_pfr = pfr + NUM_FPR_ARG_REGISTERS64; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1931 |
+#ifdef __STRUCT_PARM_ALIGN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1932 |
+ unsigned long align; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1933 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1934 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1935 |
cif = closure->cif; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1936 |
avalue = alloca (cif->nargs * sizeof (void *)); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1937 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1938 |
- /* Copy the caller's structure return value address so that the closure |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1939 |
- returns the data directly to the caller. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1940 |
- if (cif->rtype->type == FFI_TYPE_STRUCT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1941 |
+ /* Copy the caller's structure return value address so that the |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1942 |
+ closure returns the data directly to the caller. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1943 |
+ if (cif->rtype->type == FFI_TYPE_STRUCT |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1944 |
+ && (cif->flags & FLAG_RETURNS_SMST) == 0) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1945 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1946 |
rvalue = (void *) *pst; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1947 |
pst++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1948 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1949 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1950 |
i = 0; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1951 |
avn = cif->nargs; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1952 |
+ nfixedargs = cif->nfixedargs; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1953 |
arg_types = cif->arg_types; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1954 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1955 |
/* Grab the addresses of the arguments from the stack frame. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1956 |
while (i < avn) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1957 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1958 |
+ unsigned int elt, elnum; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1959 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1960 |
switch (arg_types[i]->type) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1961 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1962 |
case FFI_TYPE_SINT8: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1963 |
case FFI_TYPE_UINT8: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1964 |
+#ifndef __LITTLE_ENDIAN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1965 |
avalue[i] = (char *) pst + 7; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1966 |
pst++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1967 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1968 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1969 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1970 |
case FFI_TYPE_SINT16: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1971 |
case FFI_TYPE_UINT16: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1972 |
+#ifndef __LITTLE_ENDIAN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1973 |
avalue[i] = (char *) pst + 6; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1974 |
pst++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1975 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1976 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1977 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1978 |
case FFI_TYPE_SINT32: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1979 |
case FFI_TYPE_UINT32: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1980 |
+#ifndef __LITTLE_ENDIAN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1981 |
avalue[i] = (char *) pst + 4; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1982 |
pst++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1983 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1984 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1985 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1986 |
case FFI_TYPE_SINT64: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1987 |
case FFI_TYPE_UINT64: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1988 |
case FFI_TYPE_POINTER: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1989 |
avalue[i] = pst; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1990 |
pst++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1991 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1992 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1993 |
case FFI_TYPE_STRUCT: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1994 |
- /* Structures with size less than eight bytes are passed |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1995 |
- left-padded. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1996 |
- if (arg_types[i]->size < 8) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1997 |
- avalue[i] = (char *) pst + 8 - arg_types[i]->size; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1998 |
+#ifdef __STRUCT_PARM_ALIGN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1999 |
+ align = arg_types[i]->alignment; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2000 |
+ if (align > __STRUCT_PARM_ALIGN__) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2001 |
+ align = __STRUCT_PARM_ALIGN__; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2002 |
+ if (align > 1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2003 |
+ pst = (unsigned long *) ALIGN ((size_t) pst, align); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2004 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2005 |
+ elt = 0; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2006 |
+#if _CALL_ELF == 2 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2007 |
+ elt = discover_homogeneous_aggregate (arg_types[i], &elnum); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2008 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2009 |
+ if (elt) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2010 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2011 |
+ union { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2012 |
+ void *v; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2013 |
+ unsigned long *ul; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2014 |
+ float *f; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2015 |
+ double *d; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2016 |
+ size_t p; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2017 |
+ } to, from; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2018 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2019 |
+ /* Repackage the aggregate from its parts. The |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2020 |
+ aggregate size is not greater than the space taken by |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2021 |
+ the registers so store back to the register/parameter |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2022 |
+ save arrays. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2023 |
+ if (pfr + elnum <= end_pfr) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2024 |
+ to.v = pfr; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2025 |
+ else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2026 |
+ to.v = pst; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2027 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2028 |
+ avalue[i] = to.v; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2029 |
+ from.ul = pst; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2030 |
+ if (elt == FFI_TYPE_FLOAT) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2031 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2032 |
+ do |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2033 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2034 |
+ if (pfr < end_pfr && i < nfixedargs) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2035 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2036 |
+ *to.f = (float) pfr->d; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2037 |
+ pfr++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2038 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2039 |
+ else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2040 |
+ *to.f = *from.f; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2041 |
+ to.f++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2042 |
+ from.f++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2043 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2044 |
+ while (--elnum != 0); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2045 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2046 |
+ else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2047 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2048 |
+ do |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2049 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2050 |
+ if (pfr < end_pfr && i < nfixedargs) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2051 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2052 |
+ *to.d = pfr->d; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2053 |
+ pfr++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2054 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2055 |
+ else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2056 |
+ *to.d = *from.d; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2057 |
+ to.d++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2058 |
+ from.d++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2059 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2060 |
+ while (--elnum != 0); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2061 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2062 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2063 |
else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2064 |
- avalue[i] = pst; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2065 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2066 |
+#ifndef __LITTLE_ENDIAN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2067 |
+ /* Structures with size less than eight bytes are passed |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2068 |
+ left-padded. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2069 |
+ if (arg_types[i]->size < 8) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2070 |
+ avalue[i] = (char *) pst + 8 - arg_types[i]->size; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2071 |
+ else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2072 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2073 |
+ avalue[i] = pst; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2074 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2075 |
pst += (arg_types[i]->size + 7) / 8; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2076 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2077 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2078 |
case FFI_TYPE_FLOAT: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2079 |
/* unfortunately float values are stored as doubles |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2080 |
* in the ffi_closure_LINUX64 code (since we don't check |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2081 |
* the type in that routine). |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2082 |
*/ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2083 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2084 |
/* there are 13 64bit floating point registers */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2085 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2086 |
- if (pfr < end_pfr) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2087 |
+ if (pfr < end_pfr && i < nfixedargs) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2088 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2089 |
double temp = pfr->d; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2090 |
pfr->f = (float) temp; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2091 |
avalue[i] = pfr; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2092 |
pfr++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2093 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2094 |
else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2095 |
avalue[i] = pst; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2096 |
pst++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2097 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2098 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2099 |
case FFI_TYPE_DOUBLE: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2100 |
/* On the outgoing stack all values are aligned to 8 */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2101 |
/* there are 13 64bit floating point registers */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2102 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2103 |
- if (pfr < end_pfr) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2104 |
+ if (pfr < end_pfr && i < nfixedargs) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2105 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2106 |
avalue[i] = pfr; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2107 |
pfr++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2108 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2109 |
else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2110 |
avalue[i] = pst; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2111 |
pst++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2112 |
break; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2113 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2114 |
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2115 |
case FFI_TYPE_LONGDOUBLE: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2116 |
- if (pfr + 1 < end_pfr) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2117 |
+ if (pfr + 1 < end_pfr && i + 1 < nfixedargs) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2118 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2119 |
avalue[i] = pfr; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2120 |
pfr += 2; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2121 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2122 |
else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2123 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2124 |
- if (pfr < end_pfr) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2125 |
+ if (pfr < end_pfr && i < nfixedargs) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2126 |
{ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2127 |
/* Passed partly in f13 and partly on the stack. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2128 |
Move it all to the stack. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2129 |
*pst = *(unsigned long *) pfr; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2130 |
pfr++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2131 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2132 |
avalue[i] = pst; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2133 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2134 |
@@ -1433,10 +1787,19 @@ ffi_closure_helper_LINUX64 (ffi_closure |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2135 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2136 |
i++; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2137 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2138 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2139 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2140 |
(closure->fun) (cif, rvalue, avalue, closure->user_data); |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2141 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2142 |
/* Tell ffi_closure_LINUX64 how to perform return type promotions. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2143 |
+ if ((cif->flags & FLAG_RETURNS_SMST) != 0) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2144 |
+ { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2145 |
+ if ((cif->flags & FLAG_RETURNS_FP) == 0) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2146 |
+ return FFI_V2_TYPE_SMALL_STRUCT + cif->rtype->size - 1; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2147 |
+ else if ((cif->flags & FLAG_RETURNS_64BITS) != 0) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2148 |
+ return FFI_V2_TYPE_DOUBLE_HOMOG; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2149 |
+ else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2150 |
+ return FFI_V2_TYPE_FLOAT_HOMOG; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2151 |
+ } |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2152 |
return cif->rtype->type; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2153 |
} |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2154 |
diff --git a/js/src/ctypes/libffi/src/powerpc/ffitarget.h b/js/src/ctypes/libffi/src/powerpc/ffitarget.h |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2155 |
--- a/js/src/ctypes/libffi/src/powerpc/ffitarget.h |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2156 |
+++ b/js/src/ctypes/libffi/src/powerpc/ffitarget.h |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2157 |
@@ -1,11 +1,13 @@ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2158 |
/* -----------------------------------------------------------------*-C-*- |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2159 |
- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2160 |
- Copyright (C) 2007, 2008 Free Software Foundation, Inc |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2161 |
+ ffitarget.h - Copyright (c) 2012 Anthony Green |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2162 |
+ Copyright (C) 2007, 2008, 2010 Free Software Foundation, Inc |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2163 |
+ Copyright (c) 1996-2003 Red Hat, Inc. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2164 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2165 |
Target configuration macros for PowerPC. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2166 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2167 |
Permission is hereby granted, free of charge, to any person obtaining |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2168 |
a copy of this software and associated documentation files (the |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2169 |
``Software''), to deal in the Software without restriction, including |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2170 |
without limitation the rights to use, copy, modify, merge, publish, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2171 |
distribute, sublicense, and/or sell copies of the Software, and to |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2172 |
permit persons to whom the Software is furnished to do so, subject to |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2173 |
@@ -23,16 +25,20 @@ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2174 |
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2175 |
DEALINGS IN THE SOFTWARE. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2176 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2177 |
----------------------------------------------------------------------- */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2178 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2179 |
#ifndef LIBFFI_TARGET_H |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2180 |
#define LIBFFI_TARGET_H |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2181 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2182 |
+#ifndef LIBFFI_H |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2183 |
+#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2184 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2185 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2186 |
/* ---- System specific configurations ----------------------------------- */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2187 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2188 |
#if defined (POWERPC) && defined (__powerpc64__) /* linux64 */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2189 |
#ifndef POWERPC64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2190 |
#define POWERPC64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2191 |
#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2192 |
#elif defined (POWERPC_DARWIN) && defined (__ppc64__) /* Darwin */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2193 |
#ifndef POWERPC64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2194 |
@@ -52,28 +58,24 @@ typedef enum ffi_abi { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2195 |
FFI_FIRST_ABI = 0, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2196 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2197 |
#ifdef POWERPC |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2198 |
FFI_SYSV, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2199 |
FFI_GCC_SYSV, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2200 |
FFI_LINUX64, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2201 |
FFI_LINUX, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2202 |
FFI_LINUX_SOFT_FLOAT, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2203 |
-# ifdef POWERPC64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2204 |
+# if defined(POWERPC64) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2205 |
FFI_DEFAULT_ABI = FFI_LINUX64, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2206 |
+# elif defined(__NO_FPRS__) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2207 |
+ FFI_DEFAULT_ABI = FFI_LINUX_SOFT_FLOAT, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2208 |
+# elif (__LDBL_MANT_DIG__ == 106) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2209 |
+ FFI_DEFAULT_ABI = FFI_LINUX, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2210 |
# else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2211 |
-# if (!defined(__NO_FPRS__) && (__LDBL_MANT_DIG__ == 106)) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2212 |
- FFI_DEFAULT_ABI = FFI_LINUX, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2213 |
-# else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2214 |
-# ifdef __NO_FPRS__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2215 |
- FFI_DEFAULT_ABI = FFI_LINUX_SOFT_FLOAT, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2216 |
-# else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2217 |
FFI_DEFAULT_ABI = FFI_GCC_SYSV, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2218 |
-# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2219 |
-# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2220 |
# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2221 |
#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2222 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2223 |
#ifdef POWERPC_AIX |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2224 |
FFI_AIX, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2225 |
FFI_DARWIN, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2226 |
FFI_DEFAULT_ABI = FFI_AIX, |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2227 |
#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2228 |
@@ -96,32 +98,45 @@ typedef enum ffi_abi { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2229 |
FFI_LAST_ABI |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2230 |
} ffi_abi; |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2231 |
#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2232 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2233 |
/* ---- Definitions for closures ----------------------------------------- */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2234 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2235 |
#define FFI_CLOSURES 1 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2236 |
#define FFI_NATIVE_RAW_API 0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2237 |
+#if defined (POWERPC) || defined (POWERPC_FREEBSD) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2238 |
+# define FFI_TARGET_SPECIFIC_VARIADIC 1 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2239 |
+# define FFI_EXTRA_CIF_FIELDS unsigned nfixedargs |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2240 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2241 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2242 |
/* For additional types like the below, take care about the order in |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2243 |
ppc_closures.S. They must follow after the FFI_TYPE_LAST. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2244 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2245 |
/* Needed for soft-float long-double-128 support. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2246 |
#define FFI_TYPE_UINT128 (FFI_TYPE_LAST + 1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2247 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2248 |
/* Needed for FFI_SYSV small structure returns. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2249 |
We use two flag bits, (FLAG_SYSV_SMST_R3, FLAG_SYSV_SMST_R4) which are |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2250 |
defined in ffi.c, to determine the exact return type and its size. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2251 |
#define FFI_SYSV_TYPE_SMALL_STRUCT (FFI_TYPE_LAST + 2) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2252 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2253 |
-#if defined(POWERPC64) || defined(POWERPC_AIX) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2254 |
-#define FFI_TRAMPOLINE_SIZE 24 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2255 |
-#else /* POWERPC || POWERPC_AIX */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2256 |
-#define FFI_TRAMPOLINE_SIZE 40 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2257 |
+/* Used by ELFv2 for homogenous structure returns. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2258 |
+#define FFI_V2_TYPE_FLOAT_HOMOG (FFI_TYPE_LAST + 1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2259 |
+#define FFI_V2_TYPE_DOUBLE_HOMOG (FFI_TYPE_LAST + 2) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2260 |
+#define FFI_V2_TYPE_SMALL_STRUCT (FFI_TYPE_LAST + 3) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2261 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2262 |
+#if _CALL_ELF == 2 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2263 |
+# define FFI_TRAMPOLINE_SIZE 32 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2264 |
+#else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2265 |
+# if defined(POWERPC64) || defined(POWERPC_AIX) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2266 |
+# define FFI_TRAMPOLINE_SIZE 24 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2267 |
+# else /* POWERPC || POWERPC_AIX */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2268 |
+# define FFI_TRAMPOLINE_SIZE 40 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2269 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2270 |
#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2271 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2272 |
#ifndef LIBFFI_ASM |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2273 |
#if defined(POWERPC_DARWIN) || defined(POWERPC_AIX) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2274 |
struct ffi_aix_trampoline_struct { |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2275 |
void * code_pointer; /* Pointer to ffi_closure_ASM */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2276 |
void * toc; /* TOC */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2277 |
void * static_chain; /* Pointer to closure */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2278 |
diff --git a/js/src/ctypes/libffi/src/powerpc/linux64.S b/js/src/ctypes/libffi/src/powerpc/linux64.S |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2279 |
--- a/js/src/ctypes/libffi/src/powerpc/linux64.S |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2280 |
+++ b/js/src/ctypes/libffi/src/powerpc/linux64.S |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2281 |
@@ -25,56 +25,86 @@ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2282 |
DEALINGS IN THE SOFTWARE. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2283 |
----------------------------------------------------------------------- */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2284 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2285 |
#define LIBFFI_ASM |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2286 |
#include <fficonfig.h> |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2287 |
#include <ffi.h> |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2288 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2289 |
#ifdef __powerpc64__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2290 |
- .hidden ffi_call_LINUX64, .ffi_call_LINUX64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2291 |
- .globl ffi_call_LINUX64, .ffi_call_LINUX64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2292 |
+ .hidden ffi_call_LINUX64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2293 |
+ .globl ffi_call_LINUX64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2294 |
+# if _CALL_ELF == 2 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2295 |
+ .text |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2296 |
+ffi_call_LINUX64: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2297 |
+ addis %r2, %r12, .TOC.-ffi_call_LINUX64@ha |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2298 |
+ addi %r2, %r2, .TOC.-ffi_call_LINUX64@l |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2299 |
+ .localentry ffi_call_LINUX64, . - ffi_call_LINUX64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2300 |
+# else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2301 |
.section ".opd","aw" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2302 |
.align 3 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2303 |
ffi_call_LINUX64: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2304 |
+# ifdef _CALL_LINUX |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2305 |
+ .quad .L.ffi_call_LINUX64,.TOC.@tocbase,0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2306 |
+ .type ffi_call_LINUX64,@function |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2307 |
+ .text |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2308 |
+.L.ffi_call_LINUX64: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2309 |
+# else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2310 |
+ .hidden .ffi_call_LINUX64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2311 |
+ .globl .ffi_call_LINUX64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2312 |
.quad .ffi_call_LINUX64,.TOC.@tocbase,0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2313 |
.size ffi_call_LINUX64,24 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2314 |
.type .ffi_call_LINUX64,@function |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2315 |
.text |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2316 |
.ffi_call_LINUX64: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2317 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2318 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2319 |
.LFB1: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2320 |
mflr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2321 |
std %r28, -32(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2322 |
std %r29, -24(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2323 |
std %r30, -16(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2324 |
std %r31, -8(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2325 |
std %r0, 16(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2326 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2327 |
mr %r28, %r1 /* our AP. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2328 |
.LCFI0: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2329 |
stdux %r1, %r1, %r4 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2330 |
mr %r31, %r5 /* flags, */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2331 |
mr %r30, %r6 /* rvalue, */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2332 |
mr %r29, %r7 /* function address. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2333 |
+/* Save toc pointer, not for the ffi_prep_args64 call, but for the later |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2334 |
+ bctrl function call. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2335 |
+# if _CALL_ELF == 2 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2336 |
+ std %r2, 24(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2337 |
+# else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2338 |
std %r2, 40(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2339 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2340 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2341 |
/* Call ffi_prep_args64. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2342 |
mr %r4, %r1 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2343 |
+# if defined _CALL_LINUX || _CALL_ELF == 2 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2344 |
+ bl ffi_prep_args64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2345 |
+# else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2346 |
bl .ffi_prep_args64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2347 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2348 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2349 |
- ld %r0, 0(%r29) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2350 |
+# if _CALL_ELF == 2 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2351 |
+ mr %r12, %r29 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2352 |
+# else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2353 |
+ ld %r12, 0(%r29) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2354 |
ld %r2, 8(%r29) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2355 |
ld %r11, 16(%r29) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2356 |
- |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2357 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2358 |
/* Now do the call. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2359 |
/* Set up cr1 with bits 4-7 of the flags. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2360 |
mtcrf 0x40, %r31 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2361 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2362 |
/* Get the address to call into CTR. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2363 |
- mtctr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2364 |
+ mtctr %r12 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2365 |
/* Load all those argument registers. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2366 |
ld %r3, -32-(8*8)(%r28) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2367 |
ld %r4, -32-(7*8)(%r28) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2368 |
ld %r5, -32-(6*8)(%r28) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2369 |
ld %r6, -32-(5*8)(%r28) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2370 |
bf- 5, 1f |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2371 |
ld %r7, -32-(4*8)(%r28) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2372 |
ld %r8, -32-(3*8)(%r28) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2373 |
@@ -99,50 +129,93 @@ 1: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2374 |
lfd %f13, -32-(9*8)(%r28) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2375 |
2: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2376 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2377 |
/* Make the call. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2378 |
bctrl |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2379 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2380 |
/* This must follow the call immediately, the unwinder |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2381 |
uses this to find out if r2 has been saved or not. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2382 |
+# if _CALL_ELF == 2 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2383 |
+ ld %r2, 24(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2384 |
+# else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2385 |
ld %r2, 40(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2386 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2387 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2388 |
/* Now, deal with the return value. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2389 |
mtcrf 0x01, %r31 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2390 |
- bt- 30, .Ldone_return_value |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2391 |
- bt- 29, .Lfp_return_value |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2392 |
+ bt 31, .Lstruct_return_value |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2393 |
+ bt 30, .Ldone_return_value |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2394 |
+ bt 29, .Lfp_return_value |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2395 |
std %r3, 0(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2396 |
/* Fall through... */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2397 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2398 |
.Ldone_return_value: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2399 |
/* Restore the registers we used and return. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2400 |
mr %r1, %r28 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2401 |
ld %r0, 16(%r28) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2402 |
- ld %r28, -32(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2403 |
+ ld %r28, -32(%r28) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2404 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2405 |
ld %r29, -24(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2406 |
ld %r30, -16(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2407 |
ld %r31, -8(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2408 |
blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2409 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2410 |
.Lfp_return_value: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2411 |
bf 28, .Lfloat_return_value |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2412 |
stfd %f1, 0(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2413 |
mtcrf 0x02, %r31 /* cr6 */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2414 |
bf 27, .Ldone_return_value |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2415 |
stfd %f2, 8(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2416 |
b .Ldone_return_value |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2417 |
.Lfloat_return_value: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2418 |
stfs %f1, 0(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2419 |
b .Ldone_return_value |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2420 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2421 |
+.Lstruct_return_value: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2422 |
+ bf 29, .Lsmall_struct |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2423 |
+ bf 28, .Lfloat_homog_return_value |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2424 |
+ stfd %f1, 0(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2425 |
+ stfd %f2, 8(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2426 |
+ stfd %f3, 16(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2427 |
+ stfd %f4, 24(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2428 |
+ stfd %f5, 32(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2429 |
+ stfd %f6, 40(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2430 |
+ stfd %f7, 48(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2431 |
+ stfd %f8, 56(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2432 |
+ b .Ldone_return_value |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2433 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2434 |
+.Lfloat_homog_return_value: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2435 |
+ stfs %f1, 0(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2436 |
+ stfs %f2, 4(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2437 |
+ stfs %f3, 8(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2438 |
+ stfs %f4, 12(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2439 |
+ stfs %f5, 16(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2440 |
+ stfs %f6, 20(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2441 |
+ stfs %f7, 24(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2442 |
+ stfs %f8, 28(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2443 |
+ b .Ldone_return_value |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2444 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2445 |
+.Lsmall_struct: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2446 |
+ std %r3, 0(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2447 |
+ std %r4, 8(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2448 |
+ b .Ldone_return_value |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2449 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2450 |
.LFE1: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2451 |
.long 0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2452 |
.byte 0,12,0,1,128,4,0,0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2453 |
+# if _CALL_ELF == 2 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2454 |
+ .size ffi_call_LINUX64,.-ffi_call_LINUX64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2455 |
+# else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2456 |
+# ifdef _CALL_LINUX |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2457 |
+ .size ffi_call_LINUX64,.-.L.ffi_call_LINUX64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2458 |
+# else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2459 |
.size .ffi_call_LINUX64,.-.ffi_call_LINUX64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2460 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2461 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2462 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2463 |
.section .eh_frame,EH_FRAME_FLAGS,@progbits |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2464 |
.Lframe1: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2465 |
.4byte .LECIE1-.LSCIE1 # Length of Common Information Entry |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2466 |
.LSCIE1: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2467 |
.4byte 0x0 # CIE Identifier Tag |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2468 |
.byte 0x1 # CIE Version |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2469 |
.ascii "zR\0" # CIE Augmentation |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2470 |
@@ -175,13 +248,13 @@ 2: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2471 |
.byte 0x9e # DW_CFA_offset, column 0x1e |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2472 |
.uleb128 0x2 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2473 |
.byte 0x9d # DW_CFA_offset, column 0x1d |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2474 |
.uleb128 0x3 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2475 |
.byte 0x9c # DW_CFA_offset, column 0x1c |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2476 |
.uleb128 0x4 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2477 |
.align 3 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2478 |
.LEFDE1: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2479 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2480 |
+# if (defined __ELF__ && defined __linux__) || _CALL_ELF == 2 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2481 |
+ .section .note.GNU-stack,"",@progbits |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2482 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2483 |
#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2484 |
- |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2485 |
-#if defined __ELF__ && defined __linux__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2486 |
- .section .note.GNU-stack,"",@progbits |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2487 |
-#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2488 |
diff --git a/js/src/ctypes/libffi/src/powerpc/linux64_closure.S b/js/src/ctypes/libffi/src/powerpc/linux64_closure.S |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2489 |
--- a/js/src/ctypes/libffi/src/powerpc/linux64_closure.S |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2490 |
+++ b/js/src/ctypes/libffi/src/powerpc/linux64_closure.S |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2491 |
@@ -27,179 +27,330 @@ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2492 |
#define LIBFFI_ASM |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2493 |
#include <fficonfig.h> |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2494 |
#include <ffi.h> |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2495 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2496 |
.file "linux64_closure.S" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2497 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2498 |
#ifdef __powerpc64__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2499 |
FFI_HIDDEN (ffi_closure_LINUX64) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2500 |
- FFI_HIDDEN (.ffi_closure_LINUX64) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2501 |
- .globl ffi_closure_LINUX64, .ffi_closure_LINUX64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2502 |
+ .globl ffi_closure_LINUX64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2503 |
+# if _CALL_ELF == 2 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2504 |
+ .text |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2505 |
+ffi_closure_LINUX64: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2506 |
+ addis %r2, %r12, .TOC.-ffi_closure_LINUX64@ha |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2507 |
+ addi %r2, %r2, .TOC.-ffi_closure_LINUX64@l |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2508 |
+ .localentry ffi_closure_LINUX64, . - ffi_closure_LINUX64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2509 |
+# else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2510 |
.section ".opd","aw" |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2511 |
.align 3 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2512 |
ffi_closure_LINUX64: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2513 |
+# ifdef _CALL_LINUX |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2514 |
+ .quad .L.ffi_closure_LINUX64,.TOC.@tocbase,0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2515 |
+ .type ffi_closure_LINUX64,@function |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2516 |
+ .text |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2517 |
+.L.ffi_closure_LINUX64: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2518 |
+# else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2519 |
+ FFI_HIDDEN (.ffi_closure_LINUX64) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2520 |
+ .globl .ffi_closure_LINUX64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2521 |
.quad .ffi_closure_LINUX64,.TOC.@tocbase,0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2522 |
.size ffi_closure_LINUX64,24 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2523 |
.type .ffi_closure_LINUX64,@function |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2524 |
.text |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2525 |
.ffi_closure_LINUX64: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2526 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2527 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2528 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2529 |
+# if _CALL_ELF == 2 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2530 |
+# 32 byte special reg save area + 64 byte parm save area |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2531 |
+# + 64 byte retval area + 13*8 fpr save area + round to 16 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2532 |
+# define STACKFRAME 272 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2533 |
+# define PARMSAVE 32 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2534 |
+# define RETVAL PARMSAVE+64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2535 |
+# else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2536 |
+# 48 bytes special reg save area + 64 bytes parm save area |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2537 |
+# + 16 bytes retval area + 13*8 bytes fpr save area + round to 16 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2538 |
+# define STACKFRAME 240 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2539 |
+# define PARMSAVE 48 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2540 |
+# define RETVAL PARMSAVE+64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2541 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2542 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2543 |
.LFB1: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2544 |
- # save general regs into parm save area |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2545 |
- std %r3, 48(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2546 |
- std %r4, 56(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2547 |
- std %r5, 64(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2548 |
- std %r6, 72(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2549 |
+# if _CALL_ELF == 2 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2550 |
+ ld %r12, FFI_TRAMPOLINE_SIZE(%r11) # closure->cif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2551 |
mflr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2552 |
+ lwz %r12, 28(%r12) # cif->flags |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2553 |
+ mtcrf 0x40, %r12 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2554 |
+ addi %r12, %r1, PARMSAVE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2555 |
+ bt 7, .Lparmsave |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2556 |
+ # Our caller has not allocated a parameter save area. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2557 |
+ # We need to allocate one here and use it to pass gprs to |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2558 |
+ # ffi_closure_helper_LINUX64. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2559 |
+ addi %r12, %r1, -STACKFRAME+PARMSAVE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2560 |
+.Lparmsave: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2561 |
+ std %r0, 16(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2562 |
+ # Save general regs into parm save area |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2563 |
+ std %r3, 0(%r12) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2564 |
+ std %r4, 8(%r12) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2565 |
+ std %r5, 16(%r12) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2566 |
+ std %r6, 24(%r12) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2567 |
+ std %r7, 32(%r12) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2568 |
+ std %r8, 40(%r12) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2569 |
+ std %r9, 48(%r12) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2570 |
+ std %r10, 56(%r12) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2571 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2572 |
- std %r7, 80(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2573 |
- std %r8, 88(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2574 |
- std %r9, 96(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2575 |
- std %r10, 104(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2576 |
+ # load up the pointer to the parm save area |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2577 |
+ mr %r5, %r12 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2578 |
+# else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2579 |
+ mflr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2580 |
+ # Save general regs into parm save area |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2581 |
+ # This is the parameter save area set up by our caller. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2582 |
+ std %r3, PARMSAVE+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2583 |
+ std %r4, PARMSAVE+8(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2584 |
+ std %r5, PARMSAVE+16(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2585 |
+ std %r6, PARMSAVE+24(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2586 |
+ std %r7, PARMSAVE+32(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2587 |
+ std %r8, PARMSAVE+40(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2588 |
+ std %r9, PARMSAVE+48(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2589 |
+ std %r10, PARMSAVE+56(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2590 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2591 |
std %r0, 16(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2592 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2593 |
- # mandatory 48 bytes special reg save area + 64 bytes parm save area |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2594 |
- # + 16 bytes retval area + 13*8 bytes fpr save area + round to 16 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2595 |
- stdu %r1, -240(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2596 |
+ # load up the pointer to the parm save area |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2597 |
+ addi %r5, %r1, PARMSAVE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2598 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2599 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2600 |
+ # next save fpr 1 to fpr 13 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2601 |
+ stfd %f1, -104+(0*8)(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2602 |
+ stfd %f2, -104+(1*8)(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2603 |
+ stfd %f3, -104+(2*8)(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2604 |
+ stfd %f4, -104+(3*8)(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2605 |
+ stfd %f5, -104+(4*8)(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2606 |
+ stfd %f6, -104+(5*8)(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2607 |
+ stfd %f7, -104+(6*8)(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2608 |
+ stfd %f8, -104+(7*8)(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2609 |
+ stfd %f9, -104+(8*8)(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2610 |
+ stfd %f10, -104+(9*8)(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2611 |
+ stfd %f11, -104+(10*8)(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2612 |
+ stfd %f12, -104+(11*8)(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2613 |
+ stfd %f13, -104+(12*8)(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2614 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2615 |
+ # load up the pointer to the saved fpr registers */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2616 |
+ addi %r6, %r1, -104 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2617 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2618 |
+ # load up the pointer to the result storage |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2619 |
+ addi %r4, %r1, -STACKFRAME+RETVAL |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2620 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2621 |
+ stdu %r1, -STACKFRAME(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2622 |
.LCFI0: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2623 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2624 |
- # next save fpr 1 to fpr 13 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2625 |
- stfd %f1, 128+(0*8)(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2626 |
- stfd %f2, 128+(1*8)(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2627 |
- stfd %f3, 128+(2*8)(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2628 |
- stfd %f4, 128+(3*8)(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2629 |
- stfd %f5, 128+(4*8)(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2630 |
- stfd %f6, 128+(5*8)(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2631 |
- stfd %f7, 128+(6*8)(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2632 |
- stfd %f8, 128+(7*8)(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2633 |
- stfd %f9, 128+(8*8)(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2634 |
- stfd %f10, 128+(9*8)(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2635 |
- stfd %f11, 128+(10*8)(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2636 |
- stfd %f12, 128+(11*8)(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2637 |
- stfd %f13, 128+(12*8)(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2638 |
- |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2639 |
- # set up registers for the routine that actually does the work |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2640 |
# get the context pointer from the trampoline |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2641 |
- mr %r3, %r11 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2642 |
- |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2643 |
- # now load up the pointer to the result storage |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2644 |
- addi %r4, %r1, 112 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2645 |
- |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2646 |
- # now load up the pointer to the parameter save area |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2647 |
- # in the previous frame |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2648 |
- addi %r5, %r1, 240 + 48 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2649 |
- |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2650 |
- # now load up the pointer to the saved fpr registers */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2651 |
- addi %r6, %r1, 128 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2652 |
+ mr %r3, %r11 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2653 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2654 |
# make the call |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2655 |
+# if defined _CALL_LINUX || _CALL_ELF == 2 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2656 |
+ bl ffi_closure_helper_LINUX64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2657 |
+# else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2658 |
bl .ffi_closure_helper_LINUX64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2659 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2660 |
.Lret: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2661 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2662 |
# now r3 contains the return type |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2663 |
# so use it to look up in a table |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2664 |
# so we know how to deal with each type |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2665 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2666 |
# look up the proper starting point in table |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2667 |
# by using return type as offset |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2668 |
+ ld %r0, STACKFRAME+16(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2669 |
+ cmpldi %r3, FFI_V2_TYPE_SMALL_STRUCT |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2670 |
+ bge .Lsmall |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2671 |
mflr %r4 # move address of .Lret to r4 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2672 |
sldi %r3, %r3, 4 # now multiply return type by 16 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2673 |
addi %r4, %r4, .Lret_type0 - .Lret |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2674 |
- ld %r0, 240+16(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2675 |
add %r3, %r3, %r4 # add contents of table to table address |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2676 |
mtctr %r3 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2677 |
bctr # jump to it |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2678 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2679 |
# Each of the ret_typeX code fragments has to be exactly 16 bytes long |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2680 |
# (4 instructions). For cache effectiveness we align to a 16 byte boundary |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2681 |
# first. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2682 |
.align 4 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2683 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2684 |
.Lret_type0: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2685 |
# case FFI_TYPE_VOID |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2686 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2687 |
- addi %r1, %r1, 240 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2688 |
+ addi %r1, %r1, STACKFRAME |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2689 |
blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2690 |
nop |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2691 |
# case FFI_TYPE_INT |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2692 |
- lwa %r3, 112+4(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2693 |
+# ifdef __LITTLE_ENDIAN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2694 |
+ lwa %r3, RETVAL+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2695 |
+# else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2696 |
+ lwa %r3, RETVAL+4(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2697 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2698 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2699 |
- addi %r1, %r1, 240 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2700 |
+ addi %r1, %r1, STACKFRAME |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2701 |
blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2702 |
# case FFI_TYPE_FLOAT |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2703 |
- lfs %f1, 112+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2704 |
+ lfs %f1, RETVAL+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2705 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2706 |
- addi %r1, %r1, 240 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2707 |
+ addi %r1, %r1, STACKFRAME |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2708 |
blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2709 |
# case FFI_TYPE_DOUBLE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2710 |
- lfd %f1, 112+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2711 |
+ lfd %f1, RETVAL+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2712 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2713 |
- addi %r1, %r1, 240 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2714 |
+ addi %r1, %r1, STACKFRAME |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2715 |
blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2716 |
# case FFI_TYPE_LONGDOUBLE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2717 |
- lfd %f1, 112+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2718 |
+ lfd %f1, RETVAL+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2719 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2720 |
- lfd %f2, 112+8(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2721 |
+ lfd %f2, RETVAL+8(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2722 |
b .Lfinish |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2723 |
# case FFI_TYPE_UINT8 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2724 |
- lbz %r3, 112+7(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2725 |
+# ifdef __LITTLE_ENDIAN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2726 |
+ lbz %r3, RETVAL+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2727 |
+# else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2728 |
+ lbz %r3, RETVAL+7(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2729 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2730 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2731 |
- addi %r1, %r1, 240 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2732 |
+ addi %r1, %r1, STACKFRAME |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2733 |
blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2734 |
# case FFI_TYPE_SINT8 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2735 |
- lbz %r3, 112+7(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2736 |
+# ifdef __LITTLE_ENDIAN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2737 |
+ lbz %r3, RETVAL+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2738 |
+# else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2739 |
+ lbz %r3, RETVAL+7(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2740 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2741 |
extsb %r3,%r3 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2742 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2743 |
b .Lfinish |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2744 |
# case FFI_TYPE_UINT16 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2745 |
- lhz %r3, 112+6(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2746 |
+# ifdef __LITTLE_ENDIAN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2747 |
+ lhz %r3, RETVAL+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2748 |
+# else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2749 |
+ lhz %r3, RETVAL+6(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2750 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2751 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2752 |
.Lfinish: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2753 |
- addi %r1, %r1, 240 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2754 |
+ addi %r1, %r1, STACKFRAME |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2755 |
blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2756 |
# case FFI_TYPE_SINT16 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2757 |
- lha %r3, 112+6(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2758 |
+# ifdef __LITTLE_ENDIAN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2759 |
+ lha %r3, RETVAL+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2760 |
+# else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2761 |
+ lha %r3, RETVAL+6(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2762 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2763 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2764 |
- addi %r1, %r1, 240 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2765 |
+ addi %r1, %r1, STACKFRAME |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2766 |
blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2767 |
# case FFI_TYPE_UINT32 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2768 |
- lwz %r3, 112+4(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2769 |
+# ifdef __LITTLE_ENDIAN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2770 |
+ lwz %r3, RETVAL+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2771 |
+# else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2772 |
+ lwz %r3, RETVAL+4(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2773 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2774 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2775 |
- addi %r1, %r1, 240 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2776 |
+ addi %r1, %r1, STACKFRAME |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2777 |
blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2778 |
# case FFI_TYPE_SINT32 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2779 |
- lwa %r3, 112+4(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2780 |
+# ifdef __LITTLE_ENDIAN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2781 |
+ lwa %r3, RETVAL+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2782 |
+# else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2783 |
+ lwa %r3, RETVAL+4(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2784 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2785 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2786 |
- addi %r1, %r1, 240 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2787 |
+ addi %r1, %r1, STACKFRAME |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2788 |
blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2789 |
# case FFI_TYPE_UINT64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2790 |
- ld %r3, 112+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2791 |
+ ld %r3, RETVAL+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2792 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2793 |
- addi %r1, %r1, 240 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2794 |
+ addi %r1, %r1, STACKFRAME |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2795 |
blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2796 |
# case FFI_TYPE_SINT64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2797 |
- ld %r3, 112+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2798 |
+ ld %r3, RETVAL+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2799 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2800 |
- addi %r1, %r1, 240 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2801 |
+ addi %r1, %r1, STACKFRAME |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2802 |
blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2803 |
# case FFI_TYPE_STRUCT |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2804 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2805 |
- addi %r1, %r1, 240 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2806 |
+ addi %r1, %r1, STACKFRAME |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2807 |
blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2808 |
nop |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2809 |
# case FFI_TYPE_POINTER |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2810 |
- ld %r3, 112+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2811 |
+ ld %r3, RETVAL+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2812 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2813 |
- addi %r1, %r1, 240 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2814 |
+ addi %r1, %r1, STACKFRAME |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2815 |
blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2816 |
-# esac |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2817 |
+# case FFI_V2_TYPE_FLOAT_HOMOG |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2818 |
+ lfs %f1, RETVAL+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2819 |
+ lfs %f2, RETVAL+4(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2820 |
+ lfs %f3, RETVAL+8(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2821 |
+ b .Lmorefloat |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2822 |
+# case FFI_V2_TYPE_DOUBLE_HOMOG |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2823 |
+ lfd %f1, RETVAL+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2824 |
+ lfd %f2, RETVAL+8(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2825 |
+ lfd %f3, RETVAL+16(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2826 |
+ lfd %f4, RETVAL+24(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2827 |
+ mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2828 |
+ lfd %f5, RETVAL+32(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2829 |
+ lfd %f6, RETVAL+40(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2830 |
+ lfd %f7, RETVAL+48(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2831 |
+ lfd %f8, RETVAL+56(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2832 |
+ addi %r1, %r1, STACKFRAME |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2833 |
+ blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2834 |
+.Lmorefloat: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2835 |
+ lfs %f4, RETVAL+12(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2836 |
+ mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2837 |
+ lfs %f5, RETVAL+16(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2838 |
+ lfs %f6, RETVAL+20(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2839 |
+ lfs %f7, RETVAL+24(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2840 |
+ lfs %f8, RETVAL+28(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2841 |
+ addi %r1, %r1, STACKFRAME |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2842 |
+ blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2843 |
+.Lsmall: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2844 |
+# ifdef __LITTLE_ENDIAN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2845 |
+ ld %r3,RETVAL+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2846 |
+ mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2847 |
+ ld %r4,RETVAL+8(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2848 |
+ addi %r1, %r1, STACKFRAME |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2849 |
+ blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2850 |
+# else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2851 |
+ # A struct smaller than a dword is returned in the low bits of r3 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2852 |
+ # ie. right justified. Larger structs are passed left justified |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2853 |
+ # in r3 and r4. The return value area on the stack will have |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2854 |
+ # the structs as they are usually stored in memory. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2855 |
+ cmpldi %r3, FFI_V2_TYPE_SMALL_STRUCT + 7 # size 8 bytes? |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2856 |
+ neg %r5, %r3 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2857 |
+ ld %r3,RETVAL+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2858 |
+ blt .Lsmalldown |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2859 |
+ mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2860 |
+ ld %r4,RETVAL+8(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2861 |
+ addi %r1, %r1, STACKFRAME |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2862 |
+ blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2863 |
+.Lsmalldown: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2864 |
+ addi %r5, %r5, FFI_V2_TYPE_SMALL_STRUCT + 7 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2865 |
+ mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2866 |
+ sldi %r5, %r5, 3 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2867 |
+ addi %r1, %r1, STACKFRAME |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2868 |
+ srd %r3, %r3, %r5 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2869 |
+ blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2870 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2871 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2872 |
.LFE1: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2873 |
.long 0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2874 |
.byte 0,12,0,1,128,0,0,0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2875 |
+# if _CALL_ELF == 2 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2876 |
+ .size ffi_closure_LINUX64,.-ffi_closure_LINUX64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2877 |
+# else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2878 |
+# ifdef _CALL_LINUX |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2879 |
+ .size ffi_closure_LINUX64,.-.L.ffi_closure_LINUX64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2880 |
+# else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2881 |
.size .ffi_closure_LINUX64,.-.ffi_closure_LINUX64 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2882 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2883 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2884 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2885 |
.section .eh_frame,EH_FRAME_FLAGS,@progbits |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2886 |
.Lframe1: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2887 |
.4byte .LECIE1-.LSCIE1 # Length of Common Information Entry |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2888 |
.LSCIE1: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2889 |
.4byte 0x0 # CIE Identifier Tag |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2890 |
.byte 0x1 # CIE Version |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2891 |
.ascii "zR\0" # CIE Augmentation |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2892 |
@@ -218,19 +369,19 @@ ffi_closure_LINUX64: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2893 |
.LASFDE1: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2894 |
.4byte .LASFDE1-.Lframe1 # FDE CIE offset |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2895 |
.8byte .LFB1-. # FDE initial location |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2896 |
.8byte .LFE1-.LFB1 # FDE address range |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2897 |
.uleb128 0x0 # Augmentation size |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2898 |
.byte 0x2 # DW_CFA_advance_loc1 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2899 |
.byte .LCFI0-.LFB1 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2900 |
.byte 0xe # DW_CFA_def_cfa_offset |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2901 |
- .uleb128 240 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2902 |
+ .uleb128 STACKFRAME |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2903 |
.byte 0x11 # DW_CFA_offset_extended_sf |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2904 |
.uleb128 0x41 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2905 |
.sleb128 -2 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2906 |
.align 3 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2907 |
.LEFDE1: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2908 |
+ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2909 |
+# if defined __ELF__ && defined __linux__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2910 |
+ .section .note.GNU-stack,"",@progbits |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2911 |
+# endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2912 |
#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2913 |
- |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2914 |
-#if defined __ELF__ && defined __linux__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2915 |
- .section .note.GNU-stack,"",@progbits |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2916 |
-#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2917 |
diff --git a/js/src/ctypes/libffi/src/powerpc/ppc_closure.S b/js/src/ctypes/libffi/src/powerpc/ppc_closure.S |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2918 |
--- a/js/src/ctypes/libffi/src/powerpc/ppc_closure.S |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2919 |
+++ b/js/src/ctypes/libffi/src/powerpc/ppc_closure.S |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2920 |
@@ -117,53 +117,88 @@ ENTRY(ffi_closure_SYSV) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2921 |
# case FFI_TYPE_INT |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2922 |
lwz %r3,112+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2923 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2924 |
.Lfinish: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2925 |
addi %r1,%r1,144 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2926 |
blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2927 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2928 |
# case FFI_TYPE_FLOAT |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2929 |
+#ifndef __NO_FPRS__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2930 |
lfs %f1,112+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2931 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2932 |
addi %r1,%r1,144 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2933 |
+#else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2934 |
+ nop |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2935 |
+ nop |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2936 |
+ nop |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2937 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2938 |
blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2939 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2940 |
# case FFI_TYPE_DOUBLE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2941 |
+#ifndef __NO_FPRS__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2942 |
lfd %f1,112+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2943 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2944 |
addi %r1,%r1,144 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2945 |
+#else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2946 |
+ nop |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2947 |
+ nop |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2948 |
+ nop |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2949 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2950 |
blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2951 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2952 |
# case FFI_TYPE_LONGDOUBLE |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2953 |
+#ifndef __NO_FPRS__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2954 |
lfd %f1,112+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2955 |
lfd %f2,112+8(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2956 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2957 |
b .Lfinish |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2958 |
+#else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2959 |
+ nop |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2960 |
+ nop |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2961 |
+ nop |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2962 |
+ blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2963 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2964 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2965 |
# case FFI_TYPE_UINT8 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2966 |
+#ifdef __LITTLE_ENDIAN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2967 |
+ lbz %r3,112+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2968 |
+#else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2969 |
lbz %r3,112+3(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2970 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2971 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2972 |
addi %r1,%r1,144 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2973 |
blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2974 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2975 |
# case FFI_TYPE_SINT8 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2976 |
+#ifdef __LITTLE_ENDIAN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2977 |
+ lbz %r3,112+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2978 |
+#else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2979 |
lbz %r3,112+3(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2980 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2981 |
extsb %r3,%r3 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2982 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2983 |
b .Lfinish |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2984 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2985 |
# case FFI_TYPE_UINT16 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2986 |
+#ifdef __LITTLE_ENDIAN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2987 |
+ lhz %r3,112+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2988 |
+#else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2989 |
lhz %r3,112+2(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2990 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2991 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2992 |
addi %r1,%r1,144 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2993 |
blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2994 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2995 |
# case FFI_TYPE_SINT16 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2996 |
+#ifdef __LITTLE_ENDIAN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2997 |
+ lha %r3,112+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2998 |
+#else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2999 |
lha %r3,112+2(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3000 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3001 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3002 |
addi %r1,%r1,144 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3003 |
blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3004 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3005 |
# case FFI_TYPE_UINT32 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3006 |
lwz %r3,112+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3007 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3008 |
addi %r1,%r1,144 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3009 |
@@ -198,76 +233,99 @@ ENTRY(ffi_closure_SYSV) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3010 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3011 |
addi %r1,%r1,144 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3012 |
blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3013 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3014 |
# case FFI_TYPE_UINT128 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3015 |
lwz %r3,112+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3016 |
lwz %r4,112+4(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3017 |
lwz %r5,112+8(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3018 |
- bl .Luint128 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3019 |
+ b .Luint128 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3020 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3021 |
# The return types below are only used when the ABI type is FFI_SYSV. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3022 |
# case FFI_SYSV_TYPE_SMALL_STRUCT + 1. One byte struct. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3023 |
lbz %r3,112+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3024 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3025 |
addi %r1,%r1,144 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3026 |
blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3027 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3028 |
# case FFI_SYSV_TYPE_SMALL_STRUCT + 2. Two byte struct. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3029 |
lhz %r3,112+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3030 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3031 |
addi %r1,%r1,144 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3032 |
blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3033 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3034 |
# case FFI_SYSV_TYPE_SMALL_STRUCT + 3. Three byte struct. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3035 |
lwz %r3,112+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3036 |
+#ifdef __LITTLE_ENDIAN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3037 |
+ mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3038 |
+ addi %r1,%r1,144 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3039 |
+ blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3040 |
+#else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3041 |
srwi %r3,%r3,8 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3042 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3043 |
b .Lfinish |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3044 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3045 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3046 |
# case FFI_SYSV_TYPE_SMALL_STRUCT + 4. Four byte struct. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3047 |
lwz %r3,112+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3048 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3049 |
addi %r1,%r1,144 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3050 |
blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3051 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3052 |
# case FFI_SYSV_TYPE_SMALL_STRUCT + 5. Five byte struct. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3053 |
lwz %r3,112+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3054 |
lwz %r4,112+4(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3055 |
+#ifdef __LITTLE_ENDIAN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3056 |
+ mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3057 |
+ b .Lfinish |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3058 |
+#else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3059 |
li %r5,24 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3060 |
b .Lstruct567 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3061 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3062 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3063 |
# case FFI_SYSV_TYPE_SMALL_STRUCT + 6. Six byte struct. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3064 |
lwz %r3,112+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3065 |
lwz %r4,112+4(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3066 |
+#ifdef __LITTLE_ENDIAN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3067 |
+ mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3068 |
+ b .Lfinish |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3069 |
+#else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3070 |
li %r5,16 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3071 |
b .Lstruct567 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3072 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3073 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3074 |
# case FFI_SYSV_TYPE_SMALL_STRUCT + 7. Seven byte struct. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3075 |
lwz %r3,112+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3076 |
lwz %r4,112+4(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3077 |
+#ifdef __LITTLE_ENDIAN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3078 |
+ mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3079 |
+ b .Lfinish |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3080 |
+#else |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3081 |
li %r5,8 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3082 |
b .Lstruct567 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3083 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3084 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3085 |
# case FFI_SYSV_TYPE_SMALL_STRUCT + 8. Eight byte struct. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3086 |
lwz %r3,112+0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3087 |
lwz %r4,112+4(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3088 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3089 |
b .Lfinish |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3090 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3091 |
+#ifndef __LITTLE_ENDIAN__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3092 |
.Lstruct567: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3093 |
subfic %r6,%r5,32 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3094 |
srw %r4,%r4,%r5 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3095 |
slw %r6,%r3,%r6 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3096 |
srw %r3,%r3,%r5 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3097 |
or %r4,%r6,%r4 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3098 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3099 |
addi %r1,%r1,144 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3100 |
blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3101 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3102 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3103 |
.Luint128: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3104 |
lwz %r6,112+12(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3105 |
mtlr %r0 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3106 |
addi %r1,%r1,144 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3107 |
blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3108 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3109 |
END(ffi_closure_SYSV) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3110 |
diff --git a/js/src/ctypes/libffi/src/powerpc/sysv.S b/js/src/ctypes/libffi/src/powerpc/sysv.S |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3111 |
--- a/js/src/ctypes/libffi/src/powerpc/sysv.S |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3112 |
+++ b/js/src/ctypes/libffi/src/powerpc/sysv.S |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3113 |
@@ -78,37 +78,41 @@ ENTRY(ffi_call_SYSV) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3114 |
nop |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3115 |
lwz %r7,-16-(4*4)(%r28) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3116 |
lwz %r8,-16-(3*4)(%r28) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3117 |
lwz %r9,-16-(2*4)(%r28) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3118 |
lwz %r10,-16-(1*4)(%r28) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3119 |
nop |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3120 |
1: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3121 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3122 |
+#ifndef __NO_FPRS__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3123 |
/* Load all the FP registers. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3124 |
bf- 6,2f |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3125 |
lfd %f1,-16-(8*4)-(8*8)(%r28) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3126 |
lfd %f2,-16-(8*4)-(7*8)(%r28) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3127 |
lfd %f3,-16-(8*4)-(6*8)(%r28) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3128 |
lfd %f4,-16-(8*4)-(5*8)(%r28) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3129 |
nop |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3130 |
lfd %f5,-16-(8*4)-(4*8)(%r28) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3131 |
lfd %f6,-16-(8*4)-(3*8)(%r28) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3132 |
lfd %f7,-16-(8*4)-(2*8)(%r28) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3133 |
lfd %f8,-16-(8*4)-(1*8)(%r28) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3134 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3135 |
2: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3136 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3137 |
/* Make the call. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3138 |
bctrl |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3139 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3140 |
/* Now, deal with the return value. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3141 |
mtcrf 0x01,%r31 /* cr7 */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3142 |
bt- 31,L(small_struct_return_value) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3143 |
bt- 30,L(done_return_value) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3144 |
+#ifndef __NO_FPRS__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3145 |
bt- 29,L(fp_return_value) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3146 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3147 |
stw %r3,0(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3148 |
bf+ 28,L(done_return_value) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3149 |
stw %r4,4(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3150 |
mtcrf 0x02,%r31 /* cr6 */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3151 |
bf 27,L(done_return_value) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3152 |
stw %r5,8(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3153 |
stw %r6,12(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3154 |
/* Fall through... */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3155 |
@@ -119,41 +123,38 @@ L(done_return_value): |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3156 |
lwz %r31, -4(%r28) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3157 |
mtlr %r9 |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3158 |
lwz %r30, -8(%r28) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3159 |
lwz %r29,-12(%r28) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3160 |
lwz %r28,-16(%r28) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3161 |
lwz %r1,0(%r1) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3162 |
blr |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3163 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3164 |
+#ifndef __NO_FPRS__ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3165 |
L(fp_return_value): |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3166 |
bf 28,L(float_return_value) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3167 |
stfd %f1,0(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3168 |
mtcrf 0x02,%r31 /* cr6 */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3169 |
bf 27,L(done_return_value) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3170 |
stfd %f2,8(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3171 |
b L(done_return_value) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3172 |
L(float_return_value): |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3173 |
stfs %f1,0(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3174 |
b L(done_return_value) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3175 |
+#endif |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3176 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3177 |
L(small_struct_return_value): |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3178 |
- extrwi %r6,%r31,2,19 /* number of bytes padding = shift/8 */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3179 |
- mtcrf 0x02,%r31 /* copy flags to cr[24:27] (cr6) */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3180 |
- extrwi %r5,%r31,5,19 /* r5 <- number of bits of padding */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3181 |
- subfic %r6,%r6,4 /* r6 <- number of useful bytes in r3 */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3182 |
- bf- 25,L(done_return_value) /* struct in r3 ? if not, done. */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3183 |
-/* smst_one_register: */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3184 |
- slw %r3,%r3,%r5 /* Left-justify value in r3 */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3185 |
- mtxer %r6 /* move byte count to XER ... */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3186 |
- stswx %r3,0,%r30 /* ... and store that many bytes */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3187 |
- bf+ 26,L(done_return_value) /* struct in r3:r4 ? */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3188 |
- add %r6,%r6,%r30 /* adjust pointer */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3189 |
- stswi %r4,%r6,4 /* store last four bytes */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3190 |
- b L(done_return_value) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3191 |
+ /* |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3192 |
+ * The C code always allocates a properly-aligned 8-byte bounce |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3193 |
+ * buffer to make this assembly code very simple. Just write out |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3194 |
+ * r3 and r4 to the buffer to allow the C code to handle the rest. |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3195 |
+ */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3196 |
+ stw %r3, 0(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3197 |
+ stw %r4, 4(%r30) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3198 |
+ b L(done_return_value) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3199 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3200 |
.LFE1: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3201 |
END(ffi_call_SYSV) |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3202 |
|
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3203 |
.section ".eh_frame",EH_FRAME_FLAGS,@progbits |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3204 |
.Lframe1: |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3205 |
.4byte .LECIE1-.LSCIE1 /* Length of Common Information Entry */ |
5341dc98d26c
update of PPC64LE patches taken from
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3206 |
.LSCIE1: |