hv.py: hook USB-C port specific pmgr addresses

Allows running HV over each USB-C port of a Mac Mini with Mac OS as
guest.

Signed-off-by: Janne Grunau <j@jannau.net>
This commit is contained in:
Janne Grunau 2021-06-12 11:17:02 +02:00 committed by Hector Martin
parent d88e255c56
commit bbd2cf8710

View file

@ -876,7 +876,12 @@ class HV(Reloadable):
print(f"R {base:x}+{off:x}:{width} = 0x{data:x} -> 0x{ret:x}")
return ret
for addr in (0x23b700420, 0x23d280098, 0x23d280088, 0x23d280090):
if self.iodev == IODEV.USB0:
pmgr_hooks = (0x23b700420, 0x23d280098, 0x23d280088)
elif self.iodev == IODEV.USB1:
pmgr_hooks = (0x23b700448, 0x23d2800a0, 0x23d280090)
for addr in pmgr_hooks:
self.map_hook(addr, 4, write=wh, read=rh)
# TODO: turn into a real tracer
self.add_tracer(irange(addr, 4), "PMU HACK", TraceMode.RESERVED)