mirror of
https://github.com/partic2/libffi
synced 2026-11-10 10:07:19 +00:00
m68k fixes for signed 8 and 16-bit calls.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2013-01-07 Thorsten Glaser <tg@mirbsd.org>
|
||||||
|
|
||||||
|
* src/m68k/ffi.c (CIF_FLAGS_SINT8, CIF_FLAGS_SINT16): Define.
|
||||||
|
(ffi_prep_cif_machdep): Fix 8-bit and 16-bit signed calls.
|
||||||
|
* src/m68k/sysv.S (ffi_call_SYSV, ffi_closure_SYSV): Ditto.
|
||||||
|
|
||||||
2013-01-04 Anthony Green <green@moxielogic.com>
|
2013-01-04 Anthony Green <green@moxielogic.com>
|
||||||
|
|
||||||
* Makefile.am (AM_CFLAGS): Don't automatically add -fexceptions
|
* Makefile.am (AM_CFLAGS): Don't automatically add -fexceptions
|
||||||
|
|||||||
@@ -123,6 +123,8 @@ ffi_prep_args (void *stack, extended_cif *ecif)
|
|||||||
#define CIF_FLAGS_POINTER 32
|
#define CIF_FLAGS_POINTER 32
|
||||||
#define CIF_FLAGS_STRUCT1 64
|
#define CIF_FLAGS_STRUCT1 64
|
||||||
#define CIF_FLAGS_STRUCT2 128
|
#define CIF_FLAGS_STRUCT2 128
|
||||||
|
#define CIF_FLAGS_SINT8 256
|
||||||
|
#define CIF_FLAGS_SINT16 512
|
||||||
|
|
||||||
/* Perform machine dependent cif processing */
|
/* Perform machine dependent cif processing */
|
||||||
ffi_status
|
ffi_status
|
||||||
@@ -200,6 +202,14 @@ ffi_prep_cif_machdep (ffi_cif *cif)
|
|||||||
cif->flags = CIF_FLAGS_DINT;
|
cif->flags = CIF_FLAGS_DINT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case FFI_TYPE_SINT16:
|
||||||
|
cif->flags = CIF_FLAGS_SINT16;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FFI_TYPE_SINT8:
|
||||||
|
cif->flags = CIF_FLAGS_SINT8;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
cif->flags = CIF_FLAGS_INT;
|
cif->flags = CIF_FLAGS_INT;
|
||||||
break;
|
break;
|
||||||
|
|||||||
+39
-6
@@ -2,9 +2,10 @@
|
|||||||
|
|
||||||
sysv.S - Copyright (c) 2012 Alan Hourihane
|
sysv.S - Copyright (c) 2012 Alan Hourihane
|
||||||
Copyright (c) 1998, 2012 Andreas Schwab
|
Copyright (c) 1998, 2012 Andreas Schwab
|
||||||
Copyright (c) 2008 Red Hat, Inc.
|
Copyright (c) 2008 Red Hat, Inc.
|
||||||
|
Copyright (c) 2012 Thorsten Glaser
|
||||||
m68k Foreign Function Interface
|
|
||||||
|
m68k Foreign Function Interface
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
a copy of this software and associated documentation files (the
|
a copy of this software and associated documentation files (the
|
||||||
@@ -168,8 +169,22 @@ retstruct1:
|
|||||||
|
|
||||||
retstruct2:
|
retstruct2:
|
||||||
btst #7,%d2
|
btst #7,%d2
|
||||||
jbeq noretval
|
jbeq retsint8
|
||||||
move.w %d0,(%a1)
|
move.w %d0,(%a1)
|
||||||
|
jbra epilogue
|
||||||
|
|
||||||
|
retsint8:
|
||||||
|
btst #8,%d2
|
||||||
|
jbeq retsint16
|
||||||
|
extb.l %d0
|
||||||
|
move.l %d0,(%a1)
|
||||||
|
jbra epilogue
|
||||||
|
|
||||||
|
retsint16:
|
||||||
|
btst #9,%d2
|
||||||
|
jbeq noretval
|
||||||
|
ext.l %d0
|
||||||
|
move.l %d0,(%a1)
|
||||||
|
|
||||||
noretval:
|
noretval:
|
||||||
epilogue:
|
epilogue:
|
||||||
@@ -201,8 +216,10 @@ CALLFUNC(ffi_closure_SYSV):
|
|||||||
lsr.l #1,%d0
|
lsr.l #1,%d0
|
||||||
jne 1f
|
jne 1f
|
||||||
jcc .Lcls_epilogue
|
jcc .Lcls_epilogue
|
||||||
|
| CIF_FLAGS_INT
|
||||||
move.l -12(%fp),%d0
|
move.l -12(%fp),%d0
|
||||||
.Lcls_epilogue:
|
.Lcls_epilogue:
|
||||||
|
| no CIF_FLAGS_*
|
||||||
unlk %fp
|
unlk %fp
|
||||||
rts
|
rts
|
||||||
1:
|
1:
|
||||||
@@ -210,6 +227,7 @@ CALLFUNC(ffi_closure_SYSV):
|
|||||||
lsr.l #2,%d0
|
lsr.l #2,%d0
|
||||||
jne 1f
|
jne 1f
|
||||||
jcs .Lcls_ret_float
|
jcs .Lcls_ret_float
|
||||||
|
| CIF_FLAGS_DINT
|
||||||
move.l (%a0)+,%d0
|
move.l (%a0)+,%d0
|
||||||
move.l (%a0),%d1
|
move.l (%a0),%d1
|
||||||
jra .Lcls_epilogue
|
jra .Lcls_epilogue
|
||||||
@@ -224,6 +242,7 @@ CALLFUNC(ffi_closure_SYSV):
|
|||||||
lsr.l #2,%d0
|
lsr.l #2,%d0
|
||||||
jne 1f
|
jne 1f
|
||||||
jcs .Lcls_ret_ldouble
|
jcs .Lcls_ret_ldouble
|
||||||
|
| CIF_FLAGS_DOUBLE
|
||||||
#if defined(__MC68881__) || defined(__HAVE_68881__)
|
#if defined(__MC68881__) || defined(__HAVE_68881__)
|
||||||
fmove.d (%a0),%fp0
|
fmove.d (%a0),%fp0
|
||||||
#else
|
#else
|
||||||
@@ -242,17 +261,31 @@ CALLFUNC(ffi_closure_SYSV):
|
|||||||
jra .Lcls_epilogue
|
jra .Lcls_epilogue
|
||||||
1:
|
1:
|
||||||
lsr.l #2,%d0
|
lsr.l #2,%d0
|
||||||
jne .Lcls_ret_struct2
|
jne 1f
|
||||||
jcs .Lcls_ret_struct1
|
jcs .Lcls_ret_struct1
|
||||||
|
| CIF_FLAGS_POINTER
|
||||||
move.l (%a0),%a0
|
move.l (%a0),%a0
|
||||||
move.l %a0,%d0
|
move.l %a0,%d0
|
||||||
jra .Lcls_epilogue
|
jra .Lcls_epilogue
|
||||||
.Lcls_ret_struct1:
|
.Lcls_ret_struct1:
|
||||||
move.b (%a0),%d0
|
move.b (%a0),%d0
|
||||||
jra .Lcls_epilogue
|
jra .Lcls_epilogue
|
||||||
.Lcls_ret_struct2:
|
1:
|
||||||
|
lsr.l #2,%d0
|
||||||
|
jne 1f
|
||||||
|
jcs .Lcls_ret_sint8
|
||||||
|
| CIF_FLAGS_STRUCT2
|
||||||
move.w (%a0),%d0
|
move.w (%a0),%d0
|
||||||
jra .Lcls_epilogue
|
jra .Lcls_epilogue
|
||||||
|
.Lcls_ret_sint8:
|
||||||
|
move.l (%a0),%d0
|
||||||
|
extb.l %d0
|
||||||
|
jra .Lcls_epilogue
|
||||||
|
1:
|
||||||
|
| CIF_FLAGS_SINT16
|
||||||
|
move.l (%a0),%d0
|
||||||
|
ext.l %d0
|
||||||
|
jra .Lcls_epilogue
|
||||||
CFI_ENDPROC()
|
CFI_ENDPROC()
|
||||||
|
|
||||||
.size CALLFUNC(ffi_closure_SYSV),.-CALLFUNC(ffi_closure_SYSV)
|
.size CALLFUNC(ffi_closure_SYSV),.-CALLFUNC(ffi_closure_SYSV)
|
||||||
|
|||||||
Reference in New Issue
Block a user