Skip to content
This repository has been archived by the owner on Apr 13, 2019. It is now read-only.

Commit

Permalink
target/riscv/pmp: Fix address matching, granularity and debug
Browse files Browse the repository at this point in the history
- Add tracing to CSR reads and writes to pmpcfg and pmpaddr.
- Rename pmp_hart_has_priv to pmp_has_access.
- Simplify address matching rules and fix bug where positive
  matches could be missed.
- Mask addresses so that granularity can be detected and enforced.
- Add note regarding issue with entries whose length is less than
  or equal to the 2 ^ TARGET_PAGE_BITS granularity.
- Convert PMP debugging to trace-events and remove redundant
  debugging statements.
  • Loading branch information
Michael Clark committed Sep 23, 2018
1 parent 7da9309 commit 0be2489
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 218 deletions.
2 changes: 1 addition & 1 deletion target/riscv/cpu_helper.c
Expand Up @@ -465,7 +465,7 @@ int riscv_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size,
"%s address=%" VADDR_PRIx " ret %d physical " TARGET_FMT_plx
" prot %d\n", __func__, address, ret, pa, prot);
if (riscv_feature(env, RISCV_FEATURE_PMP) &&
!pmp_hart_has_privs(env, pa, TARGET_PAGE_SIZE, 1 << rw)) {
!pmp_has_access(env, pa & TARGET_PAGE_MASK, rw)) {
ret = TRANSLATE_FAIL;
}
if (ret == TRANSLATE_SUCCESS) {
Expand Down

0 comments on commit 0be2489

Please sign in to comment.