"""GET_FW_ATTESTATION (0x0F cmd_id) output inspection + resp descriptor handling. Host-reachable, returns real data, never examined. Two questions: 1) does the response contain anything beyond the documented measurement (PSP-range pointers / uninitialised bytes)? 2) is the host-supplied resp_offset / resp_buf_size descriptor bounds-checked, or will the PSP write wherever we point it? """ import ctypes,struct from tinygrad import Device from tinygrad.runtime.autogen.am import am from tinygrad.helpers import lo32,hi32 d=Device["AMD"]; adev=d.iface.dev_impl; psp=adev.psp SZ=ctypes.sizeof(am.struct_psp_gfx_cmd_resp) RANGES=[(0x00020000,0x00070000,'sOS'),(0x00400000,0x00412000,'HDCP'), (0x00D00000,0x00D50000,'ASD'),(0x00E10000,0x00E80000,'SYSDRV'),(0x0020A000,0x0020C000,'TAstage')] def classify(v): for lo,hi,nm in RANGES: if lo<=v status=%-6s wrote %d bytes%s"%( off,size,hex(st) if isinstance(st,int) else st,len(wrote), (" at %#x..%#x"%(wrote[0],wrote[-1])) if wrote else "")) print("sos_alive:",psp.is_sos_alive())