Changeset 12084


Ignore:
Timestamp:
May 19, 2009, 4:18:52 AM (10 years ago)
Author:
rme
Message:

Merge 12074 (%ff-call/%do-ff-call and 64-bit return values).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/1.3/source/level-0/X86/X8632/x8632-def.lisp

    r11348 r12084  
    523523
    524524;;; This needs to:
    525 ;;; (b) call the .SPffcall subprimitive, which will discard the foreign stack frame
    526 ;;;     allocated by WITH-VARIABLE-C-FRAME in %FF-CALL
    527 ;;; (c) re-establish the same foreign stack frame and store the result regs
    528 ;;;     (%eax/%xmm0) there (not really xmm0, but .SPffcall will pop the x87
    529 ;;;     stack and put the value in there for us.
    530 
    531 ;;; flags = 0, return value in eax; 1 single-float; 2 double-float
     525;;; (a) call the .SPffcall subprimitive, which will discard the foreign
     526;;;     stack frame allocated by WITH-VARIABLE-C-FRAME in %FF-CALL
     527;;; (b) re-establish the same foreign stack frame and store the results
     528;;;     there.
     529;;;
     530;;; The flags argument tells us what/where the result is:
     531;;;
     532;;;; flags   meaning
     533;;;    0     32-bit value in EAX
     534;;;    1     single-float value on x87 stack
     535;;;    2     double-float value on x87 stack
     536;;;    3     64-bit value with low half in EAX, high half in tcr.unboxed1
     537
    532538(defx8632lapfunction %do-ff-call ((flags 4) #|(ra 0)|# (frame arg_y) (entry arg_z))
    533   (movl (% ebp) (@ 8 (% esp)))
    534   (leal (@ 8 (% esp)) (% ebp))
    535   (popl (@ 4 (% ebp)))
     539  (save-stackargs-frame 1)
    536540  (push (% arg_y))
    537541  (push (% arg_z))
     
    542546  (movd (% xmm0) (@ (% frame)))
    543547  (movl (% frame) (:rcontext x8632::tcr.foreign-sp))
    544   (cmpl ($ '1) (@ -4 (% ebp)))
    545   (je @single)
    546   (jg @double)
     548  (cmpl ($ 0) (@ -4 (% ebp)))
     549  (jne @fp-or-doubleword)
    547550  (movl (% eax) (@ 4 (% frame)))
     551  @done
     552  (movl ($ nil) (% arg_z))
     553  (restore-simple-frame)
     554  (single-value-return)
     555  @fp-or-doubleword
     556  (cmpl ($ '2) (@ -4 (% ebp)))
     557  (jl @single)
     558  (je @double)
     559  ;; high 32 bits in tcr.unboxed1 (see .SPffcall)
     560  (movl (% eax) (@ 4 (% frame)))
     561  (movl (:rcontext x8632::tcr.unboxed1) (% eax))
     562  (movl (% eax) (@ 8 (% frame)))
    548563  (jmp @done)
    549564  @single
     
    552567  @double
    553568  (fstpl (@ 4 (% frame)))
    554   @done
    555   (movl ($ nil) (% arg_z))
    556   (restore-simple-frame)
    557   (single-value-return))
    558  
     569  (jmp @done))
     570
    559571(defun %ff-call (entry &rest specs-and-vals)
    560572  (declare (dynamic-extent specs-and-vals))
     
    635647                                (:single-float 1)
    636648                                (:double-float 2)
     649                                ((:signed-doubleword :unsigned-doubleword) 3)
    637650                                (t 0))))
    638651                   (%do-ff-call flags frame entry))
Note: See TracChangeset for help on using the changeset viewer.