Changeset 9679


Ignore:
Timestamp:
Jun 6, 2008, 5:23:46 AM (11 years ago)
Author:
rme
Message:

%do-ff-call: get it mostly working (still need to handle results returned
in both %eax and %edx).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ia32/level-0/X86/X8632/x8632-def.lisp

    r9643 r9679  
    513513;;;     stack and put the value in there for us.
    514514
    515 (defx86lapfunction %do-ff-call ((frame arg_y) (entry arg_z))
    516   (int ($ 3))
    517   (pop (% ra0))
    518   (movl (% ebp) (@  (% esp)))
    519   (movl (% esp) (% ebp))
    520   (movl (% ra0) (@ 4 (% ebp)))
     515;;; flags = 0, return value in eax; 1 single-float; 2 double-float
     516(defx8632lapfunction %do-ff-call ((flags 4) #|(ra 0)|# (frame arg_y) (entry arg_z))
     517  (movl (% ebp) (@ 8 (% esp)))
     518  (leal (@ 8 (% esp)) (% ebp))
     519  (popl (@ 4 (% ebp)))
     520  (push (% arg_y))
     521  (push (% arg_z))
    521522  (call-subprim .SPffcall)
    522   (movd (@ (% :rcontext) x8664::tcr.foreign-sp) (% mm5))
    523   (movd (% mm5) (@ (% frame)))
    524   (movl (% frame) (@ (% :rcontext) x8664::tcr.foreign-sp))
     523  ;; there might be an fp result on x87 stack, so don't use
     524  ;; any mmx instructions until the result has been read.
     525  (movd (@ (% :rcontext) x8632::tcr.foreign-sp) (% xmm0))
     526  (movd (% xmm0) (@ (% frame)))
     527  (movl (% frame) (@ (% :rcontext) x8632::tcr.foreign-sp))
     528  (cmpl ($ '1) (@ -4 (% ebp)))
     529  (je @single)
     530  (jg @double)
    525531  (movl (% eax) (@ 4 (% frame)))
    526   ;; .SPffcall will have popped the fp result from the x87 stack
    527   ;; and stashed it in fp0.
    528   (movq (% fp0) (@ 8 (% frame)))
     532  (jmp @done)
     533  @single
     534  (fstps (@ 4 (% frame)))
     535  (jmp @done)
     536  @double
     537  (fstpl (@ 4 (% frame)))
     538  @done
    529539  (movl ($ nil) (% arg_z))
    530540  (restore-simple-frame)
     
    570580               total-words frame
    571581               (%setf-macptr-to-object argptr frame)
    572                (let* ((offset 0))
     582               (let* ((offset 4))
    573583                 (do* ((i 0 (1+ i))
    574584                       (specs specs-and-vals (cddr specs))
     
    606616                          (incf p 4)
    607617                          (incf offset 4))))))
    608                  (%do-ff-call frame entry)
     618                 (let ((flags (case result-spec
     619                                (:single-float 1)
     620                                (:double-float 2)
     621                                (t 0))))
     622                   (%do-ff-call flags frame entry))
    609623                 (ecase result-spec
    610624                   (:void nil)
     
    618632                   (:unsigned-doubleword (%%get-unsigned-longlong argptr 4))
    619633                   (:signed-doubleword (%%get-signed-longlong argptr 4))
    620                    (:single-float (%get-single-float argptr 8))
    621                    (:double-float (%get-double-float argptr 8)))))))))))
     634                   (:single-float (%get-single-float argptr 4))
     635                   (:double-float (%get-double-float argptr 4)))))))))))
    622636
    623637;;; end of x86-def.lisp
Note: See TracChangeset for help on using the changeset viewer.