+ ;; Establish our stack frame.
+ (inst mov ebp-tn esp-tn)
+
+ ;; This section based on VOP CALL-OUT.
+ ;; Restore the NPX for lisp; ensure no regs are empty
+ (dotimes (i 8)
+ (inst fldz))
+
+ ;; Find our unwind-block by way of our SEH frame.
+ (inst mov block (make-ea :dword :base ebp-tn :disp #x28))
+ (inst lea block (make-ea :dword :base block
+ :disp (- (* unwind-block-next-seh-frame-slot
+ n-word-bytes))))
+
+ ;; Update *CURRENT-UNWIND-PROTECT-BLOCK*.
+ (loadw ebx-tn block unwind-block-current-uwp-slot)
+ (store-tl-symbol-value ebx-tn *current-unwind-protect-block* ecx-tn)
+
+ ;; Uwp-entry expects some things in known locations so that they can
+ ;; be saved on the stack: the block in edx-tn, start in ebx-tn, and
+ ;; count in ecx-tn. We don't actually have any of that here, but we
+ ;; do need to have access to our own stack frame, so we hijack the
+ ;; known locations to cover our own state.
+
+ (inst xor ebx-tn ebx-tn)
+ (inst xor ecx-tn ecx-tn)
+ (inst mov ebx-tn ebp-tn)
+ (loadw ebp-tn block unwind-block-current-cont-slot)
+ (inst jmp (make-ea-for-object-slot block unwind-block-entry-pc-slot 0)))
+
+#!+win32
+(define-assembly-routine (continue-unwind
+ (:return-style :none)
+ (:translate %continue-unwind)
+ (:policy :fast-safe))
+ ((:arg block (any-reg descriptor-reg) eax-offset)
+ (:arg start (any-reg descriptor-reg) ebx-offset)
+ (:arg count (any-reg descriptor-reg) ecx-offset))
+ (declare (ignore block count))
+ ;; The args here are mostly ignored because we're using the
+ ;; win32 unwind mechanism and keep all that elsewhere. The
+ ;; exception is START, which we use to pass the saved EBP for
+ ;; our exception handler.
+
+ ;; "All" we have to do here is reload our EBP, reestablish a C
+ ;; environment, and return ExceptionContinueSearch. The OS
+ ;; handles the rest.
+
+ ;; Restore our frame pointer.
+ (inst mov esp-tn start)
+
+ ;; This section copied from VOP CALL-OUT.
+ ;; Setup the NPX for C; all the FP registers need to be
+ ;; empty; pop them all.
+ (dotimes (i 8)
+ (inst fstp fr0-tn))
+
+ ;; I'm unlikely to ever forget this again.
+ (inst cld)
+
+ ;; Restore our saved registers
+ (inst popa)
+
+ ;; And we're done.
+ (inst mov eax-tn 1) ;; exception-continue-search
+ (inst ret))