Files
nvdriver/tools/gpu_aspm_policy_oracle.c
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

116 lines
4.2 KiB
C

/* Source-derived oracle: original580.178.04 inferred _nv012119/_nv012121 bodies.
* Execute only against synthetic buffers and a call recorder, never original RM. */
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
typedef uint8_t undefined1;typedef uint32_t undefined4;typedef uint64_t undefined8;typedef uint32_t uint;
typedef uint32_t code();
static void _nv047868rm(uint32_t group,uint32_t site,...){(void)group;(void)site;}
static unsigned count,calls[2];
static uint32_t record(long gpu,long bif,int port,int enabled,uint32_t*saved){(void)gpu;(void)bif;(void)saved;calls[count++]=8u|((unsigned)port<<1)|!!enabled;return 0;}
/* Inferred Ghidra 12.2 pseudocode; not original source.
* input_sha256: 5269a23ffba19a17fe16f076463e7ad4151254659441d1711bee6c6221ff6f4b
* entry: 062670a0 name: _nv012121rm
* per_function_timeout_seconds: 60
*/
/* WARNING: Function: __x86_indirect_thunk_rax replaced with injection: x86_indirect_thunk_rax */
void _nv012121rm(undefined8 param_1,long param_2,undefined1 param_3,undefined1 param_4)
{
undefined4 uVar1;
uint uVar2;
uVar2 = *(uint *)(param_2 + 0xa24);
if ((uVar2 & 2) != 0) {
uVar1 = (**(code **)(param_2 + 0x450))(param_1,param_2,1,param_3,param_2 + 0xa2c);
_nv047868rm(0xeefe465,0x98f1100,param_3,uVar1);
uVar2 = *(uint *)(param_2 + 0xa24);
}
if ((uVar2 & 1) == 0) {
return;
}
uVar1 = (**(code **)(param_2 + 0x450))(param_1,param_2,0,param_4,param_2 + 0xa30);
_nv047868rm(0xeefe465,0x9a41100,param_4,uVar1);
return;
}
/* Inferred Ghidra 12.2 pseudocode; not original source.
* input_sha256: 5269a23ffba19a17fe16f076463e7ad4151254659441d1711bee6c6221ff6f4b
* entry: 06267160 name: _nv012119rm
* per_function_timeout_seconds: 60
*/
undefined8 _nv012119rm(undefined8 param_1,long param_2)
{
uint uVar1;
if ((*(uint *)(param_2 + 0xa24) & 3) != 0) {
uVar1 = *(uint *)(param_2 + 0xa24) >> 4 & 3;
if (uVar1 == 2) {
_nv012121rm(param_1,param_2,*(uint *)(param_2 + 0xa2c) >> 1 & 1,
*(uint *)(param_2 + 0xa30) >> 1 & 1);
return 0;
}
if (uVar1 == 0) {
_nv012121rm(param_1,param_2,1,1);
return 0;
}
}
return 0;
}
static unsigned armed;
static uint64_t _nv059619rm(uint64_t timer,void*callback,long context,uint64_t delay,unsigned p5,unsigned p6){(void)timer;(void)callback;(void)context;if(delay!=1||p5!=1||p6!=0)return 0x1f;armed++;return 0;}
/* Inferred Ghidra 12.2 pseudocode; not original source.
* input_sha256: 5269a23ffba19a17fe16f076463e7ad4151254659441d1711bee6c6221ff6f4b
* entry: 062671d0 name: _nv012120rm
* per_function_timeout_seconds: 60
*/
undefined8 _nv012120rm(long param_1,undefined8 param_2,long param_3)
{
undefined8 uVar1;
if (*(int *)(param_3 + 0xa28) == 1) {
uVar1 = _nv012119rm(param_1,param_3);
return uVar1;
}
if (*(char *)(param_1 + 0x90c) == '\0') {
*(undefined4 *)(param_3 + 0xa28) = 1;
}
_nv059619rm(param_2,_nv012120rm,param_3,1,1,0);
return 0;
}
int main(int argc,char**argv){
(void)argv;
if(argc>1){
static const unsigned selected[]={0,1,2,3,0x11,0x21,0x22,0x23,0x31,0x103,0x123,0x133};
_Alignas(8) unsigned char gpu[0x910],b[0xb00];
for(unsigned k=0;k<sizeof selected/sizeof selected[0];k++)for(unsigned phase=0;phase<3;phase++)for(unsigned busy=0;busy<2;busy++)for(unsigned up=0;up<4;up++)for(unsigned down=0;down<4;down++){
memset(gpu,0,sizeof gpu);memset(b,0,sizeof b);gpu[0x90c]=busy;*(unsigned*)(b+0xa24)=selected[k];*(unsigned*)(b+0xa28)=phase;*(unsigned*)(b+0xa2c)=up;*(unsigned*)(b+0xa30)=down;
code*callback=(code*)record;memcpy(b+0x450,&callback,sizeof callback);count=0;calls[0]=calls[1]=0;armed=0;
_nv012120rm((long)gpu,0,(long)b);printf("%u,%u,%u,%u,%u,%u,%u,%u,%u\n",selected[k],up,down,phase,busy,*(unsigned*)(b+0xa28),calls[0],calls[1],armed);
}
return 0;
}
_Alignas(8) unsigned char b[0xb00];
for(uint32_t flags=0;flags<512;flags++)for(uint32_t up=0;up<4;up++)for(uint32_t down=0;down<4;down++){
memset(b,0,sizeof b);*(uint32_t*)(b+0xa24)=flags;*(uint32_t*)(b+0xa2c)=up;*(uint32_t*)(b+0xa30)=down;
code*callback=(code*)record;memcpy(b+0x450,&callback,sizeof callback);count=0;calls[0]=calls[1]=0;
_nv012119rm(0,(long)b);printf("%u,%u,%u,%u,%u\n",flags,up,down,calls[0],calls[1]);
}
return 0;
}