Skip to content

Commit 3d28ac4

Browse files
committed
tools/chainload.py: Properly sleep DCP when chainloading macOS
Signed-off-by: Asahi Lina <lina@asahilina.net>
1 parent 7a92257 commit 3d28ac4

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

proxyclient/m1n1/proxy.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,8 @@ class M1N1Proxy(Reloadable):
620620
P_DISPLAY_INIT = 0x1100
621621
P_DISPLAY_CONFIGURE = 0x1101
622622
P_DISPLAY_SHUTDOWN = 0x1102
623+
P_DISPLAY_START_DCP = 0x1103
624+
P_DISPLAY_IS_EXTERNAL = 0x1104
623625

624626
P_DAPF_INIT_ALL = 0x1200
625627
P_DAPF_INIT = 0x1201
@@ -1074,6 +1076,10 @@ def display_configure(self, cfg):
10741076
return self.request(self.P_DISPLAY_CONFIGURE, cfg)
10751077
def display_shutdown(self, mode):
10761078
return self.request(self.P_DISPLAY_SHUTDOWN, mode)
1079+
def display_start_dcp(self):
1080+
return self.request(self.P_DISPLAY_START_DCP)
1081+
def display_is_external(self):
1082+
return self.request(self.P_DISPLAY_IS_EXTERNAL)
10771083

10781084
def dapf_init_all(self):
10791085
return self.request(self.P_DAPF_INIT_ALL)

proxyclient/tools/chainload.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,9 @@
117117

118118
print(f"Entry point: 0x{entry:x}")
119119

120-
if args.xnu:
121-
p.display_shutdown(0)
120+
if args.xnu and p.display_is_external():
121+
if p.display_start_dcp() >= 0:
122+
p.display_shutdown(0)
122123

123124
if args.call:
124125
print(f"Shutting down MMU...")

src/proxy.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,12 @@ int proxy_process(ProxyRequest *request, ProxyReply *reply)
550550
case P_DISPLAY_SHUTDOWN:
551551
display_shutdown(request->args[0]);
552552
break;
553+
case P_DISPLAY_START_DCP:
554+
display_start_dcp();
555+
break;
556+
case P_DISPLAY_IS_EXTERNAL:
557+
reply->retval = display_is_external;
558+
break;
553559

554560
case P_DAPF_INIT_ALL:
555561
reply->retval = dapf_init_all();

src/proxy.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ typedef enum {
156156
P_DISPLAY_INIT = 0x1100,
157157
P_DISPLAY_CONFIGURE,
158158
P_DISPLAY_SHUTDOWN,
159+
P_DISPLAY_START_DCP,
160+
P_DISPLAY_IS_EXTERNAL,
159161

160162
P_DAPF_INIT_ALL = 0x1200,
161163
P_DAPF_INIT,

0 commit comments

Comments
 (0)