Commit 16287148 by Andreas Tobler Committed by Andreas Tobler

re PR libffi/31937 (libffi doesn't support ppc without FPU)

2007-12-01  Andreas Tobler  <a.tobler@schweiz.org>

	PR libffi/31937
	* src/powerpc/ffitarget.h: Introduce new ABI FFI_LINUX_SOFT_FLOAT.
	Add local FFI_TYPE_UINT128 to handle soft-float long-double-128.
	* src/powerpc/ffi.c: Distinguish between __NO_FPRS__ and not and
	set the NUM_FPR_ARG_REGISTERS according to.
	Add support for potential soft-float support under hard-float
	architecture.
	(ffi_prep_args_SYSV): Set NUM_FPR_ARG_REGISTERS to 0 in case of
	FFI_LINUX_SOFT_FLOAT, handle float, doubles and long-doubles according
	to the FFI_LINUX_SOFT_FLOAT ABI.
	(ffi_prep_cif_machdep): Likewise.
	(ffi_closure_helper_SYSV): Likewise.
	* src/powerpc/ppc_closure.S: Make sure not to store float/double
	on archs where __NO_FPRS__ is true.
	Add FFI_TYPE_UINT128 support.
	* src/powerpc/sysv.S: Add support for soft-float long-double-128.
	Adjust copyright notice.

From-SVN: r130559
parent e78b91ce
2007-12-01 Andreas Tobler <a.tobler@schweiz.org>
PR libffi/31937
* src/powerpc/ffitarget.h: Introduce new ABI FFI_LINUX_SOFT_FLOAT.
Add local FFI_TYPE_UINT128 to handle soft-float long-double-128.
* src/powerpc/ffi.c: Distinguish between __NO_FPRS__ and not and
set the NUM_FPR_ARG_REGISTERS according to.
Add support for potential soft-float support under hard-float
architecture.
(ffi_prep_args_SYSV): Set NUM_FPR_ARG_REGISTERS to 0 in case of
FFI_LINUX_SOFT_FLOAT, handle float, doubles and long-doubles according
to the FFI_LINUX_SOFT_FLOAT ABI.
(ffi_prep_cif_machdep): Likewise.
(ffi_closure_helper_SYSV): Likewise.
* src/powerpc/ppc_closure.S: Make sure not to store float/double
on archs where __NO_FPRS__ is true.
Add FFI_TYPE_UINT128 support.
* src/powerpc/sysv.S: Add support for soft-float long-double-128.
Adjust copyright notice.
2007-11-25 Andreas Tobler <a.tobler@schweiz.org>
* src/closures.c: Move defintion of MAYBE_UNUSED from here to ...
......
/* -----------------------------------------------------------------*-C-*-
ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc.
Copyright (C) 2007 Free Software Foundation, Inc
Target configuration macros for PowerPC.
Permission is hereby granted, free of charge, to any person obtaining
......@@ -44,13 +45,18 @@ typedef enum ffi_abi {
FFI_GCC_SYSV,
FFI_LINUX64,
FFI_LINUX,
FFI_LINUX_SOFT_FLOAT,
# ifdef POWERPC64
FFI_DEFAULT_ABI = FFI_LINUX64,
# else
# if __LDBL_MANT_DIG__ == 106
# if (!defined(__NO_FPRS__) && (__LDBL_MANT_DIG__ == 106))
FFI_DEFAULT_ABI = FFI_LINUX,
# else
# ifdef __NO_FPRS__
FFI_DEFAULT_ABI = FFI_LINUX_SOFT_FLOAT,
# else
FFI_DEFAULT_ABI = FFI_GCC_SYSV,
# endif
# endif
# endif
#endif
......@@ -83,8 +89,14 @@ typedef enum ffi_abi {
#define FFI_CLOSURES 1
#define FFI_NATIVE_RAW_API 0
/* For additional types like the below, take care about the order in
ppc_closures.S. They must follow after the FFI_TYPE_LAST. */
/* Needed for soft-float long-double-128 support. */
#define FFI_TYPE_UINT128 (FFI_TYPE_LAST + 1)
/* Needed for FFI_SYSV small structure returns. */
#define FFI_SYSV_TYPE_SMALL_STRUCT (FFI_TYPE_LAST)
#define FFI_SYSV_TYPE_SMALL_STRUCT (FFI_TYPE_LAST + 2)
#if defined(POWERPC64) || defined(POWERPC_AIX)
#define FFI_TRAMPOLINE_SIZE 24
......
......@@ -28,6 +28,7 @@ ENTRY(ffi_closure_SYSV)
stw %r9, 40(%r1)
stw %r10,44(%r1)
#ifndef __NO_FPRS__
# next save fpr 1 to fpr 8 (aligned to 8)
stfd %f1, 48(%r1)
stfd %f2, 56(%r1)
......@@ -37,6 +38,7 @@ ENTRY(ffi_closure_SYSV)
stfd %f6, 88(%r1)
stfd %f7, 96(%r1)
stfd %f8, 104(%r1)
#endif
# set up registers for the routine that actually does the work
# get the context pointer from the trampoline
......@@ -171,6 +173,12 @@ ENTRY(ffi_closure_SYSV)
addi %r1,%r1,144
blr
# case FFI_TYPE_UINT128
lwz %r3,112+0(%r1)
lwz %r4,112+4(%r1)
lwz %r5,112+8(%r1)
bl .Luint128
# The return types below are only used when the ABI type is FFI_SYSV.
# case FFI_SYSV_TYPE_SMALL_STRUCT + 1. One byte struct.
lbz %r3,112+0(%r1)
......@@ -230,6 +238,12 @@ ENTRY(ffi_closure_SYSV)
addi %r1,%r1,144
blr
.Luint128:
lwz %r6,112+12(%r1)
mtlr %r0
addi %r1,%r1,144
blr
END(ffi_closure_SYSV)
.section ".eh_frame",EH_FRAME_FLAGS,@progbits
......
/* -----------------------------------------------------------------------
sysv.h - Copyright (c) 1998 Geoffrey Keating
sysv.S - Copyright (c) 1998 Geoffrey Keating
Copyright (C) 2007 Free Software Foundation, Inc
PowerPC Assembly glue.
......@@ -98,13 +99,17 @@ ENTRY(ffi_call_SYSV)
bctrl
/* Now, deal with the return value. */
mtcrf 0x01,%r31
mtcrf 0x01,%r31 /* cr7 */
bt- 31,L(small_struct_return_value)
bt- 30,L(done_return_value)
bt- 29,L(fp_return_value)
stw %r3,0(%r30)
bf+ 28,L(done_return_value)
stw %r4,4(%r30)
mtcrf 0x02,%r31 /* cr6 */
bf 27,L(done_return_value)
stw %r5,8(%r30)
stw %r6,12(%r30)
/* Fall through... */
L(done_return_value):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment