Newer
Older
AMI-Aptio-BIOS-Reversed / RegAccessPeim / decompiled / IoMemWrite.c
@Ajax Dong Ajax Dong 2 days ago 1 KB Init
// IoMemWrite - addr:0xffdaeec7
int __fastcall IoMemWrite(int a1, _DWORD *a2, _DWORD *a3)
{
  int v4; // ecx
  int v5; // esi
  int v6; // edi
  int PeiServicesPpi; // eax
  __int16 v8; // si
  int v9; // eax

  if ( a1 )
  {
    v4 = a1 - 1;
    if ( v4 )
    {
      if ( v4 == 1 )
      {
        *a2 = *a3;
      }
      else
      {
        v5 = *a3;
        v6 = a3[1];
        if ( ((unsigned __int8)a2 & 7) != 0 )
        {
          PeiServicesPpi = GetPeiServicesPpi();
          if ( PeiServicesPpi )
            (*(void (__cdecl **)(const char *, int, const char *))(PeiServicesPpi + 4))(
              "e:\\hs\\MdePkg\\Library\\BaseIoLibIntrinsic\\IoLib.c",
              314,
              "(Address & 7) == 0");
        }
        *a2 = v5;
        a2[1] = v6;
      }
    }
    else
    {
      v8 = *(_WORD *)a3;
      if ( ((unsigned __int8)a2 & 1) != 0 )
      {
        v9 = GetPeiServicesPpi();
        if ( v9 )
          (*(void (__cdecl **)(const char *, int, const char *))(v9 + 4))(
            "e:\\hs\\MdePkg\\Library\\BaseIoLibIntrinsic\\IoLib.c",
            183,
            "(Address & 1) == 0");
      }
      *(_WORD *)a2 = v8;
    }
  }
  else
  {
    *(_BYTE *)a2 = *(_BYTE *)a3;
  }
  return 0;
}