Reimplemented BMC
This commit is contained in:
parent
cdee99598e
commit
5264576274
|
@ -1,7 +1,7 @@
|
||||||
use {
|
use {
|
||||||
super::MemoryAccessReason,
|
super::MemoryAccessReason,
|
||||||
crate::{
|
crate::{
|
||||||
mem::{perm_check, HandlePageFault, Memory},
|
mem::{HandlePageFault, Memory},
|
||||||
VmRunError,
|
VmRunError,
|
||||||
},
|
},
|
||||||
core::{mem::MaybeUninit, task::Poll},
|
core::{mem::MaybeUninit, task::Poll},
|
||||||
|
@ -113,32 +113,16 @@ unsafe fn act(
|
||||||
) -> Result<(), BlkCopyError> {
|
) -> Result<(), BlkCopyError> {
|
||||||
// Load to buffer
|
// Load to buffer
|
||||||
memory
|
memory
|
||||||
.memory_access(
|
.load(src, buf, count, traph)
|
||||||
MemoryAccessReason::Load,
|
.map_err(|super::LoadError(addr)| BlkCopyError::Access {
|
||||||
src,
|
|
||||||
buf,
|
|
||||||
count,
|
|
||||||
perm_check::readable,
|
|
||||||
|src, dst, count| core::ptr::copy(src, dst, count),
|
|
||||||
traph,
|
|
||||||
)
|
|
||||||
.map_err(|addr| BlkCopyError::Access {
|
|
||||||
access_reason: MemoryAccessReason::Load,
|
access_reason: MemoryAccessReason::Load,
|
||||||
addr,
|
addr,
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
// Store from buffer
|
// Store from buffer
|
||||||
memory
|
memory
|
||||||
.memory_access(
|
.store(dst, buf, count, traph)
|
||||||
MemoryAccessReason::Store,
|
.map_err(|super::StoreError(addr)| BlkCopyError::Access {
|
||||||
dst,
|
|
||||||
buf,
|
|
||||||
count,
|
|
||||||
perm_check::writable,
|
|
||||||
|dst, src, count| core::ptr::copy(src, dst, count),
|
|
||||||
traph,
|
|
||||||
)
|
|
||||||
.map_err(|addr| BlkCopyError::Access {
|
|
||||||
access_reason: MemoryAccessReason::Store,
|
access_reason: MemoryAccessReason::Store,
|
||||||
addr,
|
addr,
|
||||||
})?;
|
})?;
|
||||||
|
|
|
@ -426,12 +426,12 @@ impl PageSize {
|
||||||
/// Unhandled load access trap
|
/// Unhandled load access trap
|
||||||
#[derive(Clone, Copy, Display, Debug, PartialEq, Eq)]
|
#[derive(Clone, Copy, Display, Debug, PartialEq, Eq)]
|
||||||
#[display(fmt = "Load access error at address {_0:#x}")]
|
#[display(fmt = "Load access error at address {_0:#x}")]
|
||||||
pub struct LoadError(u64);
|
pub struct LoadError(pub u64);
|
||||||
|
|
||||||
/// Unhandled store access trap
|
/// Unhandled store access trap
|
||||||
#[derive(Clone, Copy, Display, Debug, PartialEq, Eq)]
|
#[derive(Clone, Copy, Display, Debug, PartialEq, Eq)]
|
||||||
#[display(fmt = "Store access error at address {_0:#x}")]
|
#[display(fmt = "Store access error at address {_0:#x}")]
|
||||||
pub struct StoreError(u64);
|
pub struct StoreError(pub u64);
|
||||||
|
|
||||||
/// There was no entry in page table to unmap
|
/// There was no entry in page table to unmap
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in a new issue