summaryrefslogtreecommitdiff
path: root/src/powerpc/sysv.S
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2013-11-16 06:52:43 -0500
committerAnthony Green <green@moxielogic.com>2013-11-16 06:52:43 -0500
commit362851379a49ce07d3e36e82c4e5c7b6cc16a352 (patch)
tree600aaac80362326f542e40d9da455a0b2d9cffaf /src/powerpc/sysv.S
parent1c06515d927d9de1582438d4eb5953890e79c5c7 (diff)
downloadlibffi-362851379a49ce07d3e36e82c4e5c7b6cc16a352.tar.gz
Andreas' 2013-02-08 change reverted some breakage for struct return
values from 2011-11-12, but in so doing reintroduced string instructions to sysv.S that are not supported on all powerpc variants. This patch properly copies the bounce buffer to destination in C code rather than in asm. I have tested this on powerpc64-linux, powerpc-linux and powerpc-freebsd. Well, the last on powerpc-linux by lying to configure with CC="gcc -m32 -msvr4-struct-return -mlong-double-64" \ CXX="g++ -m32 -msvr4-struct-return -mlong-double-64" \ /src/libffi-current/configure --build=powerpc-freebsd and then make && make CC="gcc -m32" CXX="g++ -m32" \ RUNTESTFLAGS=--target_board=unix/-m32/-msvr4-struct-return/-mlong-double-64\ check
Diffstat (limited to 'src/powerpc/sysv.S')
-rw-r--r--src/powerpc/sysv.S21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/powerpc/sysv.S b/src/powerpc/sysv.S
index 5ee3a19..675ed03 100644
--- a/src/powerpc/sysv.S
+++ b/src/powerpc/sysv.S
@@ -142,19 +142,14 @@ L(float_return_value):
#endif
L(small_struct_return_value):
- extrwi %r6,%r31,2,19 /* number of bytes padding = shift/8 */
- mtcrf 0x02,%r31 /* copy flags to cr[24:27] (cr6) */
- extrwi %r5,%r31,5,19 /* r5 <- number of bits of padding */
- subfic %r6,%r6,4 /* r6 <- number of useful bytes in r3 */
- bf- 25,L(done_return_value) /* struct in r3 ? if not, done. */
-/* smst_one_register: */
- slw %r3,%r3,%r5 /* Left-justify value in r3 */
- mtxer %r6 /* move byte count to XER ... */
- stswx %r3,0,%r30 /* ... and store that many bytes */
- bf+ 26,L(done_return_value) /* struct in r3:r4 ? */
- add %r6,%r6,%r30 /* adjust pointer */
- stswi %r4,%r6,4 /* store last four bytes */
- b L(done_return_value)
+ /*
+ * The C code always allocates a properly-aligned 8-byte bounce
+ * buffer to make this assembly code very simple. Just write out
+ * r3 and r4 to the buffer to allow the C code to handle the rest.
+ */
+ stw %r3, 0(%r30)
+ stw %r4, 4(%r30)
+ b L(done_return_value)
.LFE1:
END(ffi_call_SYSV)