#!/usr/bin/env python3 """Evaluate the original timer setter and assert selected GV100 time-read bindings.""" import 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 from unicorn.x86_const import * 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;STOP=0x60000000 sets={'OBJTMR':['_nv006016rm']};all_names=sum(sets.values(),[]) expected={'OBJTMR':{0x190:'_nv059661rm',0x1a0:'_nv059635rm',0x1b8:'_nv059597rm',0x1c0:'_nv059609rm',0x1c8:'_nv059606rm',0x1d0:'_nv059583rm',0x1e8:'_nv059571rm',0x1f8:'_nv059648rm',0x208:'_nv059576rm'}} with P.open('rb') as f: e=ELFFile(f);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');functions={n:(defined[n]['st_value'],defined[n]['st_size']) for n in all_names};relocations=0 for r in e.get_section_by_name('.rela.text').iter_relocations(): off=r['r_offset'] if not any(a<=off