From 970cfd286291dd50888e19435e18fa580e1e15cd Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Fri, 2 Dec 2022 10:45:11 -0700 Subject: [PATCH] ide: yield instead of spin --- ided/src/ide.rs | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/ided/src/ide.rs b/ided/src/ide.rs index 7cadcae91e..74a5e1c48d 100644 --- a/ided/src/ide.rs +++ b/ided/src/ide.rs @@ -1,6 +1,7 @@ use std::{ convert::TryInto, sync::{Arc, Mutex}, + thread, }; use syscall::{ error::{Error, Result, EIO}, @@ -9,18 +10,6 @@ use syscall::{ use crate::ata::AtaCommand; -#[cfg(target_arch = "aarch64")] -#[inline(always)] -pub(crate) unsafe fn pause() { std::arch::aarch64::__yield(); } - -#[cfg(target_arch = "x86")] -#[inline(always)] -pub(crate) unsafe fn pause() { std::arch::x86::_mm_pause(); } - -#[cfg(target_arch = "x86_64")] -#[inline(always)] -pub(crate) unsafe fn pause() { std::arch::x86_64::_mm_pause(); } - #[repr(packed)] struct PrdtEntry { phys: u32, @@ -129,7 +118,7 @@ impl Channel { loop { let status = self.check_status()?; if status & 0x80 != 0 { - unsafe { pause(); } + thread::yield_now(); } else { if read && status & 0x08 == 0 { log::error!("IDE data not ready");