004-09-02 Andreas Tobler <a.tobler@schweiz.ch>

* src/powerpc/aix.S: Remove whitespaces.
	* src/powerpc/aix_closure.S: Likewise.
	* src/powerpc/asm.h: Likewise.
	* src/powerpc/ffi.c: Likewise.
	* src/powerpc/ffitarget.h: Likewise.
	* src/powerpc/linux64.S: Likewise.
	* src/powerpc/linux64_closure.S: Likewise.
	* src/powerpc/ppc_closure.S: Likewise.
	* src/powerpc/sysv.S: Likewise.

From-SVN: r86991
This commit is contained in:
Andreas Tobler 2004-09-02 23:07:21 +02:00 committed by Andreas Tobler
parent 19dc705e0c
commit 16070e459c
10 changed files with 268 additions and 264 deletions

View File

@ -1,3 +1,15 @@
2004-09-02 Andreas Tobler <a.tobler@schweiz.ch>
* src/powerpc/aix.S: Remove whitespaces.
* src/powerpc/aix_closure.S: Likewise.
* src/powerpc/asm.h: Likewise.
* src/powerpc/ffi.c: Likewise.
* src/powerpc/ffitarget.h: Likewise.
* src/powerpc/linux64.S: Likewise.
* src/powerpc/linux64_closure.S: Likewise.
* src/powerpc/ppc_closure.S: Likewise.
* src/powerpc/sysv.S: Likewise.
2004-08-30 Anthony Green <green@redhat.com>
* Makefile.am: Add frv support.

View File

@ -24,60 +24,60 @@
OTHER DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */
.set r0,0
.set r1,1
.set r2,2
.set r3,3
.set r4,4
.set r5,5
.set r6,6
.set r7,7
.set r8,8
.set r9,9
.set r10,10
.set r11,11
.set r12,12
.set r13,13
.set r14,14
.set r15,15
.set r16,16
.set r17,17
.set r18,18
.set r19,19
.set r20,20
.set r21,21
.set r22,22
.set r23,23
.set r24,24
.set r25,25
.set r26,26
.set r27,27
.set r28,28
.set r29,29
.set r30,30
.set r31,31
.set f0,0
.set f1,1
.set f2,2
.set f3,3
.set f4,4
.set f5,5
.set f6,6
.set f7,7
.set f8,8
.set f9,9
.set f10,10
.set f11,11
.set f12,12
.set f13,13
.set f14,14
.set f15,15
.set f16,16
.set f17,17
.set f18,18
.set f19,19
.set f20,20
.set f21,21
.set r0,0
.set r1,1
.set r2,2
.set r3,3
.set r4,4
.set r5,5
.set r6,6
.set r7,7
.set r8,8
.set r9,9
.set r10,10
.set r11,11
.set r12,12
.set r13,13
.set r14,14
.set r15,15
.set r16,16
.set r17,17
.set r18,18
.set r19,19
.set r20,20
.set r21,21
.set r22,22
.set r23,23
.set r24,24
.set r25,25
.set r26,26
.set r27,27
.set r28,28
.set r29,29
.set r30,30
.set r31,31
.set f0,0
.set f1,1
.set f2,2
.set f3,3
.set f4,4
.set f5,5
.set f6,6
.set f7,7
.set f8,8
.set f9,9
.set f10,10
.set f11,11
.set f12,12
.set f13,13
.set f14,14
.set f15,15
.set f16,16
.set f17,17
.set f18,18
.set f19,19
.set f20,20
.set f21,21
#define LIBFFI_ASM
#include <fficonfig.h>

View File

