mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-10 09:44:13 +00:00
m1n1.trace: Support HOOK mode
Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
parent
f49428bb65
commit
0255831153
1 changed files with 12 additions and 2 deletions
|
@ -74,6 +74,12 @@ class Tracer(Reloadable):
|
||||||
def init_state(self):
|
def init_state(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def hook_w(self, addr, val, width, **kwargs):
|
||||||
|
self.hv.u.write(addr, val, width)
|
||||||
|
|
||||||
|
def hook_r(self, addr, width, **kwargs):
|
||||||
|
return self.hv.u.read(addr, width)
|
||||||
|
|
||||||
def evt_rw(self, evt, regmap=None, prefix=None):
|
def evt_rw(self, evt, regmap=None, prefix=None):
|
||||||
self._cache.update(evt.addr, evt.data)
|
self._cache.update(evt.addr, evt.data)
|
||||||
reg = rcls = None
|
reg = rcls = None
|
||||||
|
@ -112,8 +118,12 @@ class Tracer(Reloadable):
|
||||||
|
|
||||||
def trace(self, start, size, mode, read=True, write=True, **kwargs):
|
def trace(self, start, size, mode, read=True, write=True, **kwargs):
|
||||||
zone = irange(start, size)
|
zone = irange(start, size)
|
||||||
self.hv.add_tracer(zone, self.ident, mode, self.evt_rw if read else None,
|
if mode == TraceMode.HOOK:
|
||||||
self.evt_rw if write else None, **kwargs)
|
self.hv.add_tracer(zone, self.ident, mode, self.hook_r if read else None,
|
||||||
|
self.hook_w if write else None, **kwargs)
|
||||||
|
else:
|
||||||
|
self.hv.add_tracer(zone, self.ident, mode, self.evt_rw if read else None,
|
||||||
|
self.evt_rw if write else None, **kwargs)
|
||||||
|
|
||||||
def trace_regmap(self, start, size, cls, mode=None, name=None, prefix=None):
|
def trace_regmap(self, start, size, cls, mode=None, name=None, prefix=None):
|
||||||
if mode is None:
|
if mode is None:
|
||||||
|
|
Loading…
Reference in a new issue