Skip to content

Commit bd9125a

Browse files
committed
corrects pmp behavior wrt space
1 parent 58384aa commit bd9125a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/iss/mem/pmp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ template <typename PLAT> struct pmp : public memory_elem {
117117

118118
private:
119119
iss::status read_mem(iss::access_type access, uint32_t space, uint64_t addr, unsigned length, uint8_t* data) {
120-
if(!pmp_check(access, addr, length) && space != arch::traits<PLAT>::MEM && !is_debug(access)) {
120+
if(likely(space == arch::traits<PLAT>::MEM) && !pmp_check(access, addr, length) && !is_debug(access)) {
121121
hart_if.fault_data = addr;
122122
if(is_debug(access))
123123
throw trap_access(0, addr);
@@ -128,7 +128,7 @@ template <typename PLAT> struct pmp : public memory_elem {
128128
}
129129

130130
iss::status write_mem(iss::access_type access, uint32_t space, uint64_t addr, unsigned length, uint8_t const* data) {
131-
if(!pmp_check(access, addr, length) && space != arch::traits<PLAT>::MEM && !is_debug(access)) {
131+
if(likely(space == arch::traits<PLAT>::MEM) && !pmp_check(access, addr, length) && !is_debug(access)) {
132132
hart_if.fault_data = addr;
133133
if(is_debug(access))
134134
throw trap_access(0, addr);

0 commit comments

Comments
 (0)