Commit 70144e9c by Andreas Tobler Committed by Andreas Tobler

Andreas Tobler <a.tobler@schweiz.ch>

        * src/powerpc/darwin_closure.S: Recode to fit dynamic libraries.

From-SVN: r64106
parent b4053702
2003-03-03 Andreas Tobler <a.tobler@schweiz.ch>
* src/powerpc/darwin_closure.S: Recode to fit dynamic libraries.
2003-02-06 Andreas Tobler <a.tobler@schweiz.ch> 2003-02-06 Andreas Tobler <a.tobler@schweiz.ch>
* libffi/src/powerpc/darwin_closure.S: * libffi/src/powerpc/darwin_closure.S:
......
...@@ -25,11 +25,9 @@ ...@@ -25,11 +25,9 @@
----------------------------------------------------------------------- */ ----------------------------------------------------------------------- */
#define LIBFFI_ASM #define LIBFFI_ASM
#define JUMPTARGET(name) name
#define L(x) x #define L(x) x
.text
.globl _ffi_closure_helper_DARWIN
.file "darwin_closure.S"
.text .text
.align 2 .align 2
.globl _ffi_closure_ASM .globl _ffi_closure_ASM
...@@ -97,7 +95,7 @@ LCFI1: ...@@ -97,7 +95,7 @@ LCFI1:
addi r7,r1,232 addi r7,r1,232
/* make the call */ /* make the call */
bl L(_ffi_closure_helper_DARWIN) bl Lffi_closure_helper_DARWIN$stub
/* now r3 contains the return type */ /* now r3 contains the return type */
/* so use it to look up in a table */ /* so use it to look up in a table */
...@@ -106,83 +104,132 @@ LCFI1: ...@@ -106,83 +104,132 @@ LCFI1:
/* look up the proper starting point in table */ /* look up the proper starting point in table */
/* by using return type as offset */ /* by using return type as offset */
addi r5,r1,160 /* get pointer to results area */ addi r5,r1,160 /* get pointer to results area */
addis r4,0,ha16(.L60) /* get address of jump table */ bl Lget_ret_type0_addr /* get pointer to Lret_type0 into LR */
addi r4,r4,lo16(.L60) mflr r4 /* move to r4 */
slwi r3,r3,2 /* now multiply return type by 4 */ slwi r3,r3,4 /* now multiply return type by 16 */
lwzx r3,r4,r3 /* get the contents of that table value */
add r3,r3,r4 /* add contents of table to table address */ add r3,r3,r4 /* add contents of table to table address */
mtctr r3 mtctr r3
bctr /* jump to it */ bctr /* jump to it */
LFE1: LFE1:
.align 2 /* 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 */
.L60: /* first. */
.long .L44-.L60 /* FFI_TYPE_VOID */
.long .L50-.L60 /* FFI_TYPE_INT */ .align 4
.long .L47-.L60 /* FFI_TYPE_FLOAT */
.long .L46-.L60 /* FFI_TYPE_DOUBLE */ nop
.long .L46-.L60 /* FFI_TYPE_LONGDOUBLE */ nop
.long .L56-.L60 /* FFI_TYPE_UINT8 */ nop
.long .L55-.L60 /* FFI_TYPE_SINT8 */ Lget_ret_type0_addr:
.long .L58-.L60 /* FFI_TYPE_UINT16 */ blrl
.long .L57-.L60 /* FFI_TYPE_SINT16 */
.long .L50-.L60 /* FFI_TYPE_UINT32 */ /* case FFI_TYPE_VOID */
.long .L50-.L60 /* FFI_TYPE_SINT32 */ Lret_type0:
.long .L48-.L60 /* FFI_TYPE_UINT64 */ b Lfinish
.long .L48-.L60 /* FFI_TYPE_SINT64 */ nop
.long .L44-.L60 /* FFI_TYPE_STRUCT */ nop
.long .L50-.L60 /* FFI_TYPE_POINTER */ nop
/* case FFI_TYPE_INT */
/* case double */ Lret_type1:
.L46: lwz r3,0(r5)
lfd f1,0(r5) b Lfinish
b .L44 nop
nop
/* case float */ /* case FFI_TYPE_FLOAT */
.L47: Lret_type2:
lfs f1,0(r5) lfs f1,0(r5)
b .L44 b Lfinish
nop
/* case long long */ nop
.L48:
lwz r3,0(r5)
lwz r4,4(r5)
b .L44
/* case default / int32 / pointer */ /* case FFI_TYPE_DOUBLE */
.L50: Lret_type3:
lwz r3,0(r5) lfd f1,0(r5)
b .L44 b Lfinish
nop
nop
/* case signed int8 */ /* case FFI_TYPE_LONGDOUBLE */
.L55: Lret_type4:
addi r5,r5,3 lfd f1,0(r5)
lbz r3,0(r5) b Lfinish
nop
nop
/* case FFI_TYPE_UINT8 */
Lret_type5:
lbz r3,3(r5)
b Lfinish
nop
nop
/* case FFI_TYPE_SINT8 */
Lret_type6:
lbz r3,3(r5)
extsb r3,r3 extsb r3,r3
b .L44 b Lfinish
nop
/* case unsigned int8 */
.L56: /* case FFI_TYPE_UINT16 */
addi r5,r5,3 Lret_type7:
lbz r3,0(r5) lhz r3,2(r5)
b .L44 b Lfinish
nop
nop
/* case FFI_TYPE_SINT16 */
Lret_type8:
lha r3,2(r5)
b Lfinish
nop
nop
/* case FFI_TYPE_UINT32 */
Lret_type9:
lwz r3,0(r5)
b Lfinish
nop
nop
/* case signed int16 */ /* case FFI_TYPE_SINT32 */
.L57: Lret_type10:
addi r5,r5,2 lwz r3,0(r5)
lhz r3,0(r5) b Lfinish
extsh r3,r3 nop
b .L44 nop
/* case unsigned int16 */ /* case FFI_TYPE_UINT64 */
.L58: Lret_type11:
addi r5,r5,2 lwz r3,0(r5)
lhz r3,0(r5) lwz r4,4(r5)
b Lfinish
nop
/* case void / done */ /* case FFI_TYPE_SINT64 */
.L44: Lret_type12:
lwz r3,0(r5)
lwz r4,4(r5)
b Lfinish
nop
/* case FFI_TYPE_STRUCT */
Lret_type13:
b Lfinish
nop
nop
nop
/* case FFI_TYPE_POINTER */
Lret_type14:
lwz r3,0(r5)
b Lfinish
nop
nop
/* case done */
Lfinish:
addi r1,r1,176 /* restore stack pointer */ addi r1,r1,176 /* restore stack pointer */
lwz r0,8(r1) /* get return address */ lwz r0,8(r1) /* get return address */
mtlr r0 /* reset link register */ mtlr r0 /* reset link register */
...@@ -233,4 +280,24 @@ LASFDE1: ...@@ -233,4 +280,24 @@ LASFDE1:
.byte 0x7e ; sleb128 -2 .byte 0x7e ; sleb128 -2
.align 2 .align 2
LEFDE1: LEFDE1:
.data
.align 2
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
LO$ffi_closure_helper_DARWIN:
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
.data
.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