Advertisement
alllexx

libffi.mips.softfloat.patch

Apr 16th, 2015
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.01 KB | None | 0 0
  1. --- libffi/src/mips/o32.S.orig  2014-11-08 14:47:24.000000000 +0200
  2. +++ libffi/src/mips/o32.S   2015-04-16 12:03:11.302116104 +0300
  3. @@ -82,13 +82,16 @@
  4.        
  5.     ADDU    $sp, 4 * FFI_SIZEOF_ARG     # adjust $sp to new args
  6.  
  7. +#ifndef __mips_soft_float
  8.     bnez    t0, pass_d          # make it quick for int
  9. +#endif
  10.     REG_L   a0, 0*FFI_SIZEOF_ARG($sp)   # just go ahead and load the
  11.     REG_L   a1, 1*FFI_SIZEOF_ARG($sp)   # four regs.
  12.     REG_L   a2, 2*FFI_SIZEOF_ARG($sp)
  13.     REG_L   a3, 3*FFI_SIZEOF_ARG($sp)
  14.     b   call_it
  15.  
  16. +#ifndef __mips_soft_float
  17.  pass_d:
  18.     bne t0, FFI_ARGS_D, pass_f
  19.     l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
  20. @@ -130,6 +133,7 @@
  21.   # bne t0, FFI_ARGS_F_D, call_it
  22.     l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
  23.     l.d $f14, 2*FFI_SIZEOF_ARG($sp) # passing double and float
  24. +#endif
  25.  
  26.  call_it:  
  27.     # Load the function pointer
  28. @@ -158,14 +162,23 @@
  29.     bne     t2, FFI_TYPE_FLOAT, retdouble
  30.     jalr    t9
  31.     REG_L   t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp)
  32. +#ifndef __mips_soft_float
  33.     s.s $f0, 0(t0)
  34. +#else
  35. +   REG_S   v0, 0(t0)
  36. +#endif
  37.     b   epilogue
  38.  
  39.  retdouble:
  40.     bne t2, FFI_TYPE_DOUBLE, noretval
  41.     jalr    t9
  42.     REG_L   t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp)
  43. +#ifndef __mips_soft_float
  44.     s.d $f0, 0(t0)
  45. +#else
  46. +   REG_S   v1, 4(t0)
  47. +   REG_S   v0, 0(t0)
  48. +#endif
  49.     b   epilogue
  50.    
  51.  noretval: 
  52. @@ -261,9 +274,11 @@
  53.     li  $13, 1      # FFI_O32
  54.     bne $16, $13, 1f    # Skip fp save if FFI_O32_SOFT_FLOAT
  55.    
  56. +#ifndef __mips_soft_float
  57.     # Store all possible float/double registers.
  58.     s.d $f12, FA_0_0_OFF2($fp)
  59.     s.d $f14, FA_1_0_OFF2($fp)
  60. +#endif
  61.  1:
  62.     # Call ffi_closure_mips_inner_O32 to do the work.
  63.     la  t9, ffi_closure_mips_inner_O32
  64. @@ -281,6 +296,7 @@
  65.     li  $13, 1      # FFI_O32
  66.     bne $16, $13, 1f    # Skip fp restore if FFI_O32_SOFT_FLOAT
  67.  
  68. +#ifndef __mips_soft_float
  69.     li  $9, FFI_TYPE_FLOAT
  70.     l.s $f0, V0_OFF2($fp)
  71.     beq $8, $9, closure_done
  72. @@ -288,6 +304,7 @@
  73.     li  $9, FFI_TYPE_DOUBLE
  74.     l.d $f0, V0_OFF2($fp)
  75.     beq $8, $9, closure_done
  76. +#endif
  77.  1:
  78.     REG_L   $3, V1_OFF2($fp)
  79.     REG_L   $2, V0_OFF2($fp)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement