#!/home/geodd/.local/opt/rea-python/bin/python """Original PTIMER delay control flow in Unicorn; GPU lookup/time/diagnostics mocked.""" import argparse,hashlib,json,struct,warnings from pathlib import Path warnings.filterwarnings('ignore',category=UserWarning,module='unicorn') from elftools.elf.elffile import ELFFile from unicorn import Uc,UC_ARCH_X86,UC_MODE_64,UC_HOOK_CODE,UC_HOOK_MEM_READ from unicorn.x86_const import * parser=argparse.ArgumentParser();parser.add_argument('--check',action='store_true');options=parser.parse_args() R=Path(__file__).resolve().parents[1];P=Path('/home/geodd/nvidia-driver/analysis-580.178.04/extracted/kernel/nvidia/nv-kernel.o_binary') TEXT=0x10000000;DATA=0x30000000;STACK=0x40000000;STUB=0x50000000;STOP=0x60000000 name='_nv059553rm';hooks={} with P.open('rb') as stream: e=ELFFile(stream);symbols=list(e.get_section_by_name('.symtab').iter_symbols());defined={s.name:s for s in symbols};text=bytearray(e.get_section_by_name('.text').data());text_index=e.get_section_index('.text');start=defined[name]['st_value'];size=defined[name]['st_size'];undefined={} for rel in e.get_section_by_name('.rela.text').iter_relocations(): off=rel['r_offset'] if not start<=off