Newer
Older
AMI-Aptio-BIOS-Reversed / Platform / IoWrite32.c
@Ajax Dong Ajax Dong 2 days ago 2 KB Init
// IoWrite32 - decompiled from Platform.efi
// local variable allocation has failed, the output may be wrong!
UINT32 __cdecl IoWrite32(UINTN Port, UINT32 Value)
{
  __int64 v2; // r8
  __int64 v3; // rbp
  __int64 v5; // rsi
  UINT16 Value_1; // dx
  UINTN Port_1; // rcx
  __int64 (__fastcall **v8)(_QWORD, __int64 *, __int64 *); // rax
  UINTN Port_2; // rcx
  __int64 (__fastcall **v10)(_QWORD, __int64 *, __int64 *); // rdi
  __int64 *DestinationBuffer_1; // rax
  __int64 *DestinationBuffer; // rbx
  __int64 v14; // rax
  __int64 v15; // rbx
  char v16; // [rsp+20h] [rbp-68h] BYREF
  __int64 n72; // [rsp+90h] [rbp+8h] BYREF

  v3 = *(_QWORD *)&Value; /*0xae36*/
  v5 = v2; /*0xae48*/
  DebugPrint(0x40u, "SmmLockBoxDxeLib SaveLockBox - Enter\n"); /*0xae4b*/
  if ( !Port || !v3 || !v5 ) /*0xae65*/
    return 2; /*0xaf47*/
  LOWORD(v8) = IoWrite16(Port_1, Value_1); /*0xae6b*/
  v10 = v8; /*0xae70*/
  if ( !v8 ) /*0xae76*/
    return 19; /*0xae78*/
  LODWORD(DestinationBuffer_1) = IoRead32(Port_2); /*0xae87*/
  DestinationBuffer = (__int64 *)&v16; /*0xae8f*/
  if ( DestinationBuffer_1 ) /*0xaea1*/
    DestinationBuffer = DestinationBuffer_1; /*0xaea1*/
  CopyMem(DestinationBuffer, &SourceBuffer__13, 0x10u); /*0xaea8*/
  DestinationBuffer[2] = 48; /*0xaeb6*/
  DestinationBuffer[4] = -1; /*0xaebd*/
  *((_DWORD *)DestinationBuffer + 6) = 1; /*0xaec2*/
  *((_DWORD *)DestinationBuffer + 7) = 48; /*0xaecd*/
  CopyMem(DestinationBuffer + 5, (const void *)Port, 0x10u); /*0xaed0*/
  DestinationBuffer[7] = v3; /*0xaed5*/
  DestinationBuffer[8] = v5; /*0xaee1*/
  n72 = 72; /*0xaeeb*/
  v14 = (*v10)(v10, DestinationBuffer, &n72); /*0xaef7*/
  if ( v14 < 0 ) /*0xaefc*/
  {
    DebugPrint(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v14); /*0xaf0d*/
    Assert( /*0xaf25*/
      (__int64)"e:\\hs\\MdeModulePkg\\Library\\SmmLockBoxLib\\SmmLockBoxDxeLib.c",
      198,
      (__int64)"!EFI_ERROR (Status)");
  }
  v15 = DestinationBuffer[4]; /*0xaf2a*/
  DebugPrint(0x40u, "SmmLockBoxDxeLib SaveLockBox - Exit (%r)\n", v15); /*0xaf3d*/
  return v15; /*0xaf5e*/
}