@ -3,8 +3,6 @@
PowerPC Assembly glue.
$Id: asm.h,v 1.1.1.1 1998/11/29 16:48:16 green Exp $
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including
@ -50,12 +48,12 @@
#ifdef PIC
#define CALL_MCOUNT \
.pushsection; \
.section ".data"; \
.section ".data"; \
.align ALIGNARG(2); \
0:.long 0; \
.previous; \
mflr %r0; \
stw %r0,4(%r1); \
stw %r0,4(%r1); \
bl _GLOBAL_OFFSET_TABLE_@local-4; \
mflr %r11; \
lwz %r0,0b@got(%r11); \
@ -67,8 +65,8 @@
0:.long 0; \
.previous; \
mflr %r0; \
lis %r11,0b@ha; \
stw %r0,4(%r1); \
lis %r11,0b@ha; \
stw %r0,4(%r1); \
addi %r0,%r11,0b@l; \
bl JUMPTARGET(_mcount);
#endif /* PIC */
@ -125,4 +123,3 @@
/* Local labels stripped out by the linker. */
#define L(x) .L##x

View File

@ -3,8 +3,6 @@
PowerPC Foreign Function Interface
$Id: ffi.c,v 1.1.1.1 1998/11/29 16:48:16 green Exp $
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including
@ -67,7 +65,7 @@ enum { ASM_NEEDS_REGISTERS = 4 };
| Return address from ffi_call_SYSV 4bytes | higher addresses
|--------------------------------------------|
| Previous backchain pointer 4 | stack pointer here
| Previous backchain pointer 4 | stack pointer here
|--------------------------------------------|<+ <<< on entry to
| Saved r28-r31 4*4 | | ffi_call_SYSV
|--------------------------------------------| |
@ -84,7 +82,7 @@ enum { ASM_NEEDS_REGISTERS = 4 };
| Current backchain pointer 4 |-/ during
|--------------------------------------------| <<< ffi_call_SYSV
*/
*/
/*@-exportheader@*/
void ffi_prep_args_SYSV(extended_cif *ecif, unsigned *const stack)
@ -131,10 +129,10 @@ void ffi_prep_args_SYSV(extended_cif *ecif, unsigned *const stack)
/* Deal with return values that are actually pass-by-reference. */
if (flags & FLAG_RETVAL_REFERENCE)
{
*gpr_base++ = (unsigned long)(char *)ecif->rvalue;
intarg_count++;
}
{
*gpr_base++ = (unsigned long)(char *)ecif->rvalue;
intarg_count++;
}
/* Now for the arguments. */
p_argv = ecif->avalue;
@ -192,18 +190,18 @@ void ffi_prep_args_SYSV(extended_cif *ecif, unsigned *const stack)
}
else
{
/* whoops: abi states only certain register pairs
* can be used for passing long long int
* specifically (r3,r4), (r5,r6), (r7,r8),
* (r9,r10) and if next arg is long long but
* not correct starting register of pair then skip
* until the proper starting register
/* whoops: abi states only certain register pairs
* can be used for passing long long int
* specifically (r3,r4), (r5,r6), (r7,r8),
* (r9,r10) and if next arg is long long but
* not correct starting register of pair then skip
* until the proper starting register
*/
if (intarg_count%2 != 0)
{
intarg_count ++;
gpr_base++;
}
if (intarg_count%2 != 0)
{
intarg_count ++;
gpr_base++;
}
*(long long *)gpr_base = *(long long *)*p_argv;
gpr_base += 2;
}
@ -276,7 +274,7 @@ enum { ASM_NEEDS_REGISTERS64 = 4 };
|--------------------------------------------|
| CR save area 8bytes |
|--------------------------------------------|
| Previous backchain pointer 8 | stack pointer here
| Previous backchain pointer 8 | stack pointer here
|--------------------------------------------|<+ <<< on entry to
| Saved r28-r31 4*8 | | ffi_call_LINUX64
|--------------------------------------------| |
@ -299,7 +297,7 @@ enum { ASM_NEEDS_REGISTERS64 = 4 };
| Current backchain pointer 8 |-/ during
|--------------------------------------------| <<< ffi_call_LINUX64
*/
*/
/*@-exportheader@*/
void hidden ffi_prep_args64(extended_cif *ecif, unsigned long *const stack)
@ -314,7 +312,7 @@ void hidden ffi_prep_args64(extended_cif *ecif, unsigned long *const stack)
/* 'next_arg' points at the space for gpr3, and grows upwards as
we use GPR registers, then continues at rest. */
unsigned long *const gpr_base = stacktop - ASM_NEEDS_REGISTERS64
- NUM_GPR_ARG_REGISTERS64;
- NUM_GPR_ARG_REGISTERS64;
unsigned long *const gpr_end = gpr_base + NUM_GPR_ARG_REGISTERS64;
unsigned long *const rest = stack + 6 + NUM_GPR_ARG_REGISTERS64;
unsigned long *next_arg = gpr_base;
@ -497,10 +495,10 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
- 32-bit (or less) integer values are returned in gpr3;
- Structures of size <= 4 bytes also returned in gpr3;
- 64-bit integer values and structures between 5 and 8 bytes are returned
in gpr3 and gpr4;
in gpr3 and gpr4;
- Single/double FP values are returned in fpr1;
- Larger structures and long double (if not equivalent to double) values
are allocated space and a pointer is passed as the first argument.
are allocated space and a pointer is passed as the first argument.
For LINUX64:
- integer values in gpr3;
- Structures/Unions by reference;
@ -744,8 +742,8 @@ static void flush_icache(char * addr1, int size)
int i;
char * addr;
for (i = 0; i < size; i += MIN_CACHE_LINE_SIZE) {
addr = addr1 + i;
__asm__ volatile ("icbi 0,%0;" "dcbf 0,%0;" : : "r"(addr) : "memory");
addr = addr1 + i;
__asm__ volatile ("icbi 0,%0;" "dcbf 0,%0;" : : "r"(addr) : "memory");
}
addr = addr1 + size - 1;
__asm__ volatile ("icbi 0,%0;" "dcbf 0,%0;" "sync;" "isync;" : : "r"(addr) : "memory");
@ -812,8 +810,8 @@ int ffi_closure_helper_SYSV (ffi_closure*, void*, unsigned long*,
int
ffi_closure_helper_SYSV (ffi_closure* closure, void * rvalue,
unsigned long * pgr, ffi_dblfl * pfr,
unsigned long * pst)
unsigned long * pgr, ffi_dblfl * pfr,
unsigned long * pst)
{
/* rvalue is the pointer to space for return value in closure assembly */
/* pgr is the pointer to where r3-r10 are stored in ffi_closure_SYSV */
@ -854,124 +852,124 @@ ffi_closure_helper_SYSV (ffi_closure* closure, void * rvalue,
{
case FFI_TYPE_SINT8:
case FFI_TYPE_UINT8:
/* there are 8 gpr registers used to pass values */
if (ng < 8) {
avalue[i] = (((char *)pgr)+3);
ng++;
pgr++;
} else {
avalue[i] = (((char *)pst)+3);
pst++;
}
/* there are 8 gpr registers used to pass values */
if (ng < 8) {
avalue[i] = (((char *)pgr)+3);
ng++;
pgr++;
} else {
avalue[i] = (((char *)pst)+3);
pst++;
}
break;
case FFI_TYPE_SINT16:
case FFI_TYPE_UINT16:
/* there are 8 gpr registers used to pass values */
if (ng < 8) {
avalue[i] = (((char *)pgr)+2);
ng++;
pgr++;
} else {
avalue[i] = (((char *)pst)+2);
pst++;
}
/* there are 8 gpr registers used to pass values */
if (ng < 8) {
avalue[i] = (((char *)pgr)+2);
ng++;
pgr++;
} else {
avalue[i] = (((char *)pst)+2);
pst++;
}
break;
case FFI_TYPE_SINT32:
case FFI_TYPE_UINT32:
case FFI_TYPE_POINTER:
/* there are 8 gpr registers used to pass values */
if (ng < 8) {
avalue[i] = pgr;
ng++;
pgr++;
} else {
avalue[i] = pst;
pst++;
}
if (ng < 8) {
avalue[i] = pgr;
ng++;
pgr++;
} else {
avalue[i] = pst;
pst++;
}
break;
case FFI_TYPE_STRUCT:
/* Structs are passed by reference. The address will appear in a
gpr if it is one of the first 8 arguments. */
if (ng < 8) {
avalue[i] = (void *) *pgr;
ng++;
pgr++;
} else {
avalue[i] = (void *) *pst;
pst++;
}
if (ng < 8) {
avalue[i] = (void *) *pgr;
ng++;
pgr++;
} else {
avalue[i] = (void *) *pst;
pst++;
}
break;
case FFI_TYPE_SINT64:
case FFI_TYPE_UINT64:
/* passing long long ints are complex, they must
* be passed in suitable register pairs such as
* (r3,r4) or (r5,r6) or (r6,r7), or (r7,r8) or (r9,r10)
* and if the entire pair aren't available then the outgoing
* parameter stack is used for both but an alignment of 8
* must will be kept. So we must either look in pgr
* or pst to find the correct address for this type
* of parameter.
*/
if (ng < 7) {
if (ng & 0x01) {
/* skip r4, r6, r8 as starting points */
ng++;
pgr++;
}
avalue[i] = pgr;
ng+=2;
pgr+=2;
} else {
if (((long)pst) & 4) pst++;
avalue[i] = pst;
pst+=2;
}
break;
* be passed in suitable register pairs such as
* (r3,r4) or (r5,r6) or (r6,r7), or (r7,r8) or (r9,r10)
* and if the entire pair aren't available then the outgoing
* parameter stack is used for both but an alignment of 8
* must will be kept. So we must either look in pgr
* or pst to find the correct address for this type
* of parameter.
*/
if (ng < 7) {
if (ng & 0x01) {
/* skip r4, r6, r8 as starting points */
ng++;
pgr++;
}
avalue[i] = pgr;
ng+=2;
pgr+=2;
} else {
if (((long)pst) & 4) pst++;
avalue[i] = pst;
pst+=2;
}
break;
case FFI_TYPE_FLOAT:
/* unfortunately float values are stored as doubles
* in the ffi_closure_SYSV code (since we don't check
* the type in that routine).
*/
/* unfortunately float values are stored as doubles
* in the ffi_closure_SYSV code (since we don't check
* the type in that routine).
*/
/* there are 8 64bit floating point registers */
/* there are 8 64bit floating point registers */
if (nf < 8) {
temp = pfr->d;
pfr->f = (float)temp;
avalue[i] = pfr;
nf++;
pfr++;
} else {
if (nf < 8) {
temp = pfr->d;
pfr->f = (float)temp;
avalue[i] = pfr;
nf++;
pfr++;
} else {
/* FIXME? here we are really changing the values
* stored in the original calling routines outgoing
* parameter stack. This is probably a really
* naughty thing to do but...
*/
avalue[i] = pst;
nf++;
pst+=1;
}
* stored in the original calling routines outgoing
* parameter stack. This is probably a really
* naughty thing to do but...
*/
avalue[i] = pst;
nf++;
pst+=1;
}
break;
case FFI_TYPE_DOUBLE:
/* On the outgoing stack all values are aligned to 8 */
/* there are 8 64bit floating point registers */
/* there are 8 64bit floating point registers */
if (nf < 8) {
avalue[i] = pfr;
nf++;
pfr++;
} else {
if (((long)pst) & 4) pst++;
avalue[i] = pst;
nf++;
pst+=2;
}
if (nf < 8) {
avalue[i] = pfr;
nf++;
pfr++;
} else {
if (((long)pst) & 4) pst++;
avalue[i] = pst;
nf++;
pst+=2;
}
break;
default:
@ -1064,13 +1062,13 @@ ffi_closure_helper_LINUX64 (ffi_closure *closure, void *rvalue,
case FFI_TYPE_FLOAT:
/* unfortunately float values are stored as doubles
* in the ffi_closure_LINUX64 code (since we don't check
* the type in that routine).
*/
* in the ffi_closure_LINUX64 code (since we don't check
* the type in that routine).
*/
/* there are 13 64bit floating point registers */
/* there are 13 64bit floating point registers */
if (pfr < end_pfr)
if (pfr < end_pfr)
{
double temp = pfr->d;
pfr->f = (float) temp;
@ -1084,7 +1082,7 @@ ffi_closure_helper_LINUX64 (ffi_closure *closure, void *rvalue,
case FFI_TYPE_DOUBLE:
/* On the outgoing stack all values are aligned to 8 */
/* there are 13 64bit floating point registers */
/* there are 13 64bit floating point registers */
if (pfr < end_pfr)
{

View File

@ -88,4 +88,3 @@ struct ffi_aix_trampoline_struct {
#endif
#endif

View File

@ -5,15 +5,15 @@
.file "linux64_closure.S"
#ifdef __powerpc64__
.hidden ffi_closure_LINUX64, .ffi_closure_LINUX64
.globl ffi_closure_LINUX64, .ffi_closure_LINUX64
.section ".opd","aw"
.align 3
.hidden ffi_closure_LINUX64, .ffi_closure_LINUX64
.globl ffi_closure_LINUX64, .ffi_closure_LINUX64
.section ".opd","aw"
.align 3
ffi_closure_LINUX64:
.quad .ffi_closure_LINUX64,.TOC.@tocbase,0
.size ffi_closure_LINUX64,24
.type .ffi_closure_LINUX64,@function
.text
.quad .ffi_closure_LINUX64,.TOC.@tocbase,0
.size ffi_closure_LINUX64,24
.type .ffi_closure_LINUX64,@function
.text
.ffi_closure_LINUX64:
.LFB1:
# save general regs into parm save area

View File

@ -3,7 +3,7 @@
#include <ffi.h>
#include <powerpc/asm.h>
.file "ppc_closure.S"
.file "ppc_closure.S"
#ifndef __powerpc64__
@ -42,28 +42,28 @@ ENTRY(ffi_closure_SYSV)
# get the context pointer from the trampoline
mr %r3,%r11
# now load up the pointer to the result storage
# now load up the pointer to the result storage
addi %r4,%r1,112
# now load up the pointer to the saved gpr registers
addi %r5,%r1,16
addi %r5,%r1,16
# now load up the pointer to the saved fpr registers */
addi %r6,%r1,48
# now load up the pointer to the saved fpr registers */
addi %r6,%r1,48
# now load up the pointer to the outgoing parameter
# stack in the previous frame
# i.e. the previous frame pointer + 8
addi %r7,%r1,152
# make the call
# make the call
bl JUMPTARGET(ffi_closure_helper_SYSV)
# now r3 contains the return type
# so use it to look up in a table
# so we know how to deal with each type
# look up the proper starting point in table
# look up the proper starting point in table
# by using return type as offset
addi %r5,%r1,112 # get pointer to results area
bl .Lget_ret_type0_addr # get pointer to .Lret_type0 into LR
@ -108,21 +108,21 @@ ENTRY(ffi_closure_SYSV)
# case FFI_TYPE_DOUBLE
.Lret_type3:
lfd %f1,0(%r5)
lfd %f1,0(%r5)
b .Lfinish
nop
nop
# case FFI_TYPE_LONGDOUBLE
.Lret_type4:
lfd %f1,0(%r5)
lfd %f1,0(%r5)
b .Lfinish
nop
nop
# case FFI_TYPE_UINT8
.Lret_type5:
lbz %r3,3(%r5)
lbz %r3,3(%r5)
b .Lfinish
nop
nop

View File

@ -3,8 +3,6 @@
PowerPC Assembly glue.
$Id: sysv.S,v 1.1.1.1 1998/11/29 16:48:16 green Exp $
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including