From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: ray.ni@intel.com) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by groups.io with SMTP; Fri, 14 Jun 2019 01:18:34 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Jun 2019 01:18:34 -0700 X-ExtLoop1: 1 Received: from ray-dev.ccr.corp.intel.com ([10.239.9.16]) by fmsmga006.fm.intel.com with ESMTP; 14 Jun 2019 01:18:33 -0700 From: "Ni, Ray" To: devel@edk2.groups.io Cc: Jordan Justen , Andrew Fish , Zhiguang Liu , Hao A Wu Subject: [PATCH] EmulatorPkg/Win: Change SecPrint to use PrintLib Date: Fri, 14 Jun 2019 16:18:13 +0800 Message-Id: <20190614081813.80176-1-ray.ni@intel.com> X-Mailer: git-send-email 2.21.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The change is to enhance SecPrint to support printing EFI_STATUS. Signed-off-by: Ray Ni Cc: Jordan Justen Cc: Andrew Fish Cc: Zhiguang Liu Cc: Hao A Wu --- EmulatorPkg/Win/Host/WinHost.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/EmulatorPkg/Win/Host/WinHost.c b/EmulatorPkg/Win/Host/WinHost.c index dd52075f98..bd7662683a 100644 --- a/EmulatorPkg/Win/Host/WinHost.c +++ b/EmulatorPkg/Win/Host/WinHost.c @@ -8,7 +8,7 @@ This code produces 128 K of temporary memory for the SEC stack by directly allocate memory space with ReadWrite and Execute attribute. -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
(C) Copyright 2016 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -167,15 +167,13 @@ SecPrint ( ... ) { - va_list Marker; + VA_LIST Marker; UINTN CharCount; CHAR8 Buffer[0x1000]; - va_start (Marker, Format); - - _vsnprintf (Buffer, sizeof (Buffer), Format, Marker); - - va_end (Marker); + VA_START (Marker, Format); + AsciiVSPrint (Buffer, sizeof Buffer, Format, Marker); + VA_END (Marker); CharCount = strlen (Buffer); WriteFile ( @@ -431,7 +429,7 @@ Returns: gSystemMemoryCount = CountSeparatorsInString (MemorySizeStr, '!') + 1; gSystemMemory = calloc (gSystemMemoryCount, sizeof (NT_SYSTEM_MEMORY)); if (gSystemMemory == NULL) { - SecPrint ("ERROR : Can not allocate memory for %S. Exiting.\n", MemorySizeStr); + SecPrint ("ERROR : Can not allocate memory for %s. Exiting.\n", MemorySizeStr); exit (1); } @@ -441,7 +439,7 @@ Returns: gFdInfoCount = CountSeparatorsInString (FirmwareVolumesStr, '!') + 1; gFdInfo = calloc (gFdInfoCount, sizeof (NT_FD_INFO)); if (gFdInfo == NULL) { - SecPrint ("ERROR : Can not allocate memory for %S. Exiting.\n", FirmwareVolumesStr); + SecPrint ("ERROR : Can not allocate memory for %s. Exiting.\n", FirmwareVolumesStr); exit (1); } // @@ -521,11 +519,11 @@ Returns: &gFdInfo[Index].Size ); if (EFI_ERROR (Status)) { - SecPrint ("ERROR : Can not open Firmware Device File %S (0x%X). Exiting.\n", FileName, Status); + SecPrint ("ERROR : Can not open Firmware Device File %s (%r). Exiting.\n", FileName, Status); exit (1); } - SecPrint (" FD loaded from %S\n", FileName); + SecPrint (" FD loaded from %s\n", FileName); if (SecFile == NULL) { // @@ -914,9 +912,9 @@ PeCoffLoaderRelocateImageExtraAction ( if ((Library != NULL) && (DllEntryPoint != NULL)) { ImageContext->EntryPoint = (EFI_PHYSICAL_ADDRESS) (UINTN) DllEntryPoint; - SecPrint ("LoadLibraryEx (%S,\n NULL, DONT_RESOLVE_DLL_REFERENCES)\n", DllFileName); + SecPrint ("LoadLibraryEx (%s,\n NULL, DONT_RESOLVE_DLL_REFERENCES)\n", DllFileName); } else { - SecPrint ("WARNING: No source level debug %S. \n", DllFileName); + SecPrint ("WARNING: No source level debug %s. \n", DllFileName); } free (DllFileName); -- 2.21.0.windows.1