@@ -278,6 +278,9 @@ def test(self):
278278class MemTestReadInvalid (SimpleMemoryTest ):
279279 def test (self ):
280280 bad_address = self .hart .bad_address
281+ if self .target .support_set_pmp_deny :
282+ self .set_pmp_deny (bad_address )
283+ self .gdb .command ("monitor riscv set_mem_access progbuf abstract" )
281284 good_address = self .hart .ram + 0x80
282285
283286 self .write_nop_program (2 )
@@ -293,6 +296,10 @@ def test(self):
293296 self .gdb .stepi () # Don't let gdb cache register read
294297 assertEqual (self .gdb .p (f"*((int*)0x{ good_address :x} )" ), 0xabcdef )
295298 assertEqual (self .gdb .p ("$s0" ), 0x12345678 )
299+ if self .target .support_set_pmp_deny :
300+ self .reset_pmp_deny ()
301+ self .gdb .command ("monitor riscv set_mem_access progbuf sysbus "
302+ "abstract" )
296303
297304#class MemTestWriteInvalid(SimpleMemoryTest):
298305# def test(self):
@@ -2182,6 +2189,9 @@ def test(self):
21822189 # Set fox to a bad pointer so we'll get a load access exception later.
21832190 # Use NULL if a known-bad address is not provided.
21842191 bad_address = self .hart .bad_address or 0
2192+ if self .target .support_set_pmp_deny :
2193+ self .set_pmp_deny (bad_address )
2194+ self .gdb .command ("monitor riscv set_mem_access progbuf abstract" )
21852195 self .gdb .p (f"fox=(char*)0x{ bad_address :08x} " )
21862196 output = self .gdb .c ()
21872197 # We should not be at handle_trap
@@ -2190,6 +2200,10 @@ def test(self):
21902200 # actual exception handler.
21912201 assertIn ("breakpoint" , output )
21922202 assertIn ("trap_entry" , self .gdb .where ())
2203+ if self .target .support_set_pmp_deny :
2204+ self .reset_pmp_deny ()
2205+ self .gdb .command ("monitor riscv set_mem_access progbuf sysbus "
2206+ "abstract" )
21932207
21942208class IcountTest (DebugTest ):
21952209 compile_args = ("programs/infinite_loop.S" , )
0 commit comments