Newer
Older
AMI-Aptio-BIOS-Reversed / EarlyVideoPei / VgaModeSetupFb.c
@Ajax Dong Ajax Dong 2 days ago 1 KB Init
int __thiscall VgaModeSetupFb(int *this)
{
  int v2; // ecx
  int v3; // ecx
  unsigned int n53543921; // edi
  int v5; // ecx
  unsigned int v6; // eax
  int v7; // eax
  int v8; // edx
  int v9; // ebp
  int v10; // ebx
  int result; // eax
  unsigned int v12; // ebx
  int v13; // ebp
  int v14; // [esp+10h] [ebp-4h]

  v14 = *this;
  PciRegWrite(*this, 510533632, 378054824);
  if ( (PciRegRead(v2, 510525564) & 0xFF000000) == 0x2000000 )
    n53543921 = (PciRegRead(v3, 510533744) & 0x800000) != 0 ? 24117712 : 53543921;
  else
    n53543921 = 53543921;
  PciRegWrite(v3, 510533632, 378054824);
  v6 = PciRegRead(v5, 510533744);
  *(this + 7) = 0;
  v7 = (v6 >> 25) & 3;
  *(this + 10) = 216152;
  *(this + 11) = 6144;
  v8 = v7 & 2;
  v9 = (v8 << 18) | (16 * (v7 + 1));
  v10 = ((v7 + 2) << 16) | ((v8 + 6) << 19);
  if ( *(this + 3) == 336 )
  {
    result = PciRegWrite(v14, 510533664, HIWORD(n53543921));
    v12 = v10 | 0xAA007636;
    *(this + 14) = 572532517;
    *(this + 17) = 186;
    v13 = v9 | 0x4001400;
    *(this + 20) = 116;
    *(this + 21) = 19904;
    *(this + 16) = 3546131;
    *(this + 23) = 3;
  }
  else
  {
    result = PciRegWrite(v14, 510533664, (unsigned __int16)n53543921);
    *(this + 7) = 0;
    v12 = v10 | 0xCC00963F;
    *(this + 14) = 858794021;
    v13 = v9 | 0x4001600;
    *(this + 17) = 226;
    *(this + 20) = 137;
    *(this + 21) = 20672;
    *(this + 16) = 4137495;
    *(this + 23) = 4;
  }
  *(this + 12) = v13;
  *(this + 13) = 0;
  *(this + 15) = v12;
  *(this + 22) = 96;
  *(this + 18) = 250;
  *(this + 19) = 35;
  *(this + 6) = 1;
  return result;
}