anchor.diff:                                           ,current-thread))
              (sys.int::cpu-relax))
            (multiple-value-prog1 (progn ,@body)
  -           (setf (sys.int::%struct-slot ,controller-sym 1) :unlocked))))))
  +           (setf (ata-controller-access-lock ,controller-sym) :unlocked))))))
   
   (defmacro with-ata-use-lock ((controller) &body body)
  -  (let ((current-thread (gensym))
  -        (controller-sym (gensym)))
  -    `(let ((,controller-sym ,controller))
  -       (without-interrupts
  -         (let ((,current-thread (sys.int::current-thread)))
  -           (do ()
  -               ((sys.int::%cas-struct-slot ,controller-sym 2
  -                                           :unlocked
  -                                           ,current-thread))
  -             (sys.int::cpu-relax))))
  -       (multiple-value-prog1 (progn ,@body)
  -         (setf (sys.int::%struct-slot ,controller-sym 2) :unlocked)))))
  +  `(with-mutex (,controller)
  +     ,@body))
   
   (defun ata-alt-status (controller)
     "Read the alternate status register."
  
positive.code:   t)
  
  (defun ata-detect-drive (controller channel)
    (with-ata-spinlock (controller)
      ;; Select the device.
      (when (not (ata-select-device controller channel))
        (debug-write-line "Could not select ata device when probing.")
        (return-from ata-detect-drive nil))
      (let ((buf (sys.int::make-simple-vector 256)))
        ;; Issue IDENTIFY.
        (setf (sys.int::io-port/8 (+ (ata-controller-command controller)
                                     +ata-register-command+))
  
negative.code: (defstruct (ata-controller
               (:area :wired))
    ;; Taken when accessing the controller. Disables interrupts.
    (access-lock :unlocked) ; must be first slot.
    ;; Taken while there's a command in progress. Does not disable interrupts.
    (command-lock (make-mutex))
    command
    control
    irq
  