Skip to content

Commit

Permalink
PMP: Remove the check if at least one entry is active.
Browse files Browse the repository at this point in the history
I think I mis-interpreted this, what's actually meant in the spec
is that the check should always fail if we are in S or U mode
and at least one PMP entry is implemented.

Previously this check failed if we are in S or U mode
and one entry was configured.
  • Loading branch information
franzflasch committed Jan 4, 2024
1 parent 369a666 commit 7bb0e24
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/core/pmp/pmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ rv_ret pmp_mem_check(pmp_td *pmp, privilege_level curr_priv, rv_uint_xlen addr,
rv_uint_xlen addr_end = 0;
rv_uint_xlen pmp_addr_start = 0;
rv_uint_xlen pmp_addr_size = 0;
int at_least_one_active = 0;
uint8_t curr_access_flags = (1 << access_type);
uint8_t allowed_access = 0;
uint8_t lower_addr_match = 0;
Expand Down Expand Up @@ -143,8 +142,6 @@ rv_ret pmp_mem_check(pmp_td *pmp, privilege_level curr_priv, rv_uint_xlen addr,

allowed_access = cfg_ptr[j] & 0x7;

at_least_one_active = 1;

switch(addr_mode)
{
case pmp_a_tor:
Expand Down Expand Up @@ -211,15 +208,8 @@ rv_ret pmp_mem_check(pmp_td *pmp, privilege_level curr_priv, rv_uint_xlen addr,
if(curr_priv == machine_mode)
return rv_ok;

/* If at least one config is active and we are not in machine mode access is not granted */
if(at_least_one_active)
{
PMP_DEBUG("No PMP match found!\n");
return rv_err;
}

/* No config seems to be active and therefore PMP is not used so access is granted */
return rv_ok;
return rv_err;
}

void pmp_dump_cfg_regs(pmp_td *pmp)
Expand Down

0 comments on commit 7bb0e24

Please sign in to comment.