kernel-mode #1

Manually merged
anton merged 69 commits from kernel-mode into master 2021-11-16 08:02:40 +01:00
2 changed files with 13 additions and 0 deletions
Showing only changes of commit 48ce44993b - Show all commits

View File

@ -26,3 +26,4 @@ FMT_PARSE = FMT_CYAN + FMT_BOLD
FMT_CPU = FMT_BLUE + FMT_BOLD
FMT_SYSCALL = FMT_YELLOW + FMT_BOLD
FMT_DEBUG = FMT_MAGENTA + FMT_BOLD
FMT_CSR = FMT_ORANGE + FMT_BOLD

View File

@ -3,6 +3,8 @@ from collections import defaultdict
from .privmodes import PrivModes
from .Exceptions import InstructionAccessFault
from ..helpers import to_unsigned
from ..colors import FMT_CSR, FMT_NONE
from .CSRConsts import CSR_NAME_TO_ADDR, MSTATUS_LEN_2, MSTATUS_OFFSETS
class CSR:
@ -109,3 +111,13 @@ class CSR:
return func
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)