File tree Expand file tree Collapse file tree 2 files changed +181
-189
lines changed Expand file tree Collapse file tree 2 files changed +181
-189
lines changed Original file line number Diff line number Diff line change @@ -404,6 +404,20 @@ typedef void (*riscv_mem_write_s)(riscv_t *rv,
404404typedef void (* riscv_mem_write_b )(riscv_t * rv ,
405405 riscv_word_t addr ,
406406 riscv_byte_t data );
407+ #if RV32_HAS (SYSTEM )
408+ /*
409+ * VA2PA handler
410+ * The MMU walkers and fault checkers are defined in system.c
411+ * Thus, exporting this handler through function pointer
412+ * preserves the encapsulation of MMU translation.
413+ *
414+ * ifetch do not leverage this translation because basic block
415+ * might be retranslated and the corresponding PTE is NULL.
416+ */
417+ typedef riscv_word_t (* riscv_mem_translate_t )(riscv_t * rv ,
418+ riscv_word_t vaddr ,
419+ bool rw );
420+ #endif
407421
408422/* system instruction handlers */
409423typedef void (* riscv_on_ecall )(riscv_t * rv );
@@ -424,7 +438,9 @@ typedef struct {
424438 riscv_mem_write_s mem_write_s ;
425439 riscv_mem_write_b mem_write_b ;
426440
427- /* TODO: add peripheral I/O interfaces */
441+ #if RV32_HAS (SYSTEM )
442+ riscv_mem_translate_t mem_translate ;
443+ #endif
428444
429445 /* system */
430446 riscv_on_ecall on_ecall ;
You can’t perform that action at this time.
0 commit comments