Exemple #1
0
	std::string Imm2asm::TranslateToAsm( const std::string& imm, const Environment& tables )
	{
		m_pTables = (Environment*)&tables;

		std::string buffer = ExpandCode(imm);		// 为entry添加活动保存指令

		//std::cout << std::endl << buffer << std::endl;

		LocateLabel( buffer );

		std::string line;
		std::size_t iter = 0;

		while ( iter < buffer.size() )
		{
			line += buffer[ iter ];

			if ( buffer[ iter ] == '\n' )
			{
				TranslateLine(line);

				line = "";
			}

			iter++;
		}

		return m_asmcode;
	}
Exemple #2
0
/**
  Find the first EFI_FORM_LABEL in FormSets for a given EFI_HII_HANLDE defined.
  
  EFI_FORM_LABEL is a specific to Tiano implementation. The current implementation
  does not restrict labels with same label value to be duplicated in either FormSet 
  scope or Form scope. This function will only locate the FIRST EFI_FORM_LABEL
  with value as the same as the input Label in the Formset registered with UefiHiiHandle. The FormSet GUID 
  and Form ID is returned if such Label is found.

  @param Handle       Uefi Hii Handle to be searched.
  @param Label        The first Label ID to be found.
  @param FormsetGuid  The matched FormSet GUID.
  @param FormId       The matched Form ID.
  
  @retval EFI_INVALID_PARAMETER If UefiHiiHandle is not a valid handle.
  @retval EFI_NOT_FOUND         The package list identified by UefiHiiHandle deos not contain FormSet or
                                Form ID with value Label found in all Form Sets in the pacakge list.
  @retval EFI_SUCCESS           The first found Form ID is returned in FormId.
**/
EFI_STATUS
LocateFormId (
  IN  EFI_HII_HANDLE Handle,
  IN  EFI_FORM_LABEL Label,
  OUT EFI_GUID       *FormsetGuid,
  OUT EFI_FORM_ID    *FormId
  )
{
  EFI_STATUS                   Status;
  EFI_HII_PACKAGE_LIST_HEADER  *HiiPackageList;
  UINT32                       Index;
  UINTN                        BufferSize;
  EFI_HII_PACKAGE_HEADER       PackageHeader;
  EFI_HII_PACKAGE_HEADER       *Package;
  UINT32                       PackageLength;

  BufferSize = 0;
  HiiPackageList   = NULL;
  Status = mHiiDatabase->ExportPackageLists (mHiiDatabase, Handle, &BufferSize, HiiPackageList);
  if (Status == EFI_BUFFER_TOO_SMALL) {
    HiiPackageList = AllocatePool (BufferSize);
    ASSERT (HiiPackageList != NULL);

    Status = mHiiDatabase->ExportPackageLists (mHiiDatabase, Handle, &BufferSize, HiiPackageList);
    if (EFI_ERROR (Status)) {
      goto Done;
    }
  }

  for (Index = 0; ; Index++) {
    Status = GetPackageData (HiiPackageList, Index, &PackageLength, &Package);
    if (!EFI_ERROR (Status)) {
      CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER));
      if (PackageHeader.Type == EFI_HII_PACKAGE_FORMS) {
        Status = LocateLabel (Package, Label, FormsetGuid, FormId);
        if (!EFI_ERROR(Status)) {
          break;
        }
      }
    } else {
      break;
    }
  }

  
Done:
  FreePool (HiiPackageList);
  
  return Status;
}