Newer
Older
AMI-Aptio-BIOS-Reversed / PurleyPlatPkg / Platform / Pei / EarlyVideoPei / VgaModeProgramExt.c
@Ajax Dong Ajax Dong 2 days ago 1 KB Full restructure
int __thiscall VgaModeProgramExt(int *this)
{
  int v2; // ecx
  unsigned int n53543921; // edi
  int v4; // ecx
  unsigned int v5; // eax
  int v6; // ecx
  int v7; // ebx
  int v8; // ebp
  int v9; // ebx
  int result; // eax
  unsigned int v11; // ebp
  int v12; // ebx

  if ( (PciRegRead(*this, 510525564) & 0xFF000000) == 0x2000000 )
    n53543921 = (PciRegRead(v2, 510533744) & 0x800000) != 0 ? 24117712 : 53543921;
  else
    n53543921 = 53543921;
  PciRegWrite(v2, 510533632, 378054824);
  v5 = PciRegRead(v4, 510533744);
  *(this + 6) = 0;
  *(this + 7) = 0;
  v7 = (v5 >> 25) & 3;
  *(this + 10) = 216152;
  *(this + 11) = 6144;
  *(this + 18) = 240;
  v8 = ((v7 | (16 * v7)) + 17) << 16;
  v9 = 16 * (v7 | 4);
  if ( *(this + 3) == 336 )
  {
    result = PciRegWrite(v6, 510533664, HIWORD(n53543921));
    *(this + 14) = 572528147;
    v11 = v8 | 0xAA00903B;
    *(this + 17) = 186;
    v12 = v9 | 0xA03;
    *(this + 20) = 116;
    *(this + 21) = 19904;
    *(this + 16) = 992155154;
    *(this + 23) = 3;
  }
  else
  {
    result = PciRegWrite(v6, 510533664, (unsigned __int16)n53543921);
    *(this + 7) = 0;
    v11 = v8 | 0xCC00B03F;
    *(this + 14) = 858793748;
    *(this + 17) = 226;
    v12 = v9 | 0xC03;
    *(this + 20) = 137;
    *(this + 21) = 20672;
    *(this + 16) = 1059789590;
    *(this + 23) = 4;
  }
  *(this + 12) = v12;
  *(this + 15) = v11;
  *(this + 22) = 96;
  *(this + 19) = 35;
  *(this + 18) = 250;
  *(this + 13) = 64;
  *(this + 6) = 1;
  return result;
}