mirror of
https://github.com/partic2/libffi
synced 2026-11-11 02:27:19 +00:00
sparc: Tidy up symbols
Assembly to use local labels, .type annotation, hidden annotation. I do retain the _prefix for the symbols, but given that it wasn't done consistently across all symbols, I doubt it's actually needed.
This commit is contained in:
+19
-15
@@ -44,7 +44,8 @@
|
|||||||
/* ffi_prep_args is called by the assembly routine once stack space
|
/* ffi_prep_args is called by the assembly routine once stack space
|
||||||
has been allocated for the function's arguments */
|
has been allocated for the function's arguments */
|
||||||
|
|
||||||
void ffi_prep_args_v8(char *stack, extended_cif *ecif)
|
void FFI_HIDDEN
|
||||||
|
ffi_prep_args_v8(char *stack, extended_cif *ecif)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
void **p_argv;
|
void **p_argv;
|
||||||
@@ -127,7 +128,8 @@ void ffi_prep_args_v8(char *stack, extended_cif *ecif)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ffi_prep_args_v9(char *stack, extended_cif *ecif)
|
int FFI_HIDDEN
|
||||||
|
ffi_prep_args_v9(char *stack, extended_cif *ecif)
|
||||||
{
|
{
|
||||||
int i, ret = 0;
|
int i, ret = 0;
|
||||||
int tmp;
|
int tmp;
|
||||||
@@ -254,7 +256,8 @@ int ffi_prep_args_v9(char *stack, extended_cif *ecif)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Perform machine dependent cif processing */
|
/* Perform machine dependent cif processing */
|
||||||
ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
|
ffi_status FFI_HIDDEN
|
||||||
|
ffi_prep_cif_machdep(ffi_cif *cif)
|
||||||
{
|
{
|
||||||
int wordsize;
|
int wordsize;
|
||||||
|
|
||||||
@@ -337,7 +340,8 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
|
|||||||
return FFI_OK;
|
return FFI_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ffi_v9_layout_struct(ffi_type *arg, int off, char *ret, char *intg, char *flt)
|
static int
|
||||||
|
ffi_v9_layout_struct(ffi_type *arg, int off, char *ret, char *intg, char *flt)
|
||||||
{
|
{
|
||||||
ffi_type **ptr = &arg->elements[0];
|
ffi_type **ptr = &arg->elements[0];
|
||||||
|
|
||||||
@@ -371,14 +375,14 @@ int ffi_v9_layout_struct(ffi_type *arg, int off, char *ret, char *intg, char *fl
|
|||||||
|
|
||||||
#ifdef SPARC64
|
#ifdef SPARC64
|
||||||
extern int ffi_call_v9(void *, extended_cif *, unsigned,
|
extern int ffi_call_v9(void *, extended_cif *, unsigned,
|
||||||
unsigned, unsigned *, void (*fn)(void));
|
unsigned, unsigned *, void (*fn)(void)) FFI_HIDDEN;
|
||||||
#else
|
#else
|
||||||
extern int ffi_call_v8(void *, extended_cif *, unsigned,
|
extern int ffi_call_v8(void *, extended_cif *, unsigned,
|
||||||
unsigned, unsigned *, void (*fn)(void));
|
unsigned, unsigned *, void (*fn)(void)) FFI_HIDDEN;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __GNUC__
|
#ifndef __GNUC__
|
||||||
void ffi_flush_icache (void *, size_t);
|
void ffi_flush_icache (void *, size_t) FFI_HIDDEN;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
|
void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
|
||||||
@@ -478,9 +482,9 @@ void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
|
|||||||
|
|
||||||
|
|
||||||
#ifdef SPARC64
|
#ifdef SPARC64
|
||||||
extern void ffi_closure_v9(void);
|
extern void ffi_closure_v9(void) FFI_HIDDEN;
|
||||||
#else
|
#else
|
||||||
extern void ffi_closure_v8(void);
|
extern void ffi_closure_v8(void) FFI_HIDDEN;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ffi_status
|
ffi_status
|
||||||
@@ -534,9 +538,9 @@ ffi_prep_closure_loc (ffi_closure* closure,
|
|||||||
return FFI_OK;
|
return FFI_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int FFI_HIDDEN
|
||||||
ffi_closure_sparc_inner_v8(ffi_closure *closure,
|
ffi_closure_sparc_inner_v8(ffi_closure *closure, void *rvalue,
|
||||||
void *rvalue, unsigned long *gpr, unsigned long *scratch)
|
unsigned long *gpr, unsigned long *scratch)
|
||||||
{
|
{
|
||||||
ffi_cif *cif;
|
ffi_cif *cif;
|
||||||
ffi_type **arg_types;
|
ffi_type **arg_types;
|
||||||
@@ -592,9 +596,9 @@ ffi_closure_sparc_inner_v8(ffi_closure *closure,
|
|||||||
return cif->rtype->type;
|
return cif->rtype->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int FFI_HIDDEN
|
||||||
ffi_closure_sparc_inner_v9(ffi_closure *closure,
|
ffi_closure_sparc_inner_v9(ffi_closure *closure, void *rvalue,
|
||||||
void *rvalue, unsigned long *gpr, double *fpr)
|
unsigned long *gpr, double *fpr)
|
||||||
{
|
{
|
||||||
ffi_cif *cif;
|
ffi_cif *cif;
|
||||||
ffi_type **arg_types;
|
ffi_type **arg_types;
|
||||||
|
|||||||
+67
-135
@@ -28,18 +28,31 @@
|
|||||||
#define LIBFFI_ASM
|
#define LIBFFI_ASM
|
||||||
#include <fficonfig.h>
|
#include <fficonfig.h>
|
||||||
#include <ffi.h>
|
#include <ffi.h>
|
||||||
|
#include <ffi_cfi.h>
|
||||||
|
|
||||||
#define STACKFRAME 96 /* Minimum stack framesize for SPARC */
|
#define STACKFRAME 96 /* Minimum stack framesize for SPARC */
|
||||||
#define ARGS (64+4) /* Offset of register area in frame */
|
#define ARGS (64+4) /* Offset of register area in frame */
|
||||||
|
|
||||||
#ifndef __GNUC__
|
#define C2(X, Y) X ## Y
|
||||||
.text
|
#define C1(X, Y) C2(X, Y)
|
||||||
.align 8
|
|
||||||
.globl ffi_flush_icache
|
|
||||||
.globl _ffi_flush_icache
|
|
||||||
|
|
||||||
ffi_flush_icache:
|
#ifdef __USER_LABEL_PREFIX__
|
||||||
_ffi_flush_icache:
|
# define C(Y) C1(__USER_LABEL_PREFIX__, Y)
|
||||||
|
#else
|
||||||
|
# define C(Y) Y
|
||||||
|
#endif
|
||||||
|
#define L(Y) C1(.L, Y)
|
||||||
|
|
||||||
|
.text
|
||||||
|
|
||||||
|
#ifndef __GNUC__
|
||||||
|
.align 8
|
||||||
|
.globl C(ffi_flush_icache)
|
||||||
|
.type C(ffi_flush_icache),@function
|
||||||
|
FFI_HIDDEN(C(ffi_flush_icache))
|
||||||
|
|
||||||
|
C(ffi_flush_icache):
|
||||||
|
cfi_startproc
|
||||||
add %o0, %o1, %o2
|
add %o0, %o1, %o2
|
||||||
#ifdef SPARC64
|
#ifdef SPARC64
|
||||||
1: flush %o0
|
1: flush %o0
|
||||||
@@ -56,20 +69,20 @@ _ffi_flush_icache:
|
|||||||
nop
|
nop
|
||||||
retl
|
retl
|
||||||
nop
|
nop
|
||||||
.ffi_flush_icache_end:
|
cfi_endproc
|
||||||
.size ffi_flush_icache,.ffi_flush_icache_end-ffi_flush_icache
|
.size C(ffi_flush_icache), . - C(ffi_flush_icache)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
.text
|
|
||||||
.align 8
|
.align 8
|
||||||
.globl ffi_call_v8
|
.globl C(ffi_call_v8)
|
||||||
.globl _ffi_call_v8
|
.type C(ffi_call_v8),@function
|
||||||
|
FFI_HIDDEN(C(ffi_call_v8))
|
||||||
|
|
||||||
ffi_call_v8:
|
C(ffi_call_v8):
|
||||||
_ffi_call_v8:
|
cfi_startproc
|
||||||
.LLFB1:
|
|
||||||
save %sp, -STACKFRAME, %sp
|
save %sp, -STACKFRAME, %sp
|
||||||
.LLCFI0:
|
cfi_def_cfa_register(%fp)
|
||||||
|
cfi_window_save
|
||||||
|
|
||||||
sub %sp, %i2, %sp ! alloca() space in stack for frame to set up
|
sub %sp, %i2, %sp ! alloca() space in stack for frame to set up
|
||||||
add %sp, STACKFRAME, %l0 ! %l0 has start of
|
add %sp, STACKFRAME, %l0 ! %l0 has start of
|
||||||
@@ -91,81 +104,81 @@ _ffi_call_v8:
|
|||||||
|
|
||||||
! If the return value pointer is NULL, assume no return value.
|
! If the return value pointer is NULL, assume no return value.
|
||||||
tst %i4
|
tst %i4
|
||||||
bz done
|
bz L(done)
|
||||||
nop
|
nop
|
||||||
|
|
||||||
cmp %i3, FFI_TYPE_INT
|
cmp %i3, FFI_TYPE_INT
|
||||||
be,a done
|
be,a L(done)
|
||||||
st %o0, [%i4] ! (delay)
|
st %o0, [%i4] ! (delay)
|
||||||
|
|
||||||
cmp %i3, FFI_TYPE_FLOAT
|
cmp %i3, FFI_TYPE_FLOAT
|
||||||
be,a done
|
be,a L(done)
|
||||||
st %f0, [%i4+0] ! (delay)
|
st %f0, [%i4+0] ! (delay)
|
||||||
|
|
||||||
cmp %i3, FFI_TYPE_DOUBLE
|
cmp %i3, FFI_TYPE_DOUBLE
|
||||||
be,a double
|
be,a L(double)
|
||||||
st %f0, [%i4+0] ! (delay)
|
st %f0, [%i4+0] ! (delay)
|
||||||
|
|
||||||
cmp %i3, FFI_TYPE_SINT8
|
cmp %i3, FFI_TYPE_SINT8
|
||||||
be,a sint8
|
be,a L(sint8)
|
||||||
sll %o0, 24, %o0 ! (delay)
|
sll %o0, 24, %o0 ! (delay)
|
||||||
|
|
||||||
cmp %i3, FFI_TYPE_UINT8
|
cmp %i3, FFI_TYPE_UINT8
|
||||||
be,a uint8
|
be,a L(uint8)
|
||||||
sll %o0, 24, %o0 ! (delay)
|
sll %o0, 24, %o0 ! (delay)
|
||||||
|
|
||||||
cmp %i3, FFI_TYPE_SINT16
|
cmp %i3, FFI_TYPE_SINT16
|
||||||
be,a sint16
|
be,a L(sint16)
|
||||||
sll %o0, 16, %o0 ! (delay)
|
sll %o0, 16, %o0 ! (delay)
|
||||||
|
|
||||||
cmp %i3, FFI_TYPE_UINT16
|
cmp %i3, FFI_TYPE_UINT16
|
||||||
be,a uint16
|
be,a L(uint16)
|
||||||
sll %o0, 16, %o0 ! (delay)
|
sll %o0, 16, %o0 ! (delay)
|
||||||
|
|
||||||
cmp %i3, FFI_TYPE_SINT64
|
cmp %i3, FFI_TYPE_SINT64
|
||||||
be,a longlong
|
be,a L(longlong)
|
||||||
st %o0, [%i4+0] ! (delay)
|
st %o0, [%i4+0] ! (delay)
|
||||||
done:
|
|
||||||
|
L(done):
|
||||||
ret
|
ret
|
||||||
restore
|
restore
|
||||||
|
|
||||||
double:
|
L(double):
|
||||||
st %f1, [%i4+4]
|
st %f1, [%i4+4]
|
||||||
ret
|
ret
|
||||||
restore
|
restore
|
||||||
|
|
||||||
sint8:
|
L(sint8):
|
||||||
sra %o0, 24, %o0
|
sra %o0, 24, %o0
|
||||||
st %o0, [%i4+0]
|
st %o0, [%i4+0]
|
||||||
ret
|
ret
|
||||||
restore
|
restore
|
||||||
|
|
||||||
uint8:
|
L(uint8):
|
||||||
srl %o0, 24, %o0
|
srl %o0, 24, %o0
|
||||||
st %o0, [%i4+0]
|
st %o0, [%i4+0]
|
||||||
ret
|
ret
|
||||||
restore
|
restore
|
||||||
|
|
||||||
sint16:
|
L(sint16):
|
||||||
sra %o0, 16, %o0
|
sra %o0, 16, %o0
|
||||||
st %o0, [%i4+0]
|
st %o0, [%i4+0]
|
||||||
ret
|
ret
|
||||||
restore
|
restore
|
||||||
|
|
||||||
uint16:
|
L(uint16):
|
||||||
srl %o0, 16, %o0
|
srl %o0, 16, %o0
|
||||||
st %o0, [%i4+0]
|
st %o0, [%i4+0]
|
||||||
ret
|
ret
|
||||||
restore
|
restore
|
||||||
|
|
||||||
longlong:
|
L(longlong):
|
||||||
st %o1, [%i4+4]
|
st %o1, [%i4+4]
|
||||||
ret
|
ret
|
||||||
restore
|
restore
|
||||||
.LLFE1:
|
cfi_endproc
|
||||||
|
|
||||||
.ffi_call_v8_end:
|
.size C(ffi_call_v8),. - C(ffi_call_v8)
|
||||||
.size ffi_call_v8,.ffi_call_v8_end-ffi_call_v8
|
|
||||||
|
|
||||||
|
|
||||||
#undef STACKFRAME
|
#undef STACKFRAME
|
||||||
@@ -178,15 +191,16 @@ longlong:
|
|||||||
|
|
||||||
Receives the closure argument in %g2. */
|
Receives the closure argument in %g2. */
|
||||||
|
|
||||||
.text
|
|
||||||
.align 8
|
.align 8
|
||||||
.globl ffi_closure_v8
|
.globl C(ffi_closure_v8)
|
||||||
|
.type C(ffi_closure_v8),@function
|
||||||
|
FFI_HIDDEN(C(ffi_closure_v8))
|
||||||
|
|
||||||
ffi_closure_v8:
|
C(ffi_closure_v8):
|
||||||
#ifdef HAVE_AS_REGISTER_PSEUDO_OP
|
#ifdef HAVE_AS_REGISTER_PSEUDO_OP
|
||||||
.register %g2, #scratch
|
.register %g2, #scratch
|
||||||
#endif
|
#endif
|
||||||
.LLFB2:
|
cfi_startproc
|
||||||
! Reserve frame space for all arguments in case
|
! Reserve frame space for all arguments in case
|
||||||
! we need to align them on a 8-byte boundary.
|
! we need to align them on a 8-byte boundary.
|
||||||
ld [%g2+FFI_TRAMPOLINE_SIZE], %g1
|
ld [%g2+FFI_TRAMPOLINE_SIZE], %g1
|
||||||
@@ -196,7 +210,8 @@ ffi_closure_v8:
|
|||||||
! %g1 == STACKFRAME + 8*nargs
|
! %g1 == STACKFRAME + 8*nargs
|
||||||
neg %g1
|
neg %g1
|
||||||
save %sp, %g1, %sp
|
save %sp, %g1, %sp
|
||||||
.LLCFI1:
|
cfi_def_cfa_register(%fp)
|
||||||
|
cfi_window_save
|
||||||
|
|
||||||
! Store all of the potential argument registers in va_list format.
|
! Store all of the potential argument registers in va_list format.
|
||||||
st %i0, [%fp+68+0]
|
st %i0, [%fp+68+0]
|
||||||
@@ -216,130 +231,47 @@ ffi_closure_v8:
|
|||||||
! Load up the return value in the proper type.
|
! Load up the return value in the proper type.
|
||||||
! See ffi_prep_cif_machdep for the list of cases.
|
! See ffi_prep_cif_machdep for the list of cases.
|
||||||
cmp %o0, FFI_TYPE_VOID
|
cmp %o0, FFI_TYPE_VOID
|
||||||
be done1
|
be L(done1)
|
||||||
|
|
||||||
cmp %o0, FFI_TYPE_INT
|
cmp %o0, FFI_TYPE_INT
|
||||||
be done1
|
be L(done1)
|
||||||
ld [%fp-8], %i0
|
ld [%fp-8], %i0
|
||||||
|
|
||||||
cmp %o0, FFI_TYPE_FLOAT
|
cmp %o0, FFI_TYPE_FLOAT
|
||||||
be,a done1
|
be,a L(done1)
|
||||||
ld [%fp-8], %f0
|
ld [%fp-8], %f0
|
||||||
|
|
||||||
cmp %o0, FFI_TYPE_DOUBLE
|
cmp %o0, FFI_TYPE_DOUBLE
|
||||||
be,a done1
|
be,a L(done1)
|
||||||
ldd [%fp-8], %f0
|
ldd [%fp-8], %f0
|
||||||
|
|
||||||
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
||||||
cmp %o0, FFI_TYPE_LONGDOUBLE
|
cmp %o0, FFI_TYPE_LONGDOUBLE
|
||||||
be done2
|
be L(done2)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cmp %o0, FFI_TYPE_STRUCT
|
cmp %o0, FFI_TYPE_STRUCT
|
||||||
be done2
|
be L(done2)
|
||||||
|
|
||||||
cmp %o0, FFI_TYPE_SINT64
|
cmp %o0, FFI_TYPE_SINT64
|
||||||
be,a done1
|
be,a L(done1)
|
||||||
ldd [%fp-8], %i0
|
ldd [%fp-8], %i0
|
||||||
|
|
||||||
cmp %o0, FFI_TYPE_UINT64
|
cmp %o0, FFI_TYPE_UINT64
|
||||||
be,a done1
|
be,a L(done1)
|
||||||
ldd [%fp-8], %i0
|
ldd [%fp-8], %i0
|
||||||
|
|
||||||
ld [%fp-8], %i0
|
ld [%fp-8], %i0
|
||||||
done1:
|
L(done1):
|
||||||
jmp %i7+8
|
jmp %i7+8
|
||||||
restore
|
restore
|
||||||
done2:
|
L(done2):
|
||||||
! Skip 'unimp'.
|
! Skip 'unimp'.
|
||||||
jmp %i7+12
|
jmp %i7+12
|
||||||
restore
|
restore
|
||||||
.LLFE2:
|
|
||||||
|
|
||||||
.ffi_closure_v8_end:
|
cfi_endproc
|
||||||
.size ffi_closure_v8,.ffi_closure_v8_end-ffi_closure_v8
|
.size C(ffi_closure_v8), . - C(ffi_closure_v8)
|
||||||
|
|
||||||
#ifdef SPARC64
|
|
||||||
#define WS 8
|
|
||||||
#define nword xword
|
|
||||||
#define uanword uaxword
|
|
||||||
#else
|
|
||||||
#define WS 4
|
|
||||||
#define nword long
|
|
||||||
#define uanword uaword
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_RO_EH_FRAME
|
|
||||||
.section ".eh_frame",#alloc
|
|
||||||
#else
|
|
||||||
.section ".eh_frame",#alloc,#write
|
|
||||||
#endif
|
|
||||||
.LLframe1:
|
|
||||||
.uaword .LLECIE1-.LLSCIE1 ! Length of Common Information Entry
|
|
||||||
.LLSCIE1:
|
|
||||||
.uaword 0x0 ! CIE Identifier Tag
|
|
||||||
.byte 0x1 ! CIE Version
|
|
||||||
.ascii "zR\0" ! CIE Augmentation
|
|
||||||
.byte 0x1 ! uleb128 0x1; CIE Code Alignment Factor
|
|
||||||
.byte 0x80-WS ! sleb128 -WS; CIE Data Alignment Factor
|
|
||||||
.byte 0xf ! CIE RA Column
|
|
||||||
.byte 0x1 ! uleb128 0x1; Augmentation size
|
|
||||||
#ifdef HAVE_AS_SPARC_UA_PCREL
|
|
||||||
.byte 0x1b ! FDE Encoding (pcrel sdata4)
|
|
||||||
#else
|
|
||||||
.byte 0x50 ! FDE Encoding (aligned absolute)
|
|
||||||
#endif
|
|
||||||
.byte 0xc ! DW_CFA_def_cfa
|
|
||||||
.byte 0xe ! uleb128 0xe
|
|
||||||
.byte 0x0 ! uleb128 0x0
|
|
||||||
.align WS
|
|
||||||
.LLECIE1:
|
|
||||||
.LLSFDE1:
|
|
||||||
.uaword .LLEFDE1-.LLASFDE1 ! FDE Length
|
|
||||||
.LLASFDE1:
|
|
||||||
.uaword .LLASFDE1-.LLframe1 ! FDE CIE offset
|
|
||||||
#ifdef HAVE_AS_SPARC_UA_PCREL
|
|
||||||
.uaword %r_disp32(.LLFB1)
|
|
||||||
.uaword .LLFE1-.LLFB1 ! FDE address range
|
|
||||||
#else
|
|
||||||
.align WS
|
|
||||||
.nword .LLFB1
|
|
||||||
.uanword .LLFE1-.LLFB1 ! FDE address range
|
|
||||||
#endif
|
|
||||||
.byte 0x0 ! uleb128 0x0; Augmentation size
|
|
||||||
.byte 0x4 ! DW_CFA_advance_loc4
|
|
||||||
.uaword .LLCFI0-.LLFB1
|
|
||||||
.byte 0xd ! DW_CFA_def_cfa_register
|
|
||||||
.byte 0x1e ! uleb128 0x1e
|
|
||||||
.byte 0x2d ! DW_CFA_GNU_window_save
|
|
||||||
.byte 0x9 ! DW_CFA_register
|
|
||||||
.byte 0xf ! uleb128 0xf
|
|
||||||
.byte 0x1f ! uleb128 0x1f
|
|
||||||
.align WS
|
|
||||||
.LLEFDE1:
|
|
||||||
.LLSFDE2:
|
|
||||||
.uaword .LLEFDE2-.LLASFDE2 ! FDE Length
|
|
||||||
.LLASFDE2:
|
|
||||||
.uaword .LLASFDE2-.LLframe1 ! FDE CIE offset
|
|
||||||
#ifdef HAVE_AS_SPARC_UA_PCREL
|
|
||||||
.uaword %r_disp32(.LLFB2)
|
|
||||||
.uaword .LLFE2-.LLFB2 ! FDE address range
|
|
||||||
#else
|
|
||||||
.align WS
|
|
||||||
.nword .LLFB2
|
|
||||||
.uanword .LLFE2-.LLFB2 ! FDE address range
|
|
||||||
#endif
|
|
||||||
.byte 0x0 ! uleb128 0x0; Augmentation size
|
|
||||||
.byte 0x4 ! DW_CFA_advance_loc4
|
|
||||||
.uaword .LLCFI1-.LLFB2
|
|
||||||
.byte 0xd ! DW_CFA_def_cfa_register
|
|
||||||
.byte 0x1e ! uleb128 0x1e
|
|
||||||
.byte 0x2d ! DW_CFA_GNU_window_save
|
|
||||||
.byte 0x9 ! DW_CFA_register
|
|
||||||
.byte 0xf ! uleb128 0xf
|
|
||||||
.byte 0x1f ! uleb128 0x1f
|
|
||||||
.align WS
|
|
||||||
.LLEFDE2:
|
|
||||||
|
|
||||||
#if defined __ELF__ && defined __linux__
|
#if defined __ELF__ && defined __linux__
|
||||||
.section .note.GNU-stack,"",@progbits
|
.section .note.GNU-stack,"",@progbits
|
||||||
|
|||||||
+49
-107
@@ -27,25 +27,38 @@
|
|||||||
#define LIBFFI_ASM
|
#define LIBFFI_ASM
|
||||||
#include <fficonfig.h>
|
#include <fficonfig.h>
|
||||||
#include <ffi.h>
|
#include <ffi.h>
|
||||||
|
#include <ffi_cfi.h>
|
||||||
|
|
||||||
#ifdef SPARC64
|
#ifdef SPARC64
|
||||||
/* Only compile this in for 64bit builds, because otherwise the object file
|
/* Only compile this in for 64bit builds, because otherwise the object file
|
||||||
will have inproper architecture due to used instructions. */
|
will have inproper architecture due to used instructions. */
|
||||||
|
|
||||||
|
#define C2(X, Y) X ## Y
|
||||||
|
#define C1(X, Y) C2(X, Y)
|
||||||
|
|
||||||
|
#ifdef __USER_LABEL_PREFIX__
|
||||||
|
# define C(Y) C1(__USER_LABEL_PREFIX__, Y)
|
||||||
|
#else
|
||||||
|
# define C(Y) Y
|
||||||
|
#endif
|
||||||
|
#define L(Y) C1(.L, Y)
|
||||||
|
|
||||||
|
|
||||||
#define STACKFRAME 176 /* Minimum stack framesize for SPARC 64-bit */
|
#define STACKFRAME 176 /* Minimum stack framesize for SPARC 64-bit */
|
||||||
#define STACK_BIAS 2047
|
#define STACK_BIAS 2047
|
||||||
#define ARGS (128) /* Offset of register area in frame */
|
#define ARGS (128) /* Offset of register area in frame */
|
||||||
|
|
||||||
.text
|
.text
|
||||||
.align 8
|
.align 8
|
||||||
.globl ffi_call_v9
|
.globl C(ffi_call_v9)
|
||||||
.globl _ffi_call_v9
|
.type C(ffi_call_v9),@function
|
||||||
|
FFI_HIDDEN(C(ffi_call_v9))
|
||||||
|
|
||||||
ffi_call_v9:
|
C(ffi_call_v9):
|
||||||
_ffi_call_v9:
|
cfi_startproc
|
||||||
.LLFB1:
|
|
||||||
save %sp, -STACKFRAME, %sp
|
save %sp, -STACKFRAME, %sp
|
||||||
.LLCFI0:
|
cfi_def_cfa_register(%fp)
|
||||||
|
cfi_window_save
|
||||||
|
|
||||||
sub %sp, %i2, %sp ! alloca() space in stack for frame to set up
|
sub %sp, %i2, %sp ! alloca() space in stack for frame to set up
|
||||||
add %sp, STACKFRAME+STACK_BIAS, %l0 ! %l0 has start of
|
add %sp, STACKFRAME+STACK_BIAS, %l0 ! %l0 has start of
|
||||||
@@ -83,34 +96,35 @@ _ffi_call_v9:
|
|||||||
sub %l0, STACK_BIAS, %sp ! (delay) switch to frame
|
sub %l0, STACK_BIAS, %sp ! (delay) switch to frame
|
||||||
|
|
||||||
! If the return value pointer is NULL, assume no return value.
|
! If the return value pointer is NULL, assume no return value.
|
||||||
brz,pn %i4, done
|
brz,pn %i4, L(done)
|
||||||
nop
|
nop
|
||||||
|
|
||||||
cmp %i3, FFI_TYPE_INT
|
cmp %i3, FFI_TYPE_INT
|
||||||
be,a,pt %icc, done
|
be,a,pt %icc, L(done)
|
||||||
stx %o0, [%i4+0] ! (delay)
|
stx %o0, [%i4+0] ! (delay)
|
||||||
|
|
||||||
cmp %i3, FFI_TYPE_FLOAT
|
cmp %i3, FFI_TYPE_FLOAT
|
||||||
be,a,pn %icc, done
|
be,a,pn %icc, L(done)
|
||||||
st %f0, [%i4+0] ! (delay)
|
st %f0, [%i4+0] ! (delay)
|
||||||
|
|
||||||
cmp %i3, FFI_TYPE_DOUBLE
|
cmp %i3, FFI_TYPE_DOUBLE
|
||||||
be,a,pn %icc, done
|
be,a,pn %icc, L(done)
|
||||||
std %f0, [%i4+0] ! (delay)
|
std %f0, [%i4+0] ! (delay)
|
||||||
|
|
||||||
cmp %i3, FFI_TYPE_STRUCT
|
cmp %i3, FFI_TYPE_STRUCT
|
||||||
be,pn %icc, dostruct
|
be,pn %icc, L(dostruct)
|
||||||
|
|
||||||
cmp %i3, FFI_TYPE_LONGDOUBLE
|
cmp %i3, FFI_TYPE_LONGDOUBLE
|
||||||
bne,pt %icc, done
|
bne,pt %icc, L(done)
|
||||||
nop
|
nop
|
||||||
std %f0, [%i4+0]
|
std %f0, [%i4+0]
|
||||||
std %f2, [%i4+8]
|
std %f2, [%i4+8]
|
||||||
|
|
||||||
done: ret
|
L(done):
|
||||||
|
ret
|
||||||
restore
|
restore
|
||||||
|
|
||||||
dostruct:
|
L(dostruct):
|
||||||
/* This will not work correctly for unions. */
|
/* This will not work correctly for unions. */
|
||||||
stx %o0, [%i4+0]
|
stx %o0, [%i4+0]
|
||||||
stx %o1, [%i4+8]
|
stx %o1, [%i4+8]
|
||||||
@@ -122,10 +136,9 @@ dostruct:
|
|||||||
std %f6, [%i4+56]
|
std %f6, [%i4+56]
|
||||||
ret
|
ret
|
||||||
restore
|
restore
|
||||||
.LLFE1:
|
|
||||||
|
|
||||||
.ffi_call_v9_end:
|
cfi_endproc
|
||||||
.size ffi_call_v9,.ffi_call_v9_end-ffi_call_v9
|
.size C(ffi_call_v9), . - C(ffi_call_v9)
|
||||||
|
|
||||||
|
|
||||||
#undef STACKFRAME
|
#undef STACKFRAME
|
||||||
@@ -138,14 +151,16 @@ dostruct:
|
|||||||
|
|
||||||
Receives the closure argument in %g1. */
|
Receives the closure argument in %g1. */
|
||||||
|
|
||||||
.text
|
|
||||||
.align 8
|
.align 8
|
||||||
.globl ffi_closure_v9
|
.globl C(ffi_closure_v9)
|
||||||
|
.type C(ffi_closure_v9),@function
|
||||||
|
FFI_HIDDEN(C(ffi_closure_v9))
|
||||||
|
|
||||||
ffi_closure_v9:
|
C(ffi_closure_v9):
|
||||||
.LLFB2:
|
cfi_startproc
|
||||||
save %sp, -STACKFRAME, %sp
|
save %sp, -STACKFRAME, %sp
|
||||||
.LLCFI1:
|
cfi_def_cfa_register(%fp)
|
||||||
|
cfi_window_save
|
||||||
|
|
||||||
! Store all of the potential argument registers in va_list format.
|
! Store all of the potential argument registers in va_list format.
|
||||||
stx %i0, [FP+128+0]
|
stx %i0, [FP+128+0]
|
||||||
@@ -177,28 +192,28 @@ ffi_closure_v9:
|
|||||||
mov %g1, %o0
|
mov %g1, %o0
|
||||||
add %fp, STACK_BIAS-160, %o1
|
add %fp, STACK_BIAS-160, %o1
|
||||||
add %fp, STACK_BIAS+128, %o2
|
add %fp, STACK_BIAS+128, %o2
|
||||||
call ffi_closure_sparc_inner_v9
|
call C(ffi_closure_sparc_inner_v9)
|
||||||
add %fp, STACK_BIAS-128, %o3
|
add %fp, STACK_BIAS-128, %o3
|
||||||
|
|
||||||
! Load up the return value in the proper type.
|
! Load up the return value in the proper type.
|
||||||
! See ffi_prep_cif_machdep for the list of cases.
|
! See ffi_prep_cif_machdep for the list of cases.
|
||||||
cmp %o0, FFI_TYPE_VOID
|
cmp %o0, FFI_TYPE_VOID
|
||||||
be,pn %icc, done1
|
be,pn %icc, L(done1)
|
||||||
|
|
||||||
cmp %o0, FFI_TYPE_INT
|
cmp %o0, FFI_TYPE_INT
|
||||||
be,pn %icc, integer
|
be,pn %icc, L(integer)
|
||||||
|
|
||||||
cmp %o0, FFI_TYPE_FLOAT
|
cmp %o0, FFI_TYPE_FLOAT
|
||||||
be,a,pn %icc, done1
|
be,a,pn %icc, L(done1)
|
||||||
ld [FP-160], %f0
|
ld [FP-160], %f0
|
||||||
|
|
||||||
cmp %o0, FFI_TYPE_DOUBLE
|
cmp %o0, FFI_TYPE_DOUBLE
|
||||||
be,a,pn %icc, done1
|
be,a,pn %icc, L(done1)
|
||||||
ldd [FP-160], %f0
|
ldd [FP-160], %f0
|
||||||
|
|
||||||
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
||||||
cmp %o0, FFI_TYPE_LONGDOUBLE
|
cmp %o0, FFI_TYPE_LONGDOUBLE
|
||||||
be,a,pn %icc, longdouble1
|
be,a,pn %icc, L(longdouble1)
|
||||||
ldd [FP-160], %f0
|
ldd [FP-160], %f0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -211,97 +226,24 @@ ffi_closure_v9:
|
|||||||
ldd [FP-144], %f4
|
ldd [FP-144], %f4
|
||||||
ldd [FP-136], %f6
|
ldd [FP-136], %f6
|
||||||
|
|
||||||
integer:
|
L(integer):
|
||||||
ldx [FP-160], %i0
|
ldx [FP-160], %i0
|
||||||
|
|
||||||
done1:
|
L(done1):
|
||||||
ret
|
ret
|
||||||
restore
|
restore
|
||||||
|
|
||||||
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
||||||
longdouble1:
|
L(longdouble1):
|
||||||
ldd [FP-152], %f2
|
ldd [FP-152], %f2
|
||||||
ret
|
ret
|
||||||
restore
|
restore
|
||||||
#endif
|
#endif
|
||||||
.LLFE2:
|
|
||||||
|
|
||||||
.ffi_closure_v9_end:
|
cfi_endproc
|
||||||
.size ffi_closure_v9,.ffi_closure_v9_end-ffi_closure_v9
|
.size C(ffi_closure_v9), . - C(ffi_closure_v9)
|
||||||
|
|
||||||
#ifdef HAVE_RO_EH_FRAME
|
|
||||||
.section ".eh_frame",#alloc
|
|
||||||
#else
|
|
||||||
.section ".eh_frame",#alloc,#write
|
|
||||||
#endif
|
|
||||||
.LLframe1:
|
|
||||||
.uaword .LLECIE1-.LLSCIE1 ! Length of Common Information Entry
|
|
||||||
.LLSCIE1:
|
|
||||||
.uaword 0x0 ! CIE Identifier Tag
|
|
||||||
.byte 0x1 ! CIE Version
|
|
||||||
.ascii "zR\0" ! CIE Augmentation
|
|
||||||
.byte 0x1 ! uleb128 0x1; CIE Code Alignment Factor
|
|
||||||
.byte 0x78 ! sleb128 -8; CIE Data Alignment Factor
|
|
||||||
.byte 0xf ! CIE RA Column
|
|
||||||
.byte 0x1 ! uleb128 0x1; Augmentation size
|
|
||||||
#ifdef HAVE_AS_SPARC_UA_PCREL
|
|
||||||
.byte 0x1b ! FDE Encoding (pcrel sdata4)
|
|
||||||
#else
|
|
||||||
.byte 0x50 ! FDE Encoding (aligned absolute)
|
|
||||||
#endif
|
|
||||||
.byte 0xc ! DW_CFA_def_cfa
|
|
||||||
.byte 0xe ! uleb128 0xe
|
|
||||||
.byte 0xff,0xf ! uleb128 0x7ff
|
|
||||||
.align 8
|
|
||||||
.LLECIE1:
|
|
||||||
.LLSFDE1:
|
|
||||||
.uaword .LLEFDE1-.LLASFDE1 ! FDE Length
|
|
||||||
.LLASFDE1:
|
|
||||||
.uaword .LLASFDE1-.LLframe1 ! FDE CIE offset
|
|
||||||
#ifdef HAVE_AS_SPARC_UA_PCREL
|
|
||||||
.uaword %r_disp32(.LLFB1)
|
|
||||||
.uaword .LLFE1-.LLFB1 ! FDE address range
|
|
||||||
#else
|
|
||||||
.align 8
|
|
||||||
.xword .LLFB1
|
|
||||||
.uaxword .LLFE1-.LLFB1 ! FDE address range
|
|
||||||
#endif
|
|
||||||
.byte 0x0 ! uleb128 0x0; Augmentation size
|
|
||||||
.byte 0x4 ! DW_CFA_advance_loc4
|
|
||||||
.uaword .LLCFI0-.LLFB1
|
|
||||||
.byte 0xd ! DW_CFA_def_cfa_register
|
|
||||||
.byte 0x1e ! uleb128 0x1e
|
|
||||||
.byte 0x2d ! DW_CFA_GNU_window_save
|
|
||||||
.byte 0x9 ! DW_CFA_register
|
|
||||||
.byte 0xf ! uleb128 0xf
|
|
||||||
.byte 0x1f ! uleb128 0x1f
|
|
||||||
.align 8
|
|
||||||
.LLEFDE1:
|
|
||||||
.LLSFDE2:
|
|
||||||
.uaword .LLEFDE2-.LLASFDE2 ! FDE Length
|
|
||||||
.LLASFDE2:
|
|
||||||
.uaword .LLASFDE2-.LLframe1 ! FDE CIE offset
|
|
||||||
#ifdef HAVE_AS_SPARC_UA_PCREL
|
|
||||||
.uaword %r_disp32(.LLFB2)
|
|
||||||
.uaword .LLFE2-.LLFB2 ! FDE address range
|
|
||||||
#else
|
|
||||||
.align 8
|
|
||||||
.xword .LLFB2
|
|
||||||
.uaxword .LLFE2-.LLFB2 ! FDE address range
|
|
||||||
#endif
|
|
||||||
.byte 0x0 ! uleb128 0x0; Augmentation size
|
|
||||||
.byte 0x4 ! DW_CFA_advance_loc4
|
|
||||||
.uaword .LLCFI1-.LLFB2
|
|
||||||
.byte 0xd ! DW_CFA_def_cfa_register
|
|
||||||
.byte 0x1e ! uleb128 0x1e
|
|
||||||
.byte 0x2d ! DW_CFA_GNU_window_save
|
|
||||||
.byte 0x9 ! DW_CFA_register
|
|
||||||
.byte 0xf ! uleb128 0xf
|
|
||||||
.byte 0x1f ! uleb128 0x1f
|
|
||||||
.align 8
|
|
||||||
.LLEFDE2:
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#endif /* SPARC64 */
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
.section .note.GNU-stack,"",@progbits
|
.section .note.GNU-stack,"",@progbits
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user