summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mem.rs41
1 files changed, 31 insertions, 10 deletions
diff --git a/src/mem.rs b/src/mem.rs
index 21cabec..5576905 100644
--- a/src/mem.rs
+++ b/src/mem.rs
@@ -349,17 +349,38 @@ pub struct DeviceEntry {
pub interface: Arc<dyn MemDeviceInterface>,
}
+#[allow(unused_variables)]
pub trait MemDeviceInterface {
- fn write_dword(&self, page: PageNum, offset: u16, value: DWord) -> Result<(), ExceptionType>;
- fn write_word(&self, page: PageNum, offset: u16, value: Word) -> Result<(), ExceptionType>;
- fn write_hword(&self, page: PageNum, offset: u16, value: HWord) -> Result<(), ExceptionType>;
- fn write_byte(&self, page: PageNum, offset: u16, value: Byte) -> Result<(), ExceptionType>;
+ fn write_dword(&self, page: PageNum, offset: u16, value: DWord) -> Result<(), ExceptionType> {
+ Err(ExceptionType::StoreAmoAccessFault)
+ }
+ fn write_word(&self, page: PageNum, offset: u16, value: Word) -> Result<(), ExceptionType> {
+ Err(ExceptionType::StoreAmoAccessFault)
+ }
+ fn write_hword(&self, page: PageNum, offset: u16, value: HWord) -> Result<(), ExceptionType> {
+ Err(ExceptionType::StoreAmoAccessFault)
+ }
+ fn write_byte(&self, page: PageNum, offset: u16, value: Byte) -> Result<(), ExceptionType> {
+ Err(ExceptionType::StoreAmoAccessFault)
+ }
- fn read_dword(&self, page: PageNum, offset: u16) -> Result<DWord, ExceptionType>;
- fn read_word(&self, page: PageNum, offset: u16) -> Result<Word, ExceptionType>;
- fn read_hword(&self, page: PageNum, offset: u16) -> Result<HWord, ExceptionType>;
- fn read_byte(&self, page: PageNum, offset: u16) -> Result<Byte, ExceptionType>;
+ fn read_dword(&self, page: PageNum, offset: u16) -> Result<DWord, ExceptionType> {
+ Err(ExceptionType::LoadAccessFault)
+ }
+ fn read_word(&self, page: PageNum, offset: u16) -> Result<Word, ExceptionType> {
+ Err(ExceptionType::LoadAccessFault)
+ }
+ fn read_hword(&self, page: PageNum, offset: u16) -> Result<HWord, ExceptionType> {
+ Err(ExceptionType::LoadAccessFault)
+ }
+ fn read_byte(&self, page: PageNum, offset: u16) -> Result<Byte, ExceptionType> {
+ Err(ExceptionType::LoadAccessFault)
+ }
- fn get_atomic_word(&self, page: PageNum, offset: u16) -> Result<&AtomicU32, ExceptionType>;
- fn get_atomic_dword(&self, page: PageNum, offset: u16) -> Result<&AtomicU64, ExceptionType>;
+ fn get_atomic_word(&self, page: PageNum, offset: u16) -> Result<&AtomicU32, ExceptionType> {
+ Err(ExceptionType::StoreAmoAccessFault)
+ }
+ fn get_atomic_dword(&self, page: PageNum, offset: u16) -> Result<&AtomicU64, ExceptionType> {
+ Err(ExceptionType::StoreAmoAccessFault)
+ }
}