Changeset 6558


Ignore:
Timestamp:
May 16, 2007, 7:25:44 AM (15 years ago)
Author:
gb
Message:

xp-argument-list: stack args are under return address, exception callback
frame (xcf) on stack.

handle-udf-call: don't try to fix up the stack if we try to continue;
let kernel deal with this after the callback.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/level-1/x86-error-signal.lisp

    r6004 r6558  
    2121  (ldb (byte (- 16 x8664::fixnumshift) 0)
    2222                    (encoded-gpr-lisp xp x8664::nargs.q)))
     23
     24
    2325
    2426(defun xp-argument-list (xp)
     
    3032          ((eql nargs 1) (list arg-z))
    3133          ((eql nargs 2) (list arg-y arg-z))
    32           (t (let ((args (list arg-x arg-y arg-z)))
    33                (if (eql nargs 3)
    34                  args
    35                  (let ((sp (encoded-gpr-macptr xp x8664::rsp)))
    36                    (dotimes (i (- nargs 3))
    37                      (push (%get-object sp (* i target::node-size)) args))
    38                    args)))))))
    39 
     34          (t
     35           (let ((args (list arg-x arg-y arg-z)))
     36             (if (eql nargs 3)
     37               args
     38               (let ((sp (%inc-ptr (encoded-gpr-macptr xp x8664::rsp)
     39                                   (+ x8664::node-size x8664::xcf.size))))
     40                 (dotimes (i (- nargs 3))
     41                   (push (%get-object sp (* i x8664::node-size)) args))
     42                 args)))))))
     43                         
     44;;; Making this be continuable is hard, because of the xcf on the
     45;;; stack and the way that the kernel saves/restores rsp and rbp
     46;;; before calling out.  If we get around those problems, then
     47;;; we have to also deal with the fact that the return address
     48;;; is on the stack.  Easiest to make the kernel deal with that,
     49;;; and just set %fn to the function that returns the values
     50;;; returned by the (newly defined) function and %arg_z to
     51;;; that list of values.
    4052(defun handle-udf-call (xp frame-ptr)
    4153  (let* ((args (xp-argument-list xp))
     
    4557                   (list (encoded-gpr-lisp xp x8664::fname) args)
    4658                   frame-ptr)))
    47          (stack-argcnt (max 0 (- (length args) 3)))
    48          (rsp (%i+ (encoded-gpr-lisp xp x8664::rsp)
    49                    (if (zerop stack-argcnt)
    50                      0
    51                      (+ stack-argcnt 2))))
    5259         (f #'(lambda (values) (apply #'values values))))
    53     (setf (encoded-gpr-lisp xp x8664::rsp) rsp
    54           (encoded-gpr-lisp xp x8664::nargs.q) 1
    55           (encoded-gpr-lisp xp x8664::arg_z) values
    56           (encoded-gpr-lisp xp x8664::fn) f)
    57     (setf (indexed-gpr-lisp xp rip-register-offset) f)))
     60    (setf (encoded-gpr-lisp xp x8664::arg_z) values
     61          (encoded-gpr-lisp xp x8664::fn) f)))
    5862 
    5963(defcallback %xerr-disp (:address xp :address xcf :int)
Note: See TracChangeset for help on using the changeset viewer.