From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web11.40441.1670305305027240654 for ; Mon, 05 Dec 2022 21:41:45 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=GzxDwYEh; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: zhiguang.liu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670305304; x=1701841304; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=3PiiQ28SK1cRPTO9m+T2IHF6jH8HOvbz20wdPJ7N+ME=; b=GzxDwYEhmbMdFccDWHgl1TmWv7bIvqdpH9ev8UBFosKrjb5mq5tZ32Tg qejriP9GLAMqWbVhjEww+5wbBNOnmiY8Rybp2TAyoNyx16gUZMEq8LoUh eiAzRjRUcaQE/avypZWvkkkpQuRvjUkMf2h2JvESvJj5LBWf86zacg/OU MbGC2Vc7QdXCB5RPM/tAv3EfmmH2wfXY5MpvRtUnn0JJILbzErbfYpe6z uhlQvaUo+gQLe7adCQX9+cHr2/IqYgPsNBcTujTKNei2Ck0CDPMr9xkfu 9ZOxe7JOBSHXnQLS35JPb0vzX+ZJvy/IQDvo4ifBZRGLHdI5vSPhGOoDm w==; X-IronPort-AV: E=McAfee;i="6500,9779,10552"; a="380833127" X-IronPort-AV: E=Sophos;i="5.96,220,1665471600"; d="scan'208";a="380833127" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2022 21:41:44 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10552"; a="596455333" X-IronPort-AV: E=Sophos;i="5.96,220,1665471600"; d="scan'208";a="596455333" Received: from shwdesfp01.ccr.corp.intel.com ([10.239.158.151]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2022 21:41:42 -0800 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Zhiguang Liu , Andrew Fish , Ray Ni Subject: [PATCH 2/2] EmulatorPkg: Record Argc, Argv and Envp in EmuThunk Ppi Date: Tue, 6 Dec 2022 13:41:36 +0800 Message-Id: <20221206054136.9963-1-zhiguang.liu@intel.com> X-Mailer: git-send-email 2.31.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Record Argc, Argv and Envp in EmuThunk Ppi so that other modules can use these fields to change behavior depends on boot parameters or environment. Cc: Andrew Fish Cc: Ray Ni Signed-off-by: Zhiguang Liu --- EmulatorPkg/Include/Ppi/EmuThunk.h | 3 +++ EmulatorPkg/Unix/Host/Host.c | 3 +++ EmulatorPkg/Win/Host/WinHost.c | 3 +++ 3 files changed, 9 insertions(+) diff --git a/EmulatorPkg/Include/Ppi/EmuThunk.h b/EmulatorPkg/Include/Ppi/EmuThunk.h index cf29cf824c..c78ad692ed 100644 --- a/EmulatorPkg/Include/Ppi/EmuThunk.h +++ b/EmulatorPkg/Include/Ppi/EmuThunk.h @@ -107,6 +107,9 @@ typedef struct { EMU_PEI_AUTOSCAN MemoryAutoScan; EMU_PEI_FD_INFORMATION FirmwareDevices; EMU_PEI_THUNK_INTERFACE Thunk; + INTN Argc; + CHAR8 **Argv; + CHAR8 **Envp; UINTN PersistentMemorySize; UINT8 PersistentMemory[0]; } EMU_THUNK_PPI; diff --git a/EmulatorPkg/Unix/Host/Host.c b/EmulatorPkg/Unix/Host/Host.c index 8d0be5b54b..1f29dd00a3 100644 --- a/EmulatorPkg/Unix/Host/Host.c +++ b/EmulatorPkg/Unix/Host/Host.c @@ -145,6 +145,9 @@ main ( } CopyMem (SecEmuThunkPpi, &mSecEmuThunkPpi, sizeof (EMU_THUNK_PPI)); + SecEmuThunkPpi->Argc = Argc; + SecEmuThunkPpi->Argv = Argv; + SecEmuThunkPpi->Envp = Envp; SecEmuThunkPpi->PersistentMemorySize = FixedPcdGet32 (PcdPersistentMemorySize); AddThunkPpi (EFI_PEI_PPI_DESCRIPTOR_PPI, &gEmuThunkPpiGuid, SecEmuThunkPpi); diff --git a/EmulatorPkg/Win/Host/WinHost.c b/EmulatorPkg/Win/Host/WinHost.c index 3b2fde297d..f639ba3b1b 100644 --- a/EmulatorPkg/Win/Host/WinHost.c +++ b/EmulatorPkg/Win/Host/WinHost.c @@ -485,6 +485,9 @@ Returns: } CopyMem (SecEmuThunkPpi, &mSecEmuThunkPpi, sizeof (EMU_THUNK_PPI)); + SecEmuThunkPpi->Argc = Argc; + SecEmuThunkPpi->Argv = Argv; + SecEmuThunkPpi->Envp = Envp; SecEmuThunkPpi->PersistentMemorySize = FixedPcdGet32 (PcdPersistentMemorySize); AddThunkPpi (EFI_PEI_PPI_DESCRIPTOR_PPI, &gEmuThunkPpiGuid, SecEmuThunkPpi); AddThunkPpi (EFI_PEI_PPI_DESCRIPTOR_PPI, &gEfiPeiReset2PpiGuid, &mEmuReset2Ppi); -- 2.31.1.windows.1