"""Who touches SMN 0x215C0 / 0x2161C, and does anything READ them after boot? Previous owner() lookups in this project were buggy (they returned the last function whose start <= va, ignoring the end, or required the literal to be strictly inside the function). Literal pools usually sit just past a function's code, so this version reports the nearest PRECEDING function start plus the distance, and flags whether the literal is inside the function's [start,end) range. """ import struct, json, sys BASE = '/Users/user/dev/amd-psp-re/psp_out/handover/' MODS = ('sos', 'sys_drv', 'asd', 'hdcp', 'dtm', 'ras') TARGETS = [0x215C0, 0x2161C] WINDOW = (0x21500, 0x21B78) def load(mod): raw = open(BASE + 'elf/%s2.elf' % mod, 'rb').read() ph = struct.unpack(' %s (+%#x, inside=%s)" % (mod, w, v+i, nm, off or 0, inside)) print("\n=== ANY literal inside the Route C window, all modules ===") for mod in MODS: body, v, funcs = load(mod) hits = [] for i in range(0, len(body)-4, 4): w = struct.unpack(' %s (inside=%s)" % (w, at, nm, inside))