Commit 8d8369f8 by Andreas Tobler Committed by Andreas Tobler

darwin.S: Cleanup whitespaces, comment formatting.

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.

From-SVN: r71533
parent a6a0f876
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.
......
/* -----------------------------------------------------------------------
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:
/* -----------------------------------------------------------------------
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
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