blob: 5da182b4be0c4a88dc6e6c8624fb09b54c797b74 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
import ctypes, time
from tinygrad import Device
from tinygrad.runtime.autogen.am import am
d=Device["AMD"]; adev=d.iface.dev_impl; psp=adev.psp
SZ=ctypes.sizeof(am.struct_psp_gfx_cmd_resp); P=psp.reg_pref
hb=lambda: adev.reg(f"{P}_81").read()
print("heartbeat BEFORE crash (5 samples @100ms):")
s=[]
for _ in range(5): s.append(hb()); time.sleep(0.1)
print(" ",[hex(x) for x in s], "deltas", [s[i]-s[i-1] for i in range(1,5)])
print("\ncrashing...")
adev.vram.view(psp.cmd_paddr,SZ)[:]=b"\x00"*SZ
c=am.struct_psp_gfx_cmd_resp(cmd_id=am.GFX_CMD_ID_LOAD_IP_FW)
c.cmd.cmd_load_ip_fw.fw_size=0x100
try: psp._ring_submit(c)
except Exception as e: print(" ",type(e).__name__)
time.sleep(1.0)
print("\nheartbeat AFTER crash (8 samples @100ms):")
s2=[]
for _ in range(8): s2.append(hb()); time.sleep(0.1)
print(" ",[hex(x) for x in s2])
print(" deltas", [s2[i]-s2[i-1] for i in range(1,8)])
still = any(s2[i]!=s2[i-1] for i in range(1,8))
print(f"\n heartbeat still advancing: {still}")
print(" => PSP core is", "RUNNING (ring deadlock, no CPU fault)" if still else "HALTED (consistent with fault handler spin)")
|