/* Returns the (updated) address range state based upon the page table entry. */
STATIC MEM_ENCRYPT_SEV_ADDRESS_RANGE_STATE UpdateAddressState(IN MEM_ENCRYPT_SEV_ADDRESS_RANGE_STATE CurrentState, IN UINT64 PageDirectoryEntry, IN UINT64 AddressEncMask)
/* Returns the (updated) address range state based upon the page table entry. */
STATIC MEM_ENCRYPT_SEV_ADDRESS_RANGE_STATE UpdateAddressState(IN MEM_ENCRYPT_SEV_ADDRESS_RANGE_STATE CurrentState, IN UINT64 PageDirectoryEntry, IN UINT64 AddressEncMask)
{
  if (CurrentState == MemEncryptSevAddressRangeEncrypted) {
    if ((PageDirectoryEntry & AddressEncMask) == 0) {
      CurrentState = MemEncryptSevAddressRangeMixed;
    }
  } else if (CurrentState == MemEncryptSevAddressRangeUnencrypted) {
    if ((PageDirectoryEntry & AddressEncMask) != 0) {
      CurrentState = MemEncryptSevAddressRangeMixed;
    }
  } else if (CurrentState == MemEncryptSevAddressRangeError) {
    if ((PageDirectoryEntry & AddressEncMask) == 0) {
      CurrentState = MemEncryptSevAddressRangeUnencrypted;
    } else {
      CurrentState = MemEncryptSevAddressRangeEncrypted;
    }
  }
  return CurrentState;
}