(BIG CHANGE) memory handling has changed, MMIO is now a 2 level page table, misaligned access supported, addresses not internally split to page and offset immediately, all load/store instructions implemented. Might still have bugs
This commit is contained in:
@@ -10,7 +10,7 @@ use int_enum::IntEnum;
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, IntEnum)]
|
||||
pub enum ExceptionType {
|
||||
InstructionAccessMisaligned = 0,
|
||||
InstructionAddressMisaligned = 0,
|
||||
InstructionAccessFault = 1,
|
||||
IllegalInstruction = 2,
|
||||
Breakpoint = 3,
|
||||
@@ -28,3 +28,35 @@ pub enum ExceptionType {
|
||||
SoftwareCheck = 18,
|
||||
HardwareError = 19,
|
||||
}
|
||||
|
||||
pub enum MemoryExceptionType {
|
||||
AddressMisaligned,
|
||||
AccessFault,
|
||||
PageFault,
|
||||
}
|
||||
|
||||
impl MemoryExceptionType {
|
||||
pub(crate) fn to_exception_store(&self) -> ExceptionType {
|
||||
match self {
|
||||
Self::AddressMisaligned => ExceptionType::StoreAmoAddressMisaligned,
|
||||
Self::AccessFault => ExceptionType::StoreAmoAccessFault,
|
||||
Self::PageFault => ExceptionType::StoreAmoPageFault,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn to_exception_instr(&self) -> ExceptionType {
|
||||
match self {
|
||||
Self::AddressMisaligned => ExceptionType::InstructionAddressMisaligned,
|
||||
Self::AccessFault => ExceptionType::InstructionAccessFault,
|
||||
Self::PageFault => ExceptionType::InstructionPageFault,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn to_exception_load(&self) -> ExceptionType {
|
||||
match self {
|
||||
Self::AddressMisaligned => ExceptionType::LoadAddressMisaligned,
|
||||
Self::AccessFault => ExceptionType::LoadAccessFault,
|
||||
Self::PageFault => ExceptionType::LoadPageFault,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user