Make it possible to control logging level by writing to /dev/kmem yeehah

This commit is contained in:
Neil Webber 2023-09-05 22:57:19 -05:00
parent 3cacb8eb86
commit b9b60faea5

View file

@ -101,6 +101,11 @@ class PDP11:
# the console switches (read) and LEDs (write) # the console switches (read) and LEDs (write)
SWLEDS_OFFS = 0o17570 SWLEDS_OFFS = 0o17570
# this is a superb hack for controlling the logging level for debug
# this is in the unibus address range reserved for "testers" -- not
# sure what that really is but this is as good a place for it as any
LOGGING_OFFS = 0o17000
# the CPU error register and some useful bit values # the CPU error register and some useful bit values
CPUERROR_OFFS = 0o17766 CPUERROR_OFFS = 0o17766
@ -212,7 +217,8 @@ class PDP11:
for attrname, offs in (('psw', self.PS_OFFS), for attrname, offs in (('psw', self.PS_OFFS),
('stack_limit_register', self.STACKLIM_OFFS), ('stack_limit_register', self.STACKLIM_OFFS),
('swleds', self.SWLEDS_OFFS), ('swleds', self.SWLEDS_OFFS),
('error_register', self.CPUERROR_OFFS)): ('error_register', self.CPUERROR_OFFS),
('logging_hack', self.LOGGING_OFFS)):
self.ub.mmio.register_simpleattr(self, attrname, offs) self.ub.mmio.register_simpleattr(self, attrname, offs)
# console switches (read) and blinken lights (write) # console switches (read) and blinken lights (write)
@ -410,7 +416,7 @@ class PDP11:
if addrmode == 0o50: if addrmode == 0o50:
addr = self.mmu.wordRW(addr, space=self.mmu.DSPACE) addr = self.mmu.wordRW(addr, space=self.mmu.DSPACE)
if Rn == self.SP: if Rn == self.SP:
self.strapcheck = True self.strapcheck = True # XXX THIS IS A NO-OP LOOK
# X(Rn) and @X(Rn) # X(Rn) and @X(Rn)
case 0, (0o60 | 0o70) as addrmode, Rn: case 0, (0o60 | 0o70) as addrmode, Rn:
@ -929,6 +935,14 @@ class PDP1170(PDP11):
# the PC was already sync'd in syncregs() # the PC was already sync'd in syncregs()
@property
def logging_hack(self):
return self.logger.level
@logging_hack.setter
def logging_hack(self, value):
self.logger.setLevel(value)
# this is convenient to have for debugging and logging # this is convenient to have for debugging and logging
def spsw(self, v=None): def spsw(self, v=None):
"""Return string rep of a psw value.""" """Return string rep of a psw value."""