Changeset 5828


Ignore:
Timestamp:
Jan 30, 2007, 4:43:40 PM (18 years ago)
Author:
Gary Byers
Message:

linuxppc32 always returns structures via the first-arg hack.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/lib/ffi-linuxppc32.lisp

    r5803 r5828  
    2020;;; Structures are never actually passed by value; the caller
    2121;;; instead passes a pointer to the structure or a copy of it.
    22 ;;; Structures whose size is 8 bytes or less are returned in r3/r4;
    23 ;;; this happens rarely enough that we can probably get away with
    24 ;;; boxing an :UNSIGNED-DOUBLEWORD and storing it in the structure-return
    25 ;;; argument.
    26 
     22;;; In the EABI (which Linux uses, as opposed to the SVR4 ABI)
     23;;; structures are always "returned" by passing a pointer to
     24;;; a caller-allocated structure in the first argument.
    2725(defun linux32::record-type-returns-structure-as-first-arg (rtype)
    2826  (when (and rtype
     
    3331                    rtype
    3432                    (parse-foreign-type rtype))))
    35       (and (typep ftype 'foreign-record-type)
    36            (> (ensure-foreign-type-bits ftype) 64)))))
     33      (typep ftype 'foreign-record-type))))
    3734
    3835
     
    5047          (argforms (pop args)))
    5148        (when (typep result-type 'foreign-record-type)
     49          (setq result-form (pop args))
    5250          (if (linux32::record-type-returns-structure-as-first-arg result-type)
    5351            (progn
     
    5654              (argforms :address)
    5755              (argforms result-form))
     56            ;; This only happens in the SVR4 ABI.
    5857            (progn
    5958              (setq result-type (parse-foreign-type :unsigned-doubleword)
    6059                    result-type-spec :unsigned-doubleword
    61                     enclosing-form `(setf (%%get-unsigned-longlong ,result-form))))))
     60                    enclosing-form `(setf (%%get-unsigned-longlong ,result-form 0))))))
    6261        (unless (evenp (length args))
    6362          (error "~s should be an even-length list of alternating foreign types and values" args))       
Note: See TracChangeset for help on using the changeset viewer.