Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions arch/rv32i/src/pmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,7 @@ impl<const MAX_REGIONS: usize, P: TORUserPMP<MAX_REGIONS> + 'static> kernel::pla
// type MpuConfig = PMPUserMPUConfig<MAX_REGIONS>;
type Region = PMPUserRegion<MAX_REGIONS>;

#[flux_rs::trusted]
fn enable_app_mpu(&self) -> MpuEnabledCapability {
// TODO: This operation may fail when the PMP is not exclusively used
// for userspace. Instead of panicing, we should handle this case more
Expand Down Expand Up @@ -1360,6 +1361,8 @@ pub mod test {
Ok(())
}

// #[flux_rs::sig(fn (x: usize) -> u32[x] requires x <= u32::MAX)]
#[flux_rs::sig(fn (&Self) -> Result<(), ()>[true])]
fn enable_user_pmp(&self) -> Result<(), ()> {
Ok(())
} // The kernel's MPU trait requires
Expand Down
10 changes: 10 additions & 0 deletions flux_support/src/extern_specs/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,14 @@ impl<T, E> Result<T, E> {

#[sig(fn(&Result<T,E>[@b]) -> bool[!b])]
const fn is_err(&self) -> bool;

#[sig(fn(Result<T, E>[true]) -> T)]
fn unwrap(self) -> T
where
E: core::fmt::Debug;

#[sig(fn(Result<T, E>[false]) -> E)]
fn unwrap_err(self) -> E
where
T: core::fmt::Debug;
}
1 change: 1 addition & 0 deletions kernel/src/syscall_driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ impl CommandReturn {
}

impl From<Result<(), ErrorCode>> for CommandReturn {
#[flux_rs::trusted]
fn from(rc: Result<(), ErrorCode>) -> Self {
match rc {
Ok(()) => CommandReturn::success(),
Expand Down
Loading