virtio-gpu: start working on the scheme

Signed-off-by: Anhad Singh <andypython@protonmail.com>
This commit is contained in:
Anhad Singh
2023-07-03 17:12:59 +10:00
parent 4bbda21f0b
commit 7cc2f4eff7
15 changed files with 394 additions and 25 deletions
+12 -1
View File
@@ -1,7 +1,7 @@
use core::cell::UnsafeCell;
use core::fmt::Debug;
use core::marker::PhantomData;
#[derive(Debug)]
#[repr(C)]
pub struct VolatileCell<T> {
value: UnsafeCell<T>,
@@ -28,6 +28,17 @@ impl<T: Copy> VolatileCell<T> {
}
}
impl<T> Debug for VolatileCell<T>
where
T: Debug + Copy,
{
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("VolatileCell")
.field("value", &self.get())
.finish()
}
}
unsafe impl<T> Sync for VolatileCell<T> {}
#[repr(C)]