diff options
author | andreast <andreast@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-09-18 19:35:46 +0000 |
---|---|---|
committer | andreast <andreast@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-09-18 19:35:46 +0000 |
commit | bd1f353301eae95afdebd6097df92a58fa885b71 (patch) | |
tree | 5e99e2ab686ecfd7d281ea9410fce3a4914d28ef /libffi | |
parent | dffad8ccd03aedb0df07dea9b37c61da86c5b49c (diff) | |
download | gcc-bd1f353301eae95afdebd6097df92a58fa885b71.tar.gz |
2003-09-18 Andreas Tobler <a.tobler@schweiz.ch>
* src/powerpc/darwin.S: Cleanup whitespaces, comment formatting.
* src/powerpc/darwin_closure.S: Likewise.
* src/powerpc/ffi_darwin.c: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@71533 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libffi')
-rw-r--r-- | libffi/ChangeLog | 6 | ||||
-rw-r--r-- | libffi/src/powerpc/darwin.S | 83 | ||||
-rw-r--r-- | libffi/src/powerpc/darwin_closure.S | 130 | ||||
-rw-r--r-- | libffi/src/powerpc/ffi_darwin.c | 230 |
4 files changed, 225 insertions, 224 deletions
diff --git a/libffi/ChangeLog b/libffi/ChangeLog index 1dd4096112d..9a002168004 100644 --- a/libffi/ChangeLog +++ b/libffi/ChangeLog @@ -1,4 +1,10 @@ 2003-09-18 Andreas Tobler <a.tobler@schweiz.ch> + + * src/powerpc/darwin.S: Cleanup whitespaces, comment formatting. + * src/powerpc/darwin_closure.S: Likewise. + * src/powerpc/ffi_darwin.c: Likewise. + +2003-09-18 Andreas Tobler <a.tobler@schweiz.ch> David Edelsohn <edelsohn@gnu.org> * src/types.c (double): Add AIX and Darwin to the right TYPEDEF. diff --git a/libffi/src/powerpc/darwin.S b/libffi/src/powerpc/darwin.S index 108d2acff72..712252666fd 100644 --- a/libffi/src/powerpc/darwin.S +++ b/libffi/src/powerpc/darwin.S @@ -1,6 +1,6 @@ /* ----------------------------------------------------------------------- darwin.S - Copyright (c) 2000 John Hornkvist - + PowerPC Assembly glue. Permission is hereby granted, free of charge, to any person obtaining @@ -23,7 +23,7 @@ OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ -#define LIBFFI_ASM +#define LIBFFI_ASM #include <ffi.h> #define JUMPTARGET(name) name #define L(x) x @@ -37,59 +37,59 @@ .text .align 2 _ffi_call_DARWIN: -LFB0: +LFB0: mr r12,r8 /* We only need r12 until the call, - so it doesn't have to be saved... */ -LFB1: + so it doesn't have to be saved... */ +LFB1: /* Save the old stack pointer as AP. */ mr r8,r1 -LCFI0: +LCFI0: /* Allocate the stack space we need. */ - stwux r1,r1,r4 - + stwux r1,r1,r4 + /* Save registers we use. */ mflr r9 - stw r28,-16(r8) + stw r28,-16(r8) stw r29,-12(r8) stw r30, -8(r8) stw r31, -4(r8) - stw r9, 8(r8) + stw r9, 8(r8) stw r2, 20(r1) -LCFI1: +LCFI1: /* Save arguments over call... */ mr r31,r5 /* flags, */ mr r30,r6 /* rvalue, */ mr r29,r7 /* function address, */ mr r28,r8 /* our AP. */ -LCFI2: +LCFI2: /* Call ffi_prep_args. */ mr r4,r1 li r9,0 - + mtctr r12 // r12 holds address of _ffi_prep_args - bctrl + bctrl lwz r2,20(r1) - /* Now do the call. */ - /* Set up cr1 with bits 4-7 of the flags. */ + /* Now do the call. + Set up cr1 with bits 4-7 of the flags. */ mtcrf 0x40,r31 /* Get the address to call into CTR. */ mtctr r29 - /* Load all those argument registers. */ - // We have set up a nice stack frame, just load it into registers. - lwz r3, 20+(1*4)(r1) - lwz r4, 20+(2*4)(r1) - lwz r5, 20+(3*4)(r1) - lwz r6, 20+(4*4)(r1) - nop + /* Load all those argument registers. + We have set up a nice stack frame, just load it into registers. */ + lwz r3, 20+(1*4)(r1) + lwz r4, 20+(2*4)(r1) + lwz r5, 20+(3*4)(r1) + lwz r6, 20+(4*4)(r1) + nop lwz r7, 20+(5*4)(r1) - lwz r8, 20+(6*4)(r1) - lwz r9, 20+(7*4)(r1) - lwz r10,20+(8*4)(r1) - + lwz r8, 20+(6*4)(r1) + lwz r9, 20+(7*4)(r1) + lwz r10,20+(8*4)(r1) + L1: /* Load all the FP registers. */ bf 6,L2 // 2f + 0x18 @@ -104,20 +104,20 @@ L1: lfd f8,-16-(6*8)(r28) nop lfd f9,-16-(5*8)(r28) - lfd f10,-16-(4*8)(r28) + lfd f10,-16-(4*8)(r28) lfd f11,-16-(3*8)(r28) lfd f12,-16-(2*8)(r28) nop lfd f13,-16-(1*8)(r28) -L2: - mr r12,r29 // Put the target address in r12 as specified. +L2: + mr r12,r29 /* Put the target address in r12 as specified. */ mtctr r12 nop nop /* Make the call. */ bctrl - + /* Now, deal with the return value. */ mtcrf 0x01,r31 @@ -147,7 +147,7 @@ L(fp_return_value): L(float_return_value): stfs f1,0(r30) b L(done_return_value) -LFE1: +LFE1: /* END(_ffi_call_DARWIN) */ /* Provide a null definition of _ffi_call_AIX. */ @@ -193,26 +193,25 @@ LASFDE1: .set L$set$4,LCFI0-LFB1 .long L$set$4 .byte 0xd ; DW_CFA_def_cfa_register - .byte 0x08 ; uleb128 0x08 + .byte 0x08 ; uleb128 0x08 .byte 0x4 ; DW_CFA_advance_loc4 .set L$set$5,LCFI1-LCFI0 .long L$set$5 .byte 0x11 ; DW_CFA_offset_extended_sf .byte 0x41 ; uleb128 0x41 .byte 0x7e ; sleb128 -2 - .byte 0x9f ; DW_CFA_offset, column 0x1f - .byte 0x1 ; uleb128 0x1 + .byte 0x9f ; DW_CFA_offset, column 0x1f + .byte 0x1 ; uleb128 0x1 .byte 0x9e ; DW_CFA_offset, column 0x1e .byte 0x2 ; uleb128 0x2 - .byte 0x9d ; DW_CFA_offset, column 0x1d - .byte 0x3 ; uleb128 0x3 - .byte 0x9c ; DW_CFA_offset, column 0x1c + .byte 0x9d ; DW_CFA_offset, column 0x1d + .byte 0x3 ; uleb128 0x3 + .byte 0x9c ; DW_CFA_offset, column 0x1c .byte 0x4 ; uleb128 0x4 - .byte 0x4 ; DW_CFA_advance_loc4 + .byte 0x4 ; DW_CFA_advance_loc4 .set L$set$6,LCFI2-LCFI1 .long L$set$6 - .byte 0xd ; DW_CFA_def_cfa_register - .byte 0x1c ; uleb128 0x1c + .byte 0xd ; DW_CFA_def_cfa_register + .byte 0x1c ; uleb128 0x1c .align 2 LEFDE1: - diff --git a/libffi/src/powerpc/darwin_closure.S b/libffi/src/powerpc/darwin_closure.S index 5dfa44b4fdd..d8612a85445 100644 --- a/libffi/src/powerpc/darwin_closure.S +++ b/libffi/src/powerpc/darwin_closure.S @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------- - darwin_closure.S - Copyright (c) 2002 2003 Free Software Foundation, + darwin_closure.S - Copyright (c) 2002 2003 Free Software Foundation, Inc. based on ppc_closure.S - + PowerPC Assembly glue. Permission is hereby granted, free of charge, to any person obtaining @@ -29,40 +29,40 @@ .file "darwin_closure.S" .text - .align 2 + .align 2 .globl _ffi_closure_ASM .text .align 2 _ffi_closure_ASM: -LFB1: +LFB1: mflr r0 /* extract return address */ stw r0, 8(r1) /* save the return address */ -LCFI0: +LCFI0: /* 24 Bytes (Linkage Area) 32 Bytes (outgoing parameter area, always reserved) - 104 Bytes (13*8 from FPR) + 104 Bytes (13*8 from FPR) 8 Bytes (result) 168 Bytes */ stwu r1,-176(r1) /* skip over caller save area - keep stack aligned to 16 */ -LCFI1: - /* we want to build up an area for the parameters passed - in registers (both floating point and integer) */ + keep stack aligned to 16. */ +LCFI1: + /* We want to build up an area for the parameters passed + in registers. (both floating point and integer) */ - /* we store gpr 3 to gpr 10 (aligned to 4) - in the parents outgoing area */ + /* We store gpr 3 to gpr 10 (aligned to 4) + in the parents outgoing area. */ stw r3, 200(r1) stw r4, 204(r1) - stw r5, 208(r1) + stw r5, 208(r1) stw r6, 212(r1) stw r7, 216(r1) - stw r8, 220(r1) + stw r8, 220(r1) stw r9, 224(r1) stw r10, 228(r1) - /* we save fpr 1 to fpr 13 (aligned to 8) */ + /* We save fpr 1 to fpr 13. (aligned to 8) */ stfd f1, 56(r1) stfd f2, 64(r1) stfd f3, 72(r1) @@ -71,45 +71,45 @@ LCFI1: stfd f6, 96(r1) stfd f7, 104(r1) stfd f8, 112(r1) - stfd f9, 120(r1) - stfd f10, 128(r1) - stfd f11, 136(r1) - stfd f12, 144(r1) - stfd f13, 152(r1) - - /* set up registers for the routine that actually does the work */ - /* get the context pointer from the trampoline */ + stfd f9, 120(r1) + stfd f10, 128(r1) + stfd f11, 136(r1) + stfd f12, 144(r1) + stfd f13, 152(r1) + + /* Set up registers for the routine that actually does the work + 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,160 - /* now load up the pointer to the saved gpr registers */ + /* Now load up the pointer to the saved gpr registers. */ addi r5,r1,200 - /* now load up the pointer to the saved fpr registers */ + /* Now load up the pointer to the saved fpr registers. */ addi r6,r1,56 - /* make the call */ + /* Make the call. */ bl Lffi_closure_helper_DARWIN$stub - /* 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 */ - /* by using return type as offset */ - addi r5,r1,160 /* get pointer to results area */ - bl Lget_ret_type0_addr /* get pointer to Lret_type0 into LR */ - mflr r4 /* move to r4 */ - slwi r3,r3,4 /* now multiply return type by 16 */ - add r3,r3,r4 /* add contents of table to table address */ + /* 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 + by using return type as offset. */ + addi r5,r1,160 /* Get pointer to results area. */ + bl Lget_ret_type0_addr /* Get pointer to Lret_type0 into LR. */ + mflr r4 /* Move to r4. */ + slwi r3,r3,4 /* Now multiply return type by 16. */ + add r3,r3,r4 /* Add contents of table to table address. */ mtctr r3 - bctr /* jump to it */ + bctr /* Jump to it. */ LFE1: -/* Each of the ret_typeX code fragments has to be exactly 16 bytes long */ -/* (4 instructions). For cache effectiveness we align to a 16 byte boundary */ -/* first. */ +/* Each of the ret_typeX code fragments has to be exactly 16 bytes long + (4 instructions). For cache effectiveness we align to a 16 byte boundary + first. */ .align 4 @@ -142,21 +142,21 @@ Lret_type2: /* 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 @@ -210,7 +210,7 @@ Lret_type12: b Lfinish nop -/* case FFI_TYPE_STRUCT */ +/* case FFI_TYPE_STRUCT */ Lret_type13: b Lfinish nop @@ -224,14 +224,14 @@ Lret_type14: nop nop -/* case done */ -Lfinish: - addi r1,r1,176 /* restore stack pointer */ - lwz r0,8(r1) /* get return address */ - mtlr r0 /* reset link register */ +/* case done */ +Lfinish: + addi r1,r1,176 /* Restore stack pointer. */ + lwz r0,8(r1) /* Get return address. */ + mtlr r0 /* Reset link register. */ blr - -/* END(ffi_closure_ASM) */ + +/* END(ffi_closure_ASM) */ .data .section __TEXT,__eh_frame @@ -267,7 +267,7 @@ LASFDE1: .set L$set$3,LCFI1-LCFI0 .long L$set$3 .byte 0xe ; DW_CFA_def_cfa_offset - .byte 176,1 ; uleb128 176 + .byte 176,1 ; uleb128 176 .byte 0x4 ; DW_CFA_advance_loc4 .set L$set$4,LCFI0-LFB1 .long L$set$4 @@ -281,19 +281,19 @@ LEFDE1: LDFCM0: .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 .align 2 -Lffi_closure_helper_DARWIN$stub: - .indirect_symbol _ffi_closure_helper_DARWIN - mflr r0 - bcl 20,31,LO$ffi_closure_helper_DARWIN +Lffi_closure_helper_DARWIN$stub: + .indirect_symbol _ffi_closure_helper_DARWIN + mflr r0 + bcl 20,31,LO$ffi_closure_helper_DARWIN LO$ffi_closure_helper_DARWIN: - mflr r11 + mflr r11 addis r11,r11,ha16(L_ffi_closure_helper_DARWIN$lazy_ptr - LO$ffi_closure_helper_DARWIN) - mtlr r0 - lwzu r12,lo16(L_ffi_closure_helper_DARWIN$lazy_ptr - LO$ffi_closure_helper_DARWIN)(r11) - mtctr r12 - bctr + mtlr r0 + lwzu r12,lo16(L_ffi_closure_helper_DARWIN$lazy_ptr - LO$ffi_closure_helper_DARWIN)(r11) + mtctr r12 + bctr .data -.lazy_symbol_pointer -L_ffi_closure_helper_DARWIN$lazy_ptr: +.lazy_symbol_pointer +L_ffi_closure_helper_DARWIN$lazy_ptr: .indirect_symbol _ffi_closure_helper_DARWIN .long dyld_stub_binding_helper diff --git a/libffi/src/powerpc/ffi_darwin.c b/libffi/src/powerpc/ffi_darwin.c index fee5243db71..73653cd43c6 100644 --- a/libffi/src/powerpc/ffi_darwin.c +++ b/libffi/src/powerpc/ffi_darwin.c @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------- ffi.c - Copyright (c) 1998 Geoffrey Keating - - PowerPC Foreign Function Interface + + PowerPC Foreign Function Interface Darwin ABI support (c) 2001 John Hornkvist AIX ABI support (c) 2002 Free Software Foundation, Inc. @@ -34,12 +34,12 @@ extern void ffi_closure_ASM(void); enum { /* The assembly depends on these exact flags. */ - FLAG_RETURNS_NOTHING = 1 << (31-30), /* These go in cr7 */ + FLAG_RETURNS_NOTHING = 1 << (31-30), /* These go in cr7 */ FLAG_RETURNS_FP = 1 << (31-29), FLAG_RETURNS_64BITS = 1 << (31-28), FLAG_ARG_NEEDS_COPY = 1 << (31- 7), - FLAG_FP_ARGUMENTS = 1 << (31- 6), /* cr1.eq; specified by ABI */ + FLAG_FP_ARGUMENTS = 1 << (31- 6), /* cr1.eq; specified by ABI */ FLAG_4_GPR_ARGUMENTS = 1 << (31- 5), FLAG_RETVAL_REFERENCE = 1 << (31- 4) }; @@ -58,7 +58,7 @@ enum { ASM_NEEDS_REGISTERS = 4 }; | Return address from ffi_call_DARWIN | 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_DARWIN |--------------------------------------------| | @@ -69,7 +69,7 @@ enum { ASM_NEEDS_REGISTERS = 4 }; | Reserved 2*4 | | grows | |--------------------------------------------| | down V | Space for callee's LR 4 | | - |--------------------------------------------| | lower addresses + |--------------------------------------------| | lower addresses | Saved CR 4 | | |--------------------------------------------| | stack pointer here | Current backchain pointer 4 |-/ during @@ -93,7 +93,7 @@ void ffi_prep_args(extended_cif *ecif, unsigned *const stack) /* 'next_arg' grows up as we put parameters in it. */ - unsigned *next_arg = stack + 6; // 6 reserved posistions. + unsigned *next_arg = stack + 6; /* 6 reserved posistions. */ int i = ecif->cif->nargs; double double_tmp; @@ -108,9 +108,10 @@ void ffi_prep_args(extended_cif *ecif, unsigned *const stack) FFI_ASSERT(((unsigned)(char *)stacktop & 0xF) == 0); FFI_ASSERT((bytes & 0xF) == 0); - /* Deal with return values that are actually pass-by-reference. */ - // Rule: - // Return values are referenced by r3, so r4 is the first parameter. + /* Deal with return values that are actually pass-by-reference. + Rule: + Return values are referenced by r3, so r4 is the first parameter. */ + if (flags & FLAG_RETVAL_REFERENCE) *next_arg++ = (unsigned)(char *)ecif->rvalue; @@ -127,28 +128,28 @@ void ffi_prep_args(extended_cif *ecif, unsigned *const stack) case FFI_TYPE_FLOAT: double_tmp = *(float *)*p_argv; if (fparg_count >= NUM_FPR_ARG_REGISTERS) - *(double *)next_arg = double_tmp; + *(double *)next_arg = double_tmp; else - *fpr_base++ = double_tmp; - next_arg++; + *fpr_base++ = double_tmp; + next_arg++; fparg_count++; FFI_ASSERT(flags & FLAG_FP_ARGUMENTS); break; case FFI_TYPE_DOUBLE: double_tmp = *(double *)*p_argv; if (fparg_count >= NUM_FPR_ARG_REGISTERS) - *(double *)next_arg = double_tmp; + *(double *)next_arg = double_tmp; else - *fpr_base++ = double_tmp; - next_arg += 2; + *fpr_base++ = double_tmp; + next_arg += 2; fparg_count++; FFI_ASSERT(flags & FLAG_FP_ARGUMENTS); break; case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: - *(long long *)next_arg = *(long long *)*p_argv; - next_arg+=2; + *(long long *)next_arg = *(long long *)*p_argv; + next_arg+=2; break; case FFI_TYPE_UINT8: gprvalue = *(unsigned char *)*p_argv; @@ -187,7 +188,7 @@ void ffi_prep_args(extended_cif *ecif, unsigned *const stack) break; case FFI_TYPE_INT: - case FFI_TYPE_UINT32: + case FFI_TYPE_UINT32: case FFI_TYPE_SINT32: case FFI_TYPE_POINTER: gprvalue = *(unsigned *)*p_argv; @@ -206,7 +207,7 @@ void ffi_prep_args(extended_cif *ecif, unsigned *const stack) //FFI_ASSERT(flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4); } -/* Perform machine dependent cif processing */ +/* Perform machine dependent cif processing. */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { /* All this is for the DARWIN ABI. */ @@ -220,7 +221,7 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) /* All the machine-independent calculation of cif->bytes will be wrong. Redo the calculation for DARWIN. */ - /* Space for the frame pointer, callee's LR, CR, etc, and for + /* Space for the frame pointer, callee's LR, CR, etc, and for the asm's temp regs. */ bytes = (6 + ASM_NEEDS_REGISTERS) * sizeof(long); @@ -343,22 +344,22 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) /*@-declundef@*/ /*@-exportheader@*/ -extern void ffi_call_AIX(/*@out@*/ extended_cif *, - unsigned, unsigned, - /*@out@*/ unsigned *, +extern void ffi_call_AIX(/*@out@*/ extended_cif *, + unsigned, unsigned, + /*@out@*/ unsigned *, void (*fn)(), void (*fn2)()); -extern void ffi_call_DARWIN(/*@out@*/ extended_cif *, - unsigned, unsigned, - /*@out@*/ unsigned *, +extern void ffi_call_DARWIN(/*@out@*/ extended_cif *, + unsigned, unsigned, + /*@out@*/ unsigned *, void (*fn)(), void (*fn2)()); /*@=declundef@*/ /*@=exportheader@*/ -void ffi_call(/*@dependent@*/ ffi_cif *cif, - void (*fn)(), - /*@out@*/ void *rvalue, +void ffi_call(/*@dependent@*/ ffi_cif *cif, + void (*fn)(), + /*@out@*/ void *rvalue, /*@dependent@*/ void **avalue) { extended_cif ecif; @@ -366,10 +367,10 @@ void ffi_call(/*@dependent@*/ ffi_cif *cif, ecif.cif = cif; ecif.avalue = avalue; - /* If the return value is a struct and we don't have a return */ - /* value address then we need to make one */ + /* If the return value is a struct and we don't have a return + value address then we need to make one. */ - if ((rvalue == NULL) && + if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { /*@-sysunrecog@*/ @@ -379,17 +380,17 @@ void ffi_call(/*@dependent@*/ ffi_cif *cif, else ecif.rvalue = rvalue; - switch (cif->abi) + switch (cif->abi) { case FFI_AIX: /*@-usedef@*/ - ffi_call_AIX(&ecif, -cif->bytes, + ffi_call_AIX(&ecif, -cif->bytes, cif->flags, ecif.rvalue, fn, ffi_prep_args); /*@=usedef@*/ break; case FFI_DARWIN: /*@-usedef@*/ - ffi_call_DARWIN(&ecif, -cif->bytes, + ffi_call_DARWIN(&ecif, -cif->bytes, cif->flags, ecif.rvalue, fn, ffi_prep_args); /*@=usedef@*/ break; @@ -402,8 +403,8 @@ void ffi_call(/*@dependent@*/ ffi_cif *cif, static void flush_icache(char *); static void flush_range(char *, int); -/* The layout of a function descriptor. A C function pointer really */ -/* points to one of these. */ +/* The layout of a function descriptor. A C function pointer really + points to one of these. */ typedef struct aix_fd_struct { void *code_pointer; @@ -411,70 +412,70 @@ typedef struct aix_fd_struct { } aix_fd; /* here I'd like to add the stack frame layout we use in darwin_closure.S - * and aix_clsoure.S - * - * SP previous -> +---------------------------------------+ <--- child frame - | back chain to caller 4 | - +---------------------------------------+ 4 - | saved CR 4 | - +---------------------------------------+ 8 - | saved LR 4 | - +---------------------------------------+ 12 - | reserved for compilers 4 | - +---------------------------------------+ 16 - | reserved for binders 4 | - +---------------------------------------+ 20 - | saved TOC pointer 4 | - +---------------------------------------+ 24 - | always reserved 8*4=32 (previous GPRs)| - | according to the linkage convention | - | from AIX | - +---------------------------------------+ 56 - | our FPR area 13*8=104 | - | f1 | - | . | - | f13 | - +---------------------------------------+ 160 - | result area 8 | - +---------------------------------------+ 168 - | alignement to the next multiple of 16 | + and aix_clsoure.S + + SP previous -> +---------------------------------------+ <--- child frame + | back chain to caller 4 | + +---------------------------------------+ 4 + | saved CR 4 | + +---------------------------------------+ 8 + | saved LR 4 | + +---------------------------------------+ 12 + | reserved for compilers 4 | + +---------------------------------------+ 16 + | reserved for binders 4 | + +---------------------------------------+ 20 + | saved TOC pointer 4 | + +---------------------------------------+ 24 + | always reserved 8*4=32 (previous GPRs)| + | according to the linkage convention | + | from AIX | + +---------------------------------------+ 56 + | our FPR area 13*8=104 | + | f1 | + | . | + | f13 | + +---------------------------------------+ 160 + | result area 8 | + +---------------------------------------+ 168 + | alignement to the next multiple of 16 | SP current --> +---------------------------------------+ 176 <- parent frame - | back chain to caller 4 | - +---------------------------------------+ 180 - | saved CR 4 | - +---------------------------------------+ 184 - | saved LR 4 | - +---------------------------------------+ 188 - | reserved for compilers 4 | - +---------------------------------------+ 192 - | reserved for binders 4 | - +---------------------------------------+ 196 - | saved TOC pointer 4 | - +---------------------------------------+ 200 - | always reserved 8*4=32 we store our | - | GPRs here | - | r3 | - | . | - | r10 | - +---------------------------------------+ 232 - | overflow part | - +---------------------------------------+ xxx - | ???? | - +---------------------------------------+ xxx + | back chain to caller 4 | + +---------------------------------------+ 180 + | saved CR 4 | + +---------------------------------------+ 184 + | saved LR 4 | + +---------------------------------------+ 188 + | reserved for compilers 4 | + +---------------------------------------+ 192 + | reserved for binders 4 | + +---------------------------------------+ 196 + | saved TOC pointer 4 | + +---------------------------------------+ 200 + | always reserved 8*4=32 we store our | + | GPRs here | + | r3 | + | . | + | r10 | + +---------------------------------------+ 232 + | overflow part | + +---------------------------------------+ xxx + | ???? | + +---------------------------------------+ xxx */ ffi_status -ffi_prep_closure (ffi_closure* closure, - ffi_cif* cif, - void (*fun)(ffi_cif*, void*, void**, void*), - void *user_data) +ffi_prep_closure (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*, void*, void**, void*), + void *user_data) { unsigned int *tramp; struct ffi_aix_trampoline_struct *tramp_aix; aix_fd *fd; switch (cif->abi) - { + { case FFI_DARWIN: FFI_ASSERT (cif->abi == FFI_DARWIN); @@ -527,12 +528,12 @@ flush_icache(char *addr) { #ifndef _AIX __asm__ volatile ( - "dcbf 0,%0;" - "sync;" - "icbi 0,%0;" - "sync;" - "isync;" - : : "r"(addr) : "memory"); + "dcbf 0,%0;" + "sync;" + "icbi 0,%0;" + "sync;" + "isync;" + : : "r"(addr) : "memory"); #endif } @@ -556,12 +557,11 @@ int ffi_closure_helper_DARWIN (ffi_closure*, void*, unsigned long*, ffi_dblfl*); /* Basically the trampoline invokes ffi_closure_ASM, and on - * entry, r11 holds the address of the closure. - * After storing the registers that could possibly contain - * parameters to be passed into the stack frame and setting - * up space for a return value, ffi_closure_ASM invokes the - * following helper function to do most of the work - */ + entry, r11 holds the address of the closure. + After storing the registers that could possibly contain + parameters to be passed into the stack frame and setting + up space for a return value, ffi_closure_ASM invokes the + following helper function to do most of the work. */ int ffi_closure_helper_DARWIN (ffi_closure* closure, void * rvalue, unsigned long * pgr, ffi_dblfl * pfr) @@ -574,8 +574,8 @@ int ffi_closure_helper_DARWIN (ffi_closure* closure, void * rvalue, void ** avalue; ffi_type ** arg_types; long i, avn; - long nf; /* number of floating registers already used */ - long ng; /* number of general registers already used */ + long nf; /* number of floating registers already used. */ + long ng; /* number of general registers already used. */ ffi_cif * cif; double temp; unsigned size_al; @@ -652,10 +652,8 @@ int ffi_closure_helper_DARWIN (ffi_closure* closure, void * rvalue, break; case FFI_TYPE_FLOAT: - /* a float value consumes a GPR - * - * here are 13 64bit floating point registers. - */ + /* A float value consumes a GPR. + There are 13 64bit floating point registers. */ if (nf < NUM_FPR_ARG_REGISTERS) { temp = pfr->d; @@ -673,10 +671,8 @@ int ffi_closure_helper_DARWIN (ffi_closure* closure, void * rvalue, break; case FFI_TYPE_DOUBLE: - /* a double value consumes two GPRs - * - * There are 13 64bit floating point registers. - */ + /* A double value consumes two GPRs. + There are 13 64bit floating point registers. */ if (nf < NUM_FPR_ARG_REGISTERS) { avalue[i] = pfr; @@ -691,9 +687,9 @@ int ffi_closure_helper_DARWIN (ffi_closure* closure, void * rvalue, pgr += 2; break; - default: - FFI_ASSERT(0); - } + default: + FFI_ASSERT(0); + } i++; } |