(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:
2025-12-26 14:20:27 +01:00
parent 6d9efb7eb8
commit 528b519ce9
9 changed files with 478 additions and 456 deletions

View File

@@ -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,
}
}
}