1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-25 01:16:18 +04:00

Re-generate riscv patch on newer nightly

This commit is contained in:
jiegec 2020-06-15 17:47:44 +08:00
parent 18f862ca48
commit 59428269c7

View File

@ -1,88 +1,77 @@
*** atomic.rs.orig Fri Jan 17 23:48:15 2020 --- atomic.rs.orig 2020-06-15 17:40:17.961539834 +0800
--- atomic.rs Wed Jan 29 11:49:55 2020 +++ atomic.rs 2020-06-15 17:40:19.621514382 +0800
*************** @@ -156,8 +156,12 @@
*** 158,165 **** /// [`bool`]: ../../../std/primitive.bool.html
/// [`bool`]: ../../../std/primitive.bool.html #[cfg(target_has_atomic_load_store = "8")]
#[cfg(target_has_atomic_load_store = "8")] #[stable(feature = "rust1", since = "1.0.0")]
#[stable(feature = "rust1", since = "1.0.0")] -#[repr(C, align(1))]
! #[repr(C, align(1))] +#[cfg_attr(any(target_arch = "riscv32", target_arch = "riscv64"), repr(C, align(4)))]
pub struct AtomicBool { +#[cfg_attr(not(any(target_arch = "riscv32", target_arch = "riscv64")), repr(C, align(1)))]
v: UnsafeCell<u8>, pub struct AtomicBool {
} + #[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))]
+ v: UnsafeCell<u32>,
--- 158,169 ---- + #[cfg(not(any(target_arch = "riscv32", target_arch = "riscv64")))]
/// [`bool`]: ../../../std/primitive.bool.html v: UnsafeCell<u8>,
#[cfg(target_has_atomic_load_store = "8")] }
#[stable(feature = "rust1", since = "1.0.0")]
! #[cfg_attr(any(target_arch = "riscv32", target_arch = "riscv64"), repr(C, align(4)))] @@ -310,6 +314,60 @@
! #[cfg_attr(not(any(target_arch = "riscv32", target_arch = "riscv64")), repr(C, align(1)))] pub const ATOMIC_BOOL_INIT: AtomicBool = AtomicBool::new(false);
pub struct AtomicBool {
+ #[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))] #[cfg(target_has_atomic_load_store = "8")]
+ v: UnsafeCell<u32>, +#[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))]
+ #[cfg(not(any(target_arch = "riscv32", target_arch = "riscv64")))] +impl AtomicBool {
v: UnsafeCell<u8>, + ///
} + #[inline]
+ #[stable(feature = "rust1", since = "1.0.0")]
*************** + #[rustc_const_stable(feature = "const_atomic_new", since = "1.32.0")]
*** 312,317 **** + pub const fn new(v: bool) -> AtomicBool {
--- 316,375 ---- + AtomicBool { v: UnsafeCell::new(v as u32) }
pub const ATOMIC_BOOL_INIT: AtomicBool = AtomicBool::new(false); + }
+
#[cfg(target_has_atomic_load_store = "8")] + ///
+ #[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))] + #[inline]
+ impl AtomicBool { + #[stable(feature = "rust1", since = "1.0.0")]
+ /// + pub fn load(&self, order: Ordering) -> bool {
+ #[inline] + unsafe { atomic_load(self.v.get(), order) != 0 }
+ #[stable(feature = "rust1", since = "1.0.0")] + }
+ #[rustc_const_stable(feature = "const_atomic_new", since = "1.32.0")] +
+ pub const fn new(v: bool) -> AtomicBool { + ///
+ AtomicBool { v: UnsafeCell::new(v as u32) } + #[inline]
+ } + #[stable(feature = "rust1", since = "1.0.0")]
+ + pub fn store(&self, val: bool, order: Ordering) {
+ /// + unsafe { atomic_store(self.v.get(), val as u32, order); }
+ #[inline] + }
+ #[stable(feature = "rust1", since = "1.0.0")] +
+ pub fn load(&self, order: Ordering) -> bool { + ///
+ unsafe { atomic_load(self.v.get(), order) != 0 } + #[inline]
+ } + #[stable(feature = "rust1", since = "1.0.0")]
+ + pub fn compare_and_swap(&self, current: bool, new: bool, order: Ordering) -> bool {
+ /// + match self.compare_exchange(current, new, order, strongest_failure_ordering(order)) {
+ #[inline] + Ok(x) => x,
+ #[stable(feature = "rust1", since = "1.0.0")] + Err(x) => x,
+ pub fn store(&self, val: bool, order: Ordering) { + }
+ unsafe { atomic_store(self.v.get(), val as u32, order); } + }
+ } +
+ + ///
+ /// + #[inline]
+ #[inline] + #[stable(feature = "extended_compare_and_swap", since = "1.10.0")]
+ #[stable(feature = "rust1", since = "1.0.0")] + pub fn compare_exchange(&self,
+ pub fn compare_and_swap(&self, current: bool, new: bool, order: Ordering) -> bool { + current: bool,
+ match self.compare_exchange(current, new, order, strongest_failure_ordering(order)) { + new: bool,
+ Ok(x) => x, + success: Ordering,
+ Err(x) => x, + failure: Ordering)
+ } + -> Result<bool, bool> {
+ } + match unsafe {
+ + atomic_compare_exchange(self.v.get(), current as u32, new as u32, success, failure)
+ /// + } {
+ #[inline] + Ok(x) => Ok(x != 0),
+ #[stable(feature = "extended_compare_and_swap", since = "1.10.0")] + Err(x) => Err(x != 0),
+ pub fn compare_exchange(&self, + }
+ current: bool, + }
+ new: bool, +}
+ success: Ordering, +
+ failure: Ordering) +#[cfg(target_has_atomic_load_store = "8")]
+ -> Result<bool, bool> { +#[cfg(not(any(target_arch = "riscv32", target_arch = "riscv64")))]
+ match unsafe { impl AtomicBool {
+ atomic_compare_exchange(self.v.get(), current as u32, new as u32, success, failure) /// Creates a new `AtomicBool`.
+ } { ///
+ Ok(x) => Ok(x != 0),
+ Err(x) => Err(x != 0),
+ }
+ }
+ }
+
+ #[cfg(target_has_atomic_load_store = "8")]
+ #[cfg(not(any(target_arch = "riscv32", target_arch = "riscv64")))]
impl AtomicBool {
/// Creates a new `AtomicBool`.
///