kernel-mode #1
@ -26,3 +26,4 @@ FMT_PARSE = FMT_CYAN + FMT_BOLD
|
|||||||
FMT_CPU = FMT_BLUE + FMT_BOLD
|
FMT_CPU = FMT_BLUE + FMT_BOLD
|
||||||
FMT_SYSCALL = FMT_YELLOW + FMT_BOLD
|
FMT_SYSCALL = FMT_YELLOW + FMT_BOLD
|
||||||
FMT_DEBUG = FMT_MAGENTA + FMT_BOLD
|
FMT_DEBUG = FMT_MAGENTA + FMT_BOLD
|
||||||
|
FMT_CSR = FMT_ORANGE + FMT_BOLD
|
@ -3,6 +3,8 @@ from collections import defaultdict
|
|||||||
from .privmodes import PrivModes
|
from .privmodes import PrivModes
|
||||||
from .Exceptions import InstructionAccessFault
|
from .Exceptions import InstructionAccessFault
|
||||||
from ..helpers import to_unsigned
|
from ..helpers import to_unsigned
|
||||||
|
from ..colors import FMT_CSR, FMT_NONE
|
||||||
|
|
||||||
from .CSRConsts import CSR_NAME_TO_ADDR, MSTATUS_LEN_2, MSTATUS_OFFSETS
|
from .CSRConsts import CSR_NAME_TO_ADDR, MSTATUS_LEN_2, MSTATUS_OFFSETS
|
||||||
|
|
||||||
class CSR:
|
class CSR:
|
||||||
@ -109,3 +111,13 @@ class CSR:
|
|||||||
return func
|
return func
|
||||||
|
|
||||||
return inner
|
return inner
|
||||||
|
|
||||||
|
def dump_mstatus(self):
|
||||||
|
print(FMT_CSR + "[CSR] dumping mstatus:")
|
||||||
|
i = 0
|
||||||
|
for name in MSTATUS_OFFSETS:
|
||||||
|
print(" {:<5} {}".format(name, self.get_mstatus(name)), end="")
|
||||||
|
if i % 6 == 5:
|
||||||
|
print()
|
||||||
|
i += 1
|
||||||
|
print(FMT_NONE)
|
||||||
|
Loading…
Reference in New Issue
Block a user