Newer
Older
AMI-Aptio-BIOS-Reversed / EarlyVideoPei / VgaModeColorConfig.c
@Ajax Dong Ajax Dong 2 days ago 1 KB Init
int __thiscall VgaModeColorConfig(int this)
{
  int v2; // eax
  int v3; // edx
  int v4; // edi
  int v5; // edx
  int v6; // ecx
  int result; // eax
  int v8; // [esp+10h] [ebp-60h] BYREF
  int v9; // [esp+14h] [ebp-5Ch]
  int v10; // [esp+18h] [ebp-58h]
  int v11; // [esp+1Ch] [ebp-54h]
  int v12; // [esp+20h] [ebp-50h]

  if ( (VgaCrtcRegAnd(0xD0u, 0xFFu) & 0x80u) == 0 )
  {
    PciRegWrite(*(_DWORD *)(this + 60), 510533632, 378054824);
    while ( PciRegRead(*(_DWORD *)(this + 60), 510533632) != 1 )
      ;
    PciRegWrite(*(_DWORD *)(this + 60), 510525440, -60816631);
    while ( PciRegRead(*(_DWORD *)(this + 60), 510525440) != 1 )
      ;
    v2 = PciRegRead(*(_DWORD *)(this + 60), 510533640);
    PciRegWrite(*(_DWORD *)(this + 60), v3, v2 | 0x73);
    v4 = 0;
    v8 = *(_DWORD *)(this + 60);
    v9 = 0;
    if ( (PciRegRead(v8, 510533744) & 0x1000000) != 0 )
    {
      v4 = 1;
      v9 = 1;
    }
    v10 = *(unsigned __int8 *)(this + 29);
    v11 = *(_DWORD *)(this + 32);
    v12 = *(_DWORD *)(this + 40);
    if ( v4 )
    {
      VgaModeProgramExt(&v8);
      VgaExtendedModeSetup((int)&v8);
    }
    else
    {
      VgaModeSetupFb(&v8);
      VgaModeProgramLarge((int)&v8);
    }
    PciRegRead(v8, 510533696);
    PciRegWrite(v6, v5, 192);
  }
  do
    result = VgaCrtcRegAnd(0xD0u, 0xFFu);
  while ( (result & 0x40) == 0 );
  return result;
}