• Show log

    Commit

  • Hash : 159b94e5
    Author : James Cowgill
    Date : 2018-04-19T01:28:23

    Various MIPS Fixes (#425)
    
    * mips: simplify closure #defines
    
    This commit should have no visible effect.
    
    * mips: add special handling of variadic functions
    
    MIPS requires special handling of variadic functions which pass floating
    point arguments:
    * In the o32 ABI, all float arguments are passed in integer registers.
    * In the n32/n64 ABIs, float arguments after the ellipsis are passed in
      integer registers.
    
    Implement this in libffi. To support this in n32/n64 closures, we need to add
    a new mips_nfixedargs field to ffi_cif which will break the libffi ABI.
    
    This fixes the libffi.call/cls_longdouble_va.c test which was failing on
    64-bit MIPS.
    
    * mips: align argn for all 64-bit types in o32 closure handler
    
    Ensure that argn is pre-aligned for all 64-bit argument types (including
    doubles) and not just integer types.
    
    This fixes closures of the form "f(float, double, <some integer args>)".
    Previously the first integer argument would be read from a2 which is garbage
    at this point (the float arguments have already "consumed" a0-a3). After
    this commit, argn is correctly padded between the "float" and "double"
    arguments so that the first integer argument is read from the stack.
    
    Fixes "double f(float,double,int)" test in #371
    
    * mips: do not read from floating point register if returning a struct
    
    In the o32 ABI, the pointer passed in a0 used to return structures
    indirectly is treated as the first argument for argument allocation purposes.
    This means that it should inhibit floating point registers the same way that
    other integer arguments do.
    
    Fixes "Double f(float,Double,double)" test in #371
    
    * mips: fix pointer cast warnings
    
    Fix two pointer cast warnings when compiled on 64-bit mips by casting
    through uintptr_t.
    
    Fixes mips64el part of #404