#![no_std] #![feature(const_trait_impl, const_default)] pub mod limine; pub mod serial; pub mod sync; pub mod x86_64; /// # Safety pub unsafe fn volatile_copy(src: *const T, dst: *mut T, count: usize) { unsafe { for i in 0..count { let src_ptr = src.add(i); let dst_ptr = dst.add(i); let val = src_ptr.read(); dst_ptr.write_volatile(val); } } } #[macro_export] macro_rules! drop_guard { ($($stmts:stmt)*) => { { struct __DropGuard(::core::mem::ManuallyDrop); impl __DropGuard { #[allow(dead_code)] fn forget(self) { let mut this = ::core::mem::ManuallyDrop::new(self); unsafe { ManuallyDrop::drop(&mut this.0); } } } impl Drop for __DropGuard { fn drop(&mut self) { unsafe { ::core::ptr::read(&*self.0)() } } } __DropGuard(::core::mem::ManuallyDrop::new(|| { $($stmts)* })) } }; }