anchor.diff:    (mezzano.lap.arm64:mrs :x9 :fpcr)
     (mezzano.lap.arm64:movz :x10 (:object-literal #.+thread-arm64-fpcr+))
     (mezzano.lap.arm64:str :x9 (:x0 :x10))
  -  ;; Save stack pointer.
  -  (mezzano.lap.arm64:movz :x9 (:object-literal #.+thread-state-rsp+))
  -  (mezzano.lap.arm64:str :x1 (:x28 :x9))
  -  ;; Only partial state was saved.
  -  (mezzano.lap.arm64:movz :x9 (:object-literal #.+thread-full-save-p+))
  -  (mezzano.lap.arm64:str :x26 (:x28 :x9))
  -  ;; Jump to common function.
  -  (mezzano.lap.arm64:orr :x1 :xzr :x3)
  -  (mezzano.lap.arm64:ldr :x7 (:function %%switch-to-thread-common))
  -  (mezzano.lap.arm64:ldr :x9 (:object :x7 #.sys.int::+fref-entry-point+))
  -  (mezzano.lap.arm64:br :x9))
  -
  -(sys.int::define-lap-function %%switch-to-thread-common ((current-thread new-thread))
  -  ;; Old thread's state has been saved, restore the new-thread's state.
  -  ;; Switch threads.
  -  (mezzano.lap.arm64:orr :x28 :xzr :x1)
  -  ;; Restore fpu state.
  -  (mezzano.lap.arm64:add :x12 :x1 (:object-literal #.+thread-fx-save-area+))
  +  (mezzano.lap.arm64:ret))
  +
  +(sys.int::define-lap-function restore-fpu-state ((thread))
  +  (mezzano.lap.arm64:add :x12 :x0 (:object-literal #.+thread-fx-save-area+))
     (mezzano.lap.arm64:ldp :q0 :q1 (:post :x12 32))
     (mezzano.lap.arm64:ldp :q2 :q3 (:post :x12 32))
     (mezzano.lap.arm64:ldp :q4 :q5 (:post :x12 32))
  
positive.code:   (mezzano.lap.arm64:ldp :q28 :q29 (:post :x12 32))
    (mezzano.lap.arm64:ldp :q30 :q31 (:post :x12 32))
    (mezzano.lap.arm64:movz :x10 (:object-literal #.+thread-arm64-fpsr+))
    (mezzano.lap.arm64:ldr :x9 (:x1 :x10))
    (mezzano.lap.arm64:msr :fpsr :x9)
    (mezzano.lap.arm64:movz :x10 (:object-literal #.+thread-arm64-fpcr+))
    (mezzano.lap.arm64:ldr :x9 (:x1 :x10))
    (mezzano.lap.arm64:msr :fpcr :x9)
    ;; Drop the global thread lock. Must be done before touching the thread stack.
    (mezzano.lap.arm64:ldr :x2 (:constant :unlocked))
    (mezzano.lap.arm64:ldr :x3 (:constant *global-thread-lock*))
    (mezzano.lap.arm64:ldr :x3 (:object :x3 #.sys.int::+symbol-value+))
    (mezzano.lap.arm64:str (:object :x3 #.sys.int::+symbol-value-cell-value+) :x2)
    ;; Switch back to SP_EL0, restoring the original value of SP_EL1.
    (mezzano.lap.arm64:add :sp :x27 0)
    (mezzano.lap.arm64:msr :spsel 0)
    ;; Check if the thread is in the interrupt save area.
    (mezzano.lap.arm64:ldr :x2 (:object :x28 #.+thread-full-save-p+))
    (mezzano.lap.arm64:subs :xzr :x2 :x26)
    (mezzano.lap.arm64:b.ne FULL-RESTORE)
    ;; Restore stack pointer.
    (mezzano.lap.arm64:movz :x9 (:object-literal #.+thread-state-rsp+))
    (mezzano.lap.arm64:ldr :x9 (:x28 :x9))
  
negative.code:   (mezzano.lap.arm64:movz :x5 #.(ash 1 sys.int::+n-fixnum-bits+))
    (mezzano.lap.arm64:ldr :x7 (:function %run-thread-footholds))
    (mezzano.lap.arm64:ldr :x9 (:object :x7 #.sys.int::+fref-entry-point+))
    (mezzano.lap.arm64:br :x9))
  
  (sys.int::define-lap-function current-thread (())
  