import sys, os, importlib.util sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) from unicorn import UC_HOOK_CODE, UC_HOOK_MEM_WRITE from unicorn.arm_const import UC_ARM_REG_SP, UC_ARM_REG_PC _s=importlib.util.spec_from_file_location("tasmod",os.path.join(os.path.dirname(__file__),"boot_sos_and_tas.py")) T=importlib.util.module_from_spec(_s); _s.loader.exec_module(T) A=0x110000c c,ccp,exc=T.build() print("after build: A=%#010x"%int.from_bytes(c.uc.mem_read(A,4),'little')) T.stage_all(c,verbose=False) print("after stage: A=%#010x"%int.from_bytes(c.uc.mem_read(A,4),'little')) # capture ALL host writes by wrapping uc.mem_write AND guest writes via hook import types realmw=c.uc.mem_write; hostw=[] def mw(addr,data,*a,**k): if addr<=A=4, verbose=False) print("after run: A=%#010x (loads=%d)"%(int.from_bytes(c.uc.mem_read(A,4),'little'),len(loads))) print("GUEST writes to A:", gw[-5:] if gw else "NONE") print("HOST uc.mem_write covering A:", [(hex(a),n,d.hex()) for a,n,d in hostw[-5:]] if hostw else "NONE")