1
0
Fork 0
forked from koniifer/ableos

Reimplemented BMC

This commit is contained in:
Erin 2023-08-08 02:06:15 +02:00
parent cdee99598e
commit 5264576274
2 changed files with 8 additions and 24 deletions

View file

@ -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,
})?; })?;

View file

@ -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
/// ///