File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1668,14 +1668,15 @@ def setup(self):
16681668 # pylint: disable=attribute-defined-outside-init
16691669 self .gdb .load ()
16701670
1671- misa = self .hart .misa
16721671 self .supported = set ()
1673- if misa & ( 1 << 20 ):
1672+ if self . hart . extensionSupported ( "U" ):
16741673 self .supported .add (0 )
1675- if misa & ( 1 << 18 ):
1674+ if self . hart . extensionSupported ( "S" ):
16761675 self .supported .add (1 )
1677- if misa & (1 << 7 ):
1678- self .supported .add (2 )
1676+ if self .hart .extensionSupported ("H" ):
1677+ self .supported_vmodes = self .supported
1678+ for privilege in self .supported_vmodes :
1679+ self .supported .add (f"{ (1 << 2 ) + privilege } " )
16791680 self .supported .add (3 )
16801681
16811682 self .disable_pmp ()
@@ -1690,16 +1691,22 @@ def setup(self):
16901691
16911692class PrivRw (PrivTest ):
16921693 """Test reading/writing priv."""
1693- def test (self ):
1694+ def check_priv (self , v ):
16941695 self .write_nop_program (4 )
1695- for privilege in range (4 ):
1696+ for prv in range (4 ):
1697+ privilege = prv + v << 2
16961698 self .gdb .p (f"$priv={ privilege } " )
16971699 self .gdb .stepi ()
16981700 actual = self .gdb .p ("$priv" )
16991701 assertIn (actual , self .supported )
17001702 if privilege in self .supported :
17011703 assertEqual (actual , privilege )
17021704
1705+ def test (self ):
1706+ if self .hart .extensionSupported ("H" ):
1707+ self .check_priv (1 )
1708+ self .check_priv (0 )
1709+
17031710class PrivChange (PrivTest ):
17041711 """Test that the core's privilege level actually changes when the debugger
17051712 writes it."""
You can’t perform that action at this time.
0 commit comments