Merge pull request #66 from ppizarro/master BlackFin fixes - Fatal error when calling a function defined in a shared library from within the function called by FFI
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
diff --git a/src/bfin/ffi.c b/src/bfin/ffi.c
index 0beccc1..22a2acd 100644
--- a/src/bfin/ffi.c
+++ b/src/bfin/ffi.c
@@ -1,5 +1,6 @@
/* -----------------------------------------------------------------------
- ffi.c - Copyright (c) 2012 Alexandre K. I. de Mendonca <alexandre.keunecke@gmail.com>
+ ffi.c - Copyright (c) 2012 Alexandre K. I. de Mendonca <alexandre.keunecke@gmail.com>,
+ Paulo Pizarro <paulo.pizarro@gmail.com>
Blackfin Foreign Function Interface
diff --git a/src/bfin/sysv.S b/src/bfin/sysv.S
index f1f8762..f4278be 100644
--- a/src/bfin/sysv.S
+++ b/src/bfin/sysv.S
@@ -1,5 +1,6 @@
/* -----------------------------------------------------------------------
- sysv.S - Copyright (c) 2012 Alexandre K. I. de Mendonca <alexandre.keunecke@gmail.com>
+ sysv.S - Copyright (c) 2012 Alexandre K. I. de Mendonca <alexandre.keunecke@gmail.com>,
+ Paulo Pizarro <paulo.pizarro@gmail.com>
Blackfin Foreign Function Interface
@@ -40,25 +41,26 @@
.func ffi_call_SYSV
/*
- cif->bytes = R0 (fp+8)
- &ecif = R1 (fp+12)
- ffi_prep_args = R2 (fp+16)
- ret_type = stack (fp+20)
- ecif.rvalue = stack (fp+24)
- fn = stack (fp+28)
- got (fp+32)
- There is room for improvement here (we can use temporary registers
+ cif->bytes = R0 (fp+8)
+ &ecif = R1 (fp+12)
+ ffi_prep_args = R2 (fp+16)
+ ret_type = stack (fp+20)
+ ecif.rvalue = stack (fp+24)
+ fn = stack (fp+28)
+ got (fp+32)
+
+ There is room for improvement here (we can use temporary registers
instead of saving the values in the memory)
- REGS:
- P5 => Stack pointer (function arguments)
- R5 => cif->bytes
- R4 => ret->type
-
- FP-20 = P3
- FP-16 = SP (parameters area)
- FP-12 = SP (temp)
- FP-08 = function return part 1 [R0]
- FP-04 = function return part 2 [R1]
+ REGS:
+ P5 => Stack pointer (function arguments)
+ R5 => cif->bytes
+ R4 => ret->type
+
+ FP-20 = P3
+ FP-16 = SP (parameters area)
+ FP-12 = SP (temp)
+ FP-08 = function return part 1 [R0]
+ FP-04 = function return part 2 [R1]
*/
_ffi_call_SYSV: