diff --git a/kernel/arch/interface/src/sync.rs b/kernel/arch/interface/src/sync.rs index d3206a8f..1fb0304c 100644 --- a/kernel/arch/interface/src/sync.rs +++ b/kernel/arch/interface/src/sync.rs @@ -172,16 +172,13 @@ pub macro split_spinlock( use core::marker::PhantomData; use core::sync::atomic::{AtomicBool, Ordering}; - $(#[$meta])* - pub static $name: __Wrapper = __Wrapper { - inner: UnsafeCell::new($init) - }; - static __LOCK: AtomicBool = AtomicBool::new(false); - #[repr(transparent)] - pub struct __Wrapper { - inner: UnsafeCell<$ty> - } + pub struct __Wrapper(UnsafeCell<$ty>); + + $(#[$meta])* + pub static $name: __Wrapper = __Wrapper(UnsafeCell::new($init)); + + static __LOCK: AtomicBool = AtomicBool::new(false); pub struct __Guard($crate::guard::IrqGuard<$arch>); impl __Wrapper { @@ -200,13 +197,13 @@ pub macro split_spinlock( type Target = $ty; fn deref(&self) -> &Self::Target { - unsafe { &*$name.inner.get() } + unsafe { &*$name.0.get() } } } impl core::ops::DerefMut for __Guard { fn deref_mut(&mut self) -> &mut Self::Target { - unsafe { &mut *$name.inner.get() } + unsafe { &mut *$name.0.get() } } } diff --git a/kernel/src/arch/aarch64/exception.rs b/kernel/src/arch/aarch64/exception.rs index aa1660ef..b802e123 100644 --- a/kernel/src/arch/aarch64/exception.rs +++ b/kernel/src/arch/aarch64/exception.rs @@ -204,7 +204,11 @@ fn el0_sync_inner(frame: &mut ExceptionFrame) { // BRK in AArch64 0b111100 => { let thread = Thread::current(); - warnln!("Thread {} {:?} hit a breakpoint", thread.id, thread.name); + warnln!( + "Thread {} {:?} hit a breakpoint", + thread.id, + *thread.name.read() + ); thread.raise_signal(Signal::Aborted); true } @@ -216,7 +220,7 @@ fn el0_sync_inner(frame: &mut ExceptionFrame) { warnln!( "Data abort in {} {:?} at {:#x} with address {:#x}", thread.id, - thread.name, + *thread.name.read(), ELR_EL1.get(), FAR_EL1.get() ); diff --git a/kernel/src/arch/i686/exception.rs b/kernel/src/arch/i686/exception.rs index 00b799c4..9337cd3e 100644 --- a/kernel/src/arch/i686/exception.rs +++ b/kernel/src/arch/i686/exception.rs @@ -152,7 +152,7 @@ static IDT: IrqSafeRwLock<[Entry; SIZE]> = IrqSafeRwLock::new([Entry::NULL; SIZE fn dump_user_exception(kind: ExceptionKind, frame: &ExceptionFrame) { let thread = Thread::current(); - warnln!("{:?} in {} ({:?})", kind, thread.id, thread.name); + warnln!("{:?} in {} ({:?})", kind, thread.id, *thread.name.read()); warnln!("ip = {:02x}:{:08x}", frame.cs, frame.eip); warnln!("sp = {:02x}:{:08x}", frame.ss, frame.esp); warnln!("cr3 = {:#010x}", CR3.get()); diff --git a/userspace/lib/ygglibc/src/headers/sys_stat/mod.rs b/userspace/lib/ygglibc/src/headers/sys_stat/mod.rs index 0f4fd63e..fcdb065a 100644 --- a/userspace/lib/ygglibc/src/headers/sys_stat/mod.rs +++ b/userspace/lib/ygglibc/src/headers/sys_stat/mod.rs @@ -75,7 +75,7 @@ impl From for stat { let st_gid = u32::from(value.gid).try_into().unwrap(); // TODO let st_blksize = 512; - let st_blocks = st_size.div_ceil(st_blksize as _); + let st_blocks = st_size.div_ceil(st_blksize as _).try_into().unwrap(); Self { st_mode, @@ -86,18 +86,6 @@ impl From for stat { st_blocks, ..Default::default() } - // let mut st = Self::default(); - // st.st_size = value.size.try_into().unwrap(); - // // TODO - // st.st_uid = u32::from(value.uid).try_into().unwrap(); - // st.st_gid = u32::from(value.gid).try_into().unwrap(); - // // TODO - // st.st_blksize = 512; - // st.st_blocks = ((st.st_size + 511) / 512).try_into().unwrap(); - // // TODO - // st.st_nlink = 1; - - // st } }