HalacpiIrqTranslateResourceRequirementsIsa
NTSTATUS __stdcall HalacpiIrqTranslateResourceRequirementsIsa(
PVOID Context,
IO_RESOURCE_DESCRIPTOR *Source,
DEVICE_OBJECT *PhysicalDeviceObject,
IO_RESOURCE_DESCRIPTOR **Target){
unsigned int v4;
NTSTATUS v5;
__int64 v6;
unsigned int v9;
unsigned int v10;
char *v11;
char *v12;
unsigned int v13;
unsigned __int16 v14;
char v15;
int v16;
char *v17;
unsigned int v18;
unsigned int v19;
int v20;
_BYTE *v21;
_BYTE *v22;
unsigned int *v23;
unsigned int v24;
unsigned int v25;
__int64 v26;
__int64 v27;
__int64 v28;
unsigned int v30;
VOID *PoolWithTag;
_OWORD *v32;
__int64 v33;
__int64 v34;
__int64 v35;
__int64 v36;
_DWORD *v37;
__int64 v38;
SIZE_T NumberOfBytes;
char *v40;
__int16 v41;
_QWORD *v43;
v4 = *((_DWORD *)Source + 2);
v5 = 0;
v6 = 0i64;
v9 = 0;
if( v4 + 0x100000 <= 0xFFFFE )
goto LABEL_29;
v10 = *((_DWORD *)Source + 3);
if( v10 + 0x100000 <= 0xFFFFE )
return -1073741823;
if( (unsigned __int8)HalpIsInterruptTypeSecondary(0i64, v4)
&& (unsigned __int8)HalpIsInterruptTypeSecondary(0i64, v10) )
{
LABEL_29:
PoolWithTag = ExAllocatePoolWithTag(PagedPool, 0x20ui64, 0x206C6148ui64);
*v43 = PoolWithTag;
if( PoolWithTag )
{
*(_DWORD *)Target = 1;
v32 = (_OWORD *)*v43;
*v32 = *(_OWORD *)Source;
v32[1] = *((_OWORD *)Source + 1);
return 0;
}
return -1073741670;
}
NumberOfBytes = 32 * (v10 - v4 + 3);
v11 = (char *)ExAllocatePoolWithTag(PagedPool, NumberOfBytes, 0x206C6148ui64);
v40 = v11;
v12 = v11;
if( !v11 )
return -1073741670;
memset((INT64)v11, 0i64);
v13 = *((_DWORD *)Source + 2);
if( v13 > 2 || (v30 = *((_DWORD *)Source + 3), v30 < 2) )
{
v6 = 1i64;
*(_OWORD *)v12 = *(_OWORD *)Source;
*((_OWORD *)v12 + 1) = *((_OWORD *)Source + 1);
}
else
{
if( v13 < 2 )
{
v6 = 1i64;
*(_OWORD *)v12 = *(_OWORD *)Source;
*((_OWORD *)v12 + 1) = *((_OWORD *)Source + 1);
*((_DWORD *)v12 + 2) = *((_DWORD *)Source + 2);
*((_DWORD *)v12 + 3) = 1;
v30 = *((_DWORD *)Source + 3);
}
if( v30 > 2 )
{
v33 = 32i64 * (unsigned int)v6;
v6 = (unsigned int)(v6 + 1);
*(_OWORD *)&v12[v33] = *(_OWORD *)Source;
*(_OWORD *)&v12[v33 + 16] = *((_OWORD *)Source + 1);
*(_DWORD *)&v12[v33 + 12] = *((_DWORD *)Source + 3);
*(_DWORD *)&v12[v33 + 8] = 3;
}
if( *((_DWORD *)Source + 2) > 9u || *((_DWORD *)Source + 3) < 9u )
{
v34 = 32i64 * (unsigned int)v6;
v6 = (unsigned int)(v6 + 1);
*(_OWORD *)&v12[v34] = *(_OWORD *)Source;
*(_OWORD *)&v12[v34 + 16] = *((_OWORD *)Source + 1);
*(_DWORD *)&v12[v34 + 8] = 9;
*(_DWORD *)&v12[v34 + 12] = 9;
}
}
v14 = word_140C49DAE;
v15 = 0;
v41 = word_140C49DAE;
v16 = 0;
if( (_DWORD)v6 )
{
while( 1 )
{
v17 = &v12[32 * v16];
v18 = *((_DWORD *)v17 + 3);
if( v18 >= 0x10 )
break;
v19 = *((_DWORD *)v17 + 2);
if( v19 >= 0x10 )
break;
v20 = v14;
if( v18 >= v14 && v19 <= v14 )
{
if( v15 )
{
v5 = -1073741595;
goto LABEL_24;
}
v15 = 1;
if( v19 < v14 )
{
v35 = 32i64 * (unsigned int)v6;
LODWORD(v6) = v6 + 1;
*(_DWORD *)&v12[v35 + 8] = v19;
*(_DWORD *)&v12[v35 + 12] = v14 - 1;
v18 = *((_DWORD *)v17 + 3);
}
if( v18 > v14 )
{
v36 = 32i64 * (unsigned int)v6;
LODWORD(v6) = v6 + 1;
*(_DWORD *)&v12[v36 + 8] = v20 + 1;
*(_DWORD *)&v12[v36 + 12] = *((_DWORD *)v17 + 3);
}
memmove((UINT8 *)&v12[32 * v16], (UINT8 *)v17 + 32, 32i64 * (unsigned int)(v6 - v16));
v14 = v41;
v6 = (unsigned int)(v6 - 1);
}
if( ++v16 >= (unsigned int)v6 )
goto LABEL_12;
}
v5 = -1073741823;
}
else
{
LABEL_12:
v21 = ExAllocatePoolWithTag(PagedPool, NumberOfBytes, 0x206C6148ui64);
v22 = v21;
if( v21 )
{
memset((INT64)v21, 0i64);
if( (_DWORD)v6 )
{
v23 = (unsigned int *)(v12 + 12);
do
{
v24 = *(v23 - 1);
v25 = *v23;
do
{
v26 = v24;
if( v24 < v25 )
{
v37 = (_DWORD *)HalpPicVectorRedirect + v24;
do
{
v38 = v24 + 1;
if( *v37 + 1 != *((_DWORD *)HalpPicVectorRedirect + v38) )
break;
++v37;
++v24;
}
while( (unsigned int)v38 < v25 );
}
v27 = 32i64 * v9;
*(_OWORD *)&v22[v27] = *(_OWORD *)Source;
*(_OWORD *)&v22[v27 + 16] = *((_OWORD *)Source + 1);
if( v9 )
v22[v27] = 8;
++v9;
*(_DWORD *)&v22[v27 + 8] = *((_DWORD *)HalpPicVectorRedirect + v26);
v28 = v24++;
*(_DWORD *)&v22[v27 + 12] = *((_DWORD *)HalpPicVectorRedirect + v28);
}
while( v24 <= v25 );
v23 += 8;
--v6;
}
while( v6 );
v12 = v40;
}
*(_DWORD *)Target = v9;
if( v9 )
*v43 = v22;
else
ExFreePoolWithTag(v22, 0);
}
else
{
v5 = -1073741670;
}
}
LABEL_24:
ExFreePoolWithTag(v12, 0);
return v5;
}Referenced by:
No references.