arch: fix i686/aarch64 build

This commit is contained in:
Mark Poliakov 2024-11-22 17:18:44 +02:00
parent 3c87b7187e
commit 0742edc516
4 changed files with 16 additions and 27 deletions

View File

@ -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() }
}
}

View File

@ -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()
);

View File

@ -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());

View File

@ -75,7 +75,7 @@ impl From<FileAttr> 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<FileAttr> 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
}
}