diff options
author | Robert Norton <robert.norton@microsoft.com> | 2021-03-10 14:52:09 +0000 |
---|---|---|
committer | Robert Norton <robert.m.norton@gmail.com> | 2021-07-16 09:46:35 +0100 |
commit | b1db5b944b42062d063343db8e2efd05e5889b21 (patch) | |
tree | cbe0d7f6465c73b7971f63efb43951adea31d214 /model/riscv_addr_checks_common.sail | |
parent | f66d0fbaf2618543d9c1296541bb6f02d0fe6c2c (diff) | |
download | sail-riscv-b1db5b944b42062d063343db8e2efd05e5889b21.zip sail-riscv-b1db5b944b42062d063343db8e2efd05e5889b21.tar.gz sail-riscv-b1db5b944b42062d063343db8e2efd05e5889b21.tar.bz2 |
Add an extension point to allow validation of physical memory accesses.
This is required for implementing memory version support for CHERI.
Diffstat (limited to 'model/riscv_addr_checks_common.sail')
-rw-r--r-- | model/riscv_addr_checks_common.sail | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/model/riscv_addr_checks_common.sail b/model/riscv_addr_checks_common.sail index 945621d..2d1e526 100644 --- a/model/riscv_addr_checks_common.sail +++ b/model/riscv_addr_checks_common.sail @@ -20,3 +20,24 @@ union Ext_DataAddr_Check ('a : Type) = { Ext_DataAddr_OK : xlenbits, /* Address to use for the data access */ Ext_DataAddr_Error : 'a } + +union Ext_PhysAddr_Check = { + Ext_PhysAddr_OK : unit, + Ext_PhysAddr_Error : ExceptionType +} + +/*! + * Validate a read from physical memory. + * THIS(access_type, paddr, size, aquire, release, reserved, read_meta) should + * return Some(exception) to abort the read or None to allow it to proceed. The + * check is performed after PMP checks and does not apply to MMIO memory. + */ +val ext_check_phys_mem_read : forall 'n, 0 < 'n <= max_mem_access . (AccessType (ext_access_type), xlenbits, atom('n), bool, bool, bool, bool) -> Ext_PhysAddr_Check + +/*! + * Validate a write to physical memory. + * THIS(write_kind, paddr, size, data, metadata) should return Some(exception) + * to abort the write or None to allow it to proceed. The check is performed + * after PMP checks and does not apply to MMIO memory. + */ +val ext_check_phys_mem_write : forall 'n, 0 < 'n <= max_mem_access . (write_kind, xlenbits, atom('n), bits(8 * 'n), mem_meta) -> Ext_PhysAddr_Check |