Skip to content

Commit

Permalink
proxy.hv: Determine boot CPU by cpu[N].state ADT property
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Berlin <[email protected]>
Co-Developed-by: Daniel Berlin <[email protected]>
Signed-off-by: Janne Grunau <[email protected]>
  • Loading branch information
jannau authored and marcan committed Nov 3, 2024
1 parent ed69d99 commit 5801c20
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions proxyclient/m1n1/hv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def __init__(self, iface, proxy, utils):
self.sym_offset = 0
self.symbols = []
self.symbol_dict = {}
self.sysreg = {0: {}}
self.sysreg = {}
self.novm = False
self._in_handler = False
self._sigint_pending = False
Expand Down Expand Up @@ -1633,7 +1633,7 @@ def setup_adt(self):

if not self.smp:
for cpu in list(self.adt["cpus"]):
if cpu.name != "cpu0":
if cpu.state != "running":
print(f"Removing ADT node {cpu._path}")
try:
del self.adt["cpus"][cpu.name]
Expand Down Expand Up @@ -1759,7 +1759,9 @@ def load_raw(self, image, entryoffset=0x800, use_xnu_symbols=False, vmin=0):

print("Setting secondary CPU RVBARs...")
rvbar = self.entry & ~0xfff
for cpu in self.adt["cpus"][1:]:
for cpu in self.adt["cpus"]:
if cpu.state == "running":
continue
addr, size = cpu.cpu_impl_reg
print(f" {cpu.name}: [0x{addr:x}] = 0x{rvbar:x}")
self.p.write64(addr, rvbar)
Expand Down Expand Up @@ -1910,7 +1912,11 @@ def start(self):
# Does not return

self.started = True
self.started_cpus[0] = (0, 0, 0)
for cpu_node in list(self.adt["cpus"]):
if cpu_node.state == "running":
break
self.started_cpus[cpu_node.cpu_id] = (getattr(cpu_node, "die_id", 0), cpu_node.cluster_id, cpu_node.cpu_id)
self.sysreg[cpu_node.cpu_id] = {}
self.p.hv_start(self.entry, self.guest_base + self.bootargs_off)

from .. import trace

0 comments on commit 5801c20

Please sign in to comment.