anchor.diff:  ;;;; This code is licensed under the MIT license.
   
   (in-package :mezzano.delimited-continuations)
  -
  -;; TODO: The assembly functions should inhibit footholds while switching stacks.
   
   (deftype delimited-continuation ()
     `(satisfies delimited-continuation-p))
  
positive.code:   (lap:mov64 (:object :rbx #.sys.int::+delimited-continuation-prompt+) 0)
    (lap:mov64 (:object :rbx #.sys.int::+delimited-continuation-stack-pointer+) 0)
    (lap:mov64 (:object :rbx #.sys.int::+delimited-continuation-stack+) 0)
    ;; Now return to the function that originally aborted.
    (lap:leave)
    (:gc :no-frame :layout #*0 :multiple-values 0)
    (lap:ret)
    TOO-MANY-VALUES
    (:gc :frame)
    (lap:mov64 :r13 (:function error))
    (lap:mov64 :r8 (:constant "Resuming continuation ~S with too many values (MULTPLE-VALUES-LIMIT exceeded)"))
    (lap:mov32 :ecx #.(ash 1 sys.int::+n-fixnum-bits+))
  
negative.code:   (lap:add64 :rsp 8) ; drop saved count
    ONLY-REG-ARGS
    (:gc :frame :multiple-values 0)
    ;; Work with footholds inhibitied.
    (lap:gs)
    (lap:add64 (:object nil #.mezzano.supervisor::+thread-inhibit-footholds+)
               #.(ash 1 sys.int::+n-fixnum-bits+))
    ;; Fetch the prompt from the continuation.
    (lap:mov64 :rax (:object :rbx #.sys.int::+delimited-continuation-prompt+))
    ;; Update the saved original stack object.
  