Files
nvdriver/tools/check_system_memory_abi.py
nvidia-driver-rs 4526e6a816 Baseline: validated 30/30 tree with passing Level 7 hardware regression
- Updated tools/post_reboot.sh to check kernel oops taint bit and stuck driver tasks instead of <86400s uptime
- Level 7 hardware regression passed on 0000:b3:00.0 (module 37e6fa430835eee2b426019db3ad70eeb7a9e9070c09c84bd9b973cf56cbe529, 107 inventory words, 0 static mismatches, CUDA baseline verified before and after)
- Updated .gitignore to exclude build archives (*.a, *.rlib), __pycache__, and raw trace dumps
2026-11-23 23:48:38 +00:00

30 lines
1.7 KiB
Python

#!/usr/bin/env python3
"""Compile exact shipped NV_MEMORY_ALLOCATION_PARAMS ABI assertions."""
import json
from pathlib import Path
import subprocess
import tempfile
ROOT = Path(__file__).resolve().parents[1]
INC = Path('/home/geodd/nvidia-driver/analysis-580.178.04/reference/open-gpu-kernel-modules-580.178.04/src/common/sdk/nvidia/inc')
FIELDS = {'owner': 0, 'type': 4, 'flags': 8, 'width': 12, 'height': 16,
'pitch': 20, 'attr': 24, 'attr2': 28, 'format': 32, 'comprCovg': 36,
'zcullCovg': 40, 'rangeLo': 48, 'rangeHi': 56, 'size': 64,
'alignment': 72, 'offset': 80, 'limit': 88, 'address': 96,
'ctagOffset': 104, 'hVASpace': 108, 'internalflags': 112,
'tag': 116, 'numaNode': 120}
source = '#include <stddef.h>\n#include "nvos.h"\n'
source += '_Static_assert(sizeof(NV_MEMORY_ALLOCATION_PARAMS)==128,"size");\n'
source += ''.join(f'_Static_assert(offsetof(NV_MEMORY_ALLOCATION_PARAMS,{field})=={offset},"{field}");\n' for field, offset in FIELDS.items())
results = []
with tempfile.TemporaryDirectory(prefix='nv-rs-sysmem-abi-') as directory:
cfile = Path(directory) / 'layout.c'
cfile.write_text(source)
for abi, flag in [('x86_64', '-m64'), ('i386', '-m32')]:
command = ['cc', flag, '-std=c11', '-Wall', '-Wextra', '-Werror', '-I', str(INC), '-c', str(cfile), '-o', str(Path(directory) / (abi + '.o'))]
subprocess.run(command, check=True, capture_output=True, text=True)
results.append({'abi': abi, 'status': 'passed'})
report = {'header': str(INC / 'nvos.h'), 'size': 128, 'offsets': FIELDS, 'compiler_checks': results}
(ROOT / 'reports/system-memory-abi.json').write_text(json.dumps(report, indent=2) + '\n')
print('NV_MEMORY_ALLOCATION_PARAMS: native and i386 layouts passed')