summaryrefslogtreecommitdiffstats
path: root/ShellPkg
Commit message (Collapse)AuthorAgeFilesLines
* ShellPkg: Add error message if failed to place receive token in ping command.Fu Siyuan2018-04-024-4/+16
| | | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> (cherry picked from commit 5d8aa7eb6f8f4ba6c0f06c16aed1347861c44d24)
* ShellPkg: Fix typo errors in ifconfig help outputTapan Shah2017-06-101-2/+3
| | | | | | | | | | Found few instances where IPv4 and DHCPv4 spelled incorrectly as IP4 and DHCP4 respectively. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Tapan Shah <tapandshah@hpe.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> (cherry picked from commit 97f1cd597e01b9c96a1be9b33d7785362269506e)
* Shell/alias: Print detailed error when deleting aliasRuiyu Ni2017-06-102-3/+7
| | | | | | | | | | | | STR_GEN_ERR_NOT_FOUND is added and currently is only used by alias command. This string template can be used by other commands as well. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Tapan Shah <tapandshah@hpe.com> (cherry picked from commit 937bc66e1e555e74acdeba766b12c06fd506e408)
* ShellPkg/ifconfig: Update help messagehegdenag2017-06-091-2/+2
| | | | | | | | | | | | Couple of instances had IP4 mentioned, instead of IPv4. Changing all to IPv4 to maintain consistency. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com> Reviewed-by: Tapan Shah <tapandshah@hpe.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com> (cherry picked from commit c1f4b86ba786cc9cbe5c88a05abc9bf0554b1cc8)
* ShellPkg: Remove unnecessary Readme.txtRuiyu Ni2017-06-091-29/+0
| | | | | | | | | | | | | The Readme.txt contains instructions about how to integrate Shell into Nt32. Actually Nt32 already contains a macro USE_OLD_SHELL to choose OLD or NEW Shell. So remove this txt file. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> (cherry picked from commit 752234768eee79c3e9b32b9a2d134148ecaa635a)
* ShellPkg/parse: Handle Unicode stream from pipe correctlyRuiyu Ni2017-06-071-142/+3
| | | | | | | | | | | | | | | | | | | | The original code expects the Unicode stream from pipe doesn't contains the Unicode BOM. But that's not true. Commit [9ed21946c76e430097e9c4e59b419af928e0cb8c] changes CreateFileInterfaceMem() to add the BOM for Unicode stream. When parse pipe support was firstly added, a private implementation ParseReturnStdInLine() was created to specially handle the Unicode stream without BOM. Since now the Unicode steam contains BOM, the private implementation can be removed and ShellFileHandleReturnLine() can be used directly. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Tapan Shah <tapandshah@hpe.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> (cherry picked from commit 4e6394455a8a9741dafe2928373db461ef21671e)
* ShellPkg/alias: Return status for alias deletionRuiyu Ni2017-06-071-1/+10
| | | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Tapan Shah <tapandshah@hpe.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> (cherry picked from commit 7bd5a2c81ed5bc52ed63b348fcb1686f1fb5b398)
* ShellPkg/alias: Fix bug to support upper-case aliasRuiyu Ni2017-06-071-25/+25
| | | | | | | | | | | | | | | | alias in UEFI Shell is case insensitive. Old code saves the alias to variable storage without converting the alias to lower-case, which results upper case alias setting doesn't work. The patch converts the alias to lower case before saving to variable storage. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Tapan Shah <tapandshah@hpe.com> (cherry picked from commit 7ec69844b8f1d348c0699cc882222c728acb13ad)
* ShellPkg/UefiShellLib: Avoid reading undefined content before stringHao Wu2017-06-021-1/+1
| | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=566 In function InternalShellPrintWorker(), if the string in variable 'mPostReplaceFormat2' starts with character L'%', the following expression: *(ResumeLocation-1) == L'^' at line 2831 will read an undefined value before the starting of string 'mPostReplaceFormat2'. This commit adds additional logic to avoid reading undefined content. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> (cherry picked from commit d727614c913449a59e8333c4d75cff4ebf1f9779)
* ShellPkg/UefiShellLib: Check correct variable for NULLJeff Westfahl2017-06-021-1/+1
| | | | | | | | | Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> (cherry picked from commit 5220897839dd583e9d1f749fb4d8196ff86ccc8b)
* ShellPkg/memmap: Dump memory map information for all memory typesRuiyu Ni2017-05-122-3/+93
| | | | | | | | | | | | | The patch dumps memory map information for all memory types. But to follow the SFO format of "memmap" defined in Shell 2.2 spec, the patch doesn't dump the memory map information for OEM/OS memory types. But it does include the OEM/OS memory in the total size in SFO format. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> (cherry picked from commit 8bb61740d47b0788bc313f113cbad4a78b55101e)
* ShellPkg/memmap: Refine codeRuiyu Ni2017-05-121-52/+55
| | | | | | | | | | | The patch changes Buffer to Descriptors, changes (UINT8 *Walker) to (EFI_MEMORY_DESCRIPTOR *Walker). The change makes lots of type conversion unnecessary. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> (cherry picked from commit ac25ebdccc667ecf8397c7310f66e8e2fcfacb26)
* ShellPkg/HandleParsingLib: Show LoadedImageProtocol file nameJeff Westfahl2017-05-112-1/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for showing the file name associated with a LoadedImageProtocol file path. This is a behavior that was present in the old shell but has been lost in the new shell. For example, using 'dh -v' in the old shell: Handle D3 (3A552218) Image (3A54C918) File:MicrocodeUpdate ParentHandle..: 3A666398 vs. the new shell: D3: 3A552218 LoadedImage Revision......: 0x00001000 ParentHandle..: 3A666398 Here's what the output of 'dh -v' looks like after this patch: D3: 3A552218 LoadedImage Name..........: MicrocodeUpdate Revision......: 0x00001000 ParentHandle..: 3A666398 This seems like useful information for the shell to display. Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> (cherry picked from commit f4ac4354652b2bcf4f138b5ebd79b2f07710d4ef)
* ShellPkg/HandleParsingLib: Open LoadedImageProtocol firstJeff Westfahl2017-05-111-8/+7
| | | | | | | | | | | | | | This patch changes the order of operations to make sure we can open the LoadedImageProtocol before getting the format string. This should not affect functionality, and makes the next patch easier to review. Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> (cherry picked from commit bbb212afa0f8e33e0b686a1b6ffd85d353eed83d)
* ShellPkg/HandleParsingLib: Show LoadedImageProtocol file path as textJeff Westfahl2017-05-112-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for displaying a text representation of the file path associated with a LoadedImageProtocol. This is a behavior that was present in the old shell but has been lost in the new shell. For example, using 'dh -v' in the old shell: FilePath......: FvFile(F3331DE6-4A55-44E4-B767-7453F7A1A021) FilePath......: \EFI\BOOT\BOOTX64.EFI vs. the new shell: FilePath......: 3A539018 FilePath......: 3A728718 This seems like useful information for the shell to display. Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> (cherry picked from commit c15323ae2e79ee9b0779b030605d5d4c204d624a)
* ShellPkg/ShellCommandLib: Update DumpHex to print {|}~Jeff Westfahl2017-05-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | ASCII characters {|}~ should be printed by DumpHex. The problem is that if you have a string like {xizzy}~{foo|bar}~{quux} in the dumped data, it will not appear as such in the *-delimited ASCII column to the right, but as .xizzy...foo.bar...quux. which is less than ideal. Most of the commit message was inspired by/shamelessly stolen from Laszlo's example: https://lists.01.org/pipermail/edk2-devel/2017-April/010266.html Cc: Jaben Carsey <jaben.carsey@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> (cherry picked from commit 4bf3b994e8b207fc919958b4a212a8342aaaa749)
* ShellPkg: Update package version to 1.01Ruiyu Ni2017-05-042-3/+3
| | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> (cherry picked from commit cc432448426cb63b3948703da873d22debc69e79)
* ShellPkg/UefiHandleParsingLib: Fix memory leakRuiyu Ni2017-05-041-1/+3
| | | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Signed-off-by: Chen A Chen <chen.a.chen@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> (cherry picked from commit 00324f3fce83b8d813ca3ec6b6eb663a88a8675e)
* ShellPkg/Shell: eliminate double-free in RunSplitCommand()Laszlo Ersek2017-05-041-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit bd3fc8133b2b ("ShellPkg/App: Fix memory leak and save resources.", 2016-05-20) added a FreePool() call for Split->SplitStdIn, near end of the RunSplitCommand(), right after the same shell file was closed with CloseFile(). The argument was: > 1) RunSplitCommand() allocates the initial SplitStdOut via > CreateFileInterfaceMem(). Free SplitStdIn after the swap to fix > the memory leak. There is no memory leak actually, and the FreePool() call in question constitutes a double-free: (a) This is how the handle is established: ConvertEfiFileProtocolToShellHandle ( CreateFileInterfaceMem (Unicode), NULL ); CreateFileInterfaceMem() allocates an EFI_FILE_PROTOCOL_MEM object and populates it fully. ConvertEfiFileProtocolToShellHandle() allocates some administrative structures and links the EFI_FILE_PROTOCOL_MEM object into "mFileHandleList". (b) EFI_SHELL_PROTOCOL.CloseFile() is required to close the SHELL_FILE_HANDLE and to release all associated data. Accordingly, near the end of RunSplitCommand(), we have: EfiShellClose() ShellFileHandleRemove() // // undoes the effects of ConvertEfiFileProtocolToShellHandle() // ConvertShellHandleToEfiFileProtocol() // // note that this does not adjust the pointer value; it's a pure // type cast // FileHandleClose() FileInterfaceMemClose() // // tears down EFI_FILE_PROTOCOL_MEM completely, undoing the // effects of CreateFileInterfaceMem () // The FreePool() call added by bd3fc8133b2b conflicts with SHELL_FREE_NON_NULL(This); in FileInterfaceMemClose(), so remove it. This error can be reproduced for example with: > Shell> map | more > 'more' is not recognized as an internal or external command, operable > program, or script file. which triggers: > ASSERT MdeModulePkg/Core/Dxe/Mem/Pool.c(624): CR has Bad Signature with the following stack dump: > #0 0x000000007f6dc094 in CpuDeadLoop () at > MdePkg/Library/BaseLib/CpuDeadLoop.c:37 > #1 0x000000007f6dd1b4 in DebugAssert (FileName=0x7f6ed9f0 > "MdeModulePkg/Core/Dxe/Mem/Pool.c", LineNumber=624, > Description=0x7f6ed9d8 "CR has Bad Signature") at > OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c:153 > #2 0x000000007f6d075d in CoreFreePoolI (Buffer=0x7e232c98, > PoolType=0x7f6bc1c4) at MdeModulePkg/Core/Dxe/Mem/Pool.c:624 > #3 0x000000007f6d060e in CoreInternalFreePool (Buffer=0x7e232c98, > PoolType=0x7f6bc1c4) at MdeModulePkg/Core/Dxe/Mem/Pool.c:529 > #4 0x000000007f6d0648 in CoreFreePool (Buffer=0x7e232c98) at > MdeModulePkg/Core/Dxe/Mem/Pool.c:552 > #5 0x000000007d49fbf8 in FreePool (Buffer=0x7e232c98) at > MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c:818 > #6 0x000000007d4875c3 in RunSplitCommand (CmdLine=0x7d898398, > StdIn=0x0, StdOut=0x0) at ShellPkg/Application/Shell/Shell.c:1813 > #7 0x000000007d487d59 in ProcessNewSplitCommandLine > (CmdLine=0x7d898398) at ShellPkg/Application/Shell/Shell.c:2121 > #8 0x000000007d488937 in RunShellCommand (CmdLine=0x7e233018, > CommandStatus=0x0) at ShellPkg/Application/Shell/Shell.c:2670 > #9 0x000000007d488b0b in RunCommand (CmdLine=0x7e233018) at > ShellPkg/Application/Shell/Shell.c:2732 > #10 0x000000007d4867c8 in DoShellPrompt () at > ShellPkg/Application/Shell/Shell.c:1349 > #11 0x000000007d48524d in UefiMain (ImageHandle=0x7e24c898, > SystemTable=0x7f5b6018) at ShellPkg/Application/Shell/Shell.c:631 Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Marvin Häuser <Marvin.Haeuser@outlook.com> Cc: Qiu Shumin <shumin.qiu@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Fixes: bd3fc8133b2b17ad2e0427d1bf6b44b08cf2f3b2 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Marvin Häuser <Marvin.Haeuser@outlook.com> (cherry picked from commit 227fe49d5d4fe6513fc09766f1c9f3ff330ea845)
* ShellPkg/Shell: clean up bogus member types in SPLIT_LISTLaszlo Ersek2017-05-042-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "SPLIT_LIST.SplitStdOut" and "SPLIT_LIST.SplitStdIn" members currently have type (SHELL_FILE_HANDLE *). This is wrong; SHELL_FILE_HANDLE is already a pointer, there's no need to store a pointer to a pointer. The error is obvious if we check where and how these members are used: - In the RunSplitCommand() function, these members are used (populated) extensively; this function has to be updated in sync. ConvertEfiFileProtocolToShellHandle() already returns the temporary memory file created with CreateFileInterfaceMem() as SHELL_FILE_HANDLE, not as (SHELL_FILE_HANDLE *). - In particular, the ConvertShellHandleToEfiFileProtocol() calls need to be dropped as well in RunSplitCommand(), since EFI_SHELL_PROTOCOL.SetFilePosition() and EFI_SHELL_PROTOCOL.CloseFile() take SHELL_FILE_HANDLE parameters, not (EFI_FILE_PROTOCOL *). Given that ConvertShellHandleToEfiFileProtocol() only performs a type-cast (it does not adjust any pointer values), *and* SHELL_FILE_HANDLE -- taken by EFI_SHELL_PROTOCOL member functions -- is actually a typedef to (VOID *) -- see more on this later --, this conversion error hasn't been caught by compilers. - In the ProcessNewSplitCommandLine() function, RunSplitCommand() is called either initially (passing in NULL / NULL; no update needed), or recursively (passing in Split->SplitStdIn / Split->SplitStdOut; again no update is necessary beyond the RunSplitCommand() modification above). - In the UpdateStdInStdOutStdErr() and RestoreStdInStdOutStdErr() functions, said structure members are compared and assigned to "EFI_SHELL_PARAMETERS_PROTOCOL.StdIn" and "EFI_SHELL_PARAMETERS_PROTOCOL.StdOut", both of which have type SHELL_FILE_HANDLE, *not* (SHELL_FILE_HANDLE *). The compiler hasn't caught this error because of the fatally flawed type definition of SHELL_FILE_HANDLE, namely typedef VOID *SHELL_FILE_HANDLE; Pointer-to-void silently converts to and from most other pointer types; among them, pointer-to-pointer-to-void. That is also why no update is necessary for UpdateStdInStdOutStdErr() and RestoreStdInStdOutStdErr() in this fix. ( Generally speaking, using (VOID *) typedefs for opaque handles is a tragic mistake in all of the UEFI-related specifications; this practice defeats any type checking that compilers might help programmers with. The right way to define an opaque handle is as follows: // // Introduce the incomplete structure type, and the derived pointer // type, in both the specification and the public edk2 headers. Note // that the derived pointer type itself is a complete type, and it can // be used freely by client code. // typedef struct SHELL_FILE *SHELL_FILE_HANDLE; // // Complete the structure type in the edk2 internal C source files. // struct SHELL_FILE { // // list fields // }; This way the structure size and members remain hidden from client code, but the C compiler can nonetheless catch any invalid conversions between incompatible XXX_HANDLE types. ) Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Marvin Häuser <Marvin.Haeuser@outlook.com> Cc: Qiu Shumin <shumin.qiu@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> (cherry picked from commit 1bd0bf153ebf4993421afd5084c52a6e57e17fdc)
* ShellPkg SmbiosView: Display Type 0 BIOS segment in hexadecimalJeff Westfahl2017-05-041-1/+1
| | | | | | | | | | | | | The SMBIOS Type 0 BIOS segment field is currently displayed in decimal. Since this field is likely to have a value like 0xE800 or 0xF000, using hexadecimal seems like a better choice. Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com> Reviewed-by: Star Zeng <star.zeng@intel.com> (cherry picked from commit fed709deb444084594c2e11a1886819fa54afc00)
* ShellPkg/pci: Fix VS2012 build failureRuiyu Ni2017-04-201-1/+2
| | | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> (cherry picked from commit f1894fa294a17c17149c55ae21d4d85b2df3c1de)
* ShellPkg/comp: Fix file tag name.Ruiyu Ni2017-04-201-4/+6
| | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chen A Chen <chen.a.chen@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> (cherry picked from commit a32c1a5b1c0945a7159a42a28aafcde4011ad55d)
* ShellPkg/Pci: Always dump the extended config space for PCIERuiyu Ni2017-04-191-193/+125
| | | | | | | | | | | | | It is to align to the original behavior before "-ec" option was added. The patch also refines the code to make it more readable. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Cc: Jim Dailey <Jim.Dailey@dell.com> (cherry picked from commit 33cc487c263384451aef77fa5d749fd4f3d78b7d)
* ShellPkg/ConsistMapping: Remove unneeded memory reallocationRuiyu Ni2017-04-181-9/+2
| | | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Michael Turner <Michael.Turner@microsoft.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> (cherry picked from commit 17c3dc19395121486c6f1614dbc564f39763720a)
* ShellPkg/SetVar: Fix typo in commentsDandan Bi2017-04-071-1/+1
| | | | | | | Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* ShellPkg: Fix Shell to not return without startup.nsh after timeoutRuiyu Ni2017-04-071-0/+5
| | | | | | | | | | | When user doesn't press key to exit the timeout waiting in Shell, and there is no startup.nsh, Shell exits with failure status. aaf51f08ee104447207bba571649556095befc93 introduced this bug. The patch fixes this issue. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Chen A Chen <chen.a.chen@intel.com>
* ShellPkg/setvar: Add assertion indicating TempData shouldn't be NULLRuiyu Ni2017-04-051-1/+2
| | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
* ShellPkg/setvar: Support data format in Shell 2.2 specChen A Chen2017-03-311-126/+297
| | | | | | | | | | | | | | Shell 2.2 spec defines =0x/=0X, =H/=h, =S, =L and =P for hex number, hex array, ascii string, unicode string and device path data. The patch adds such support. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chen A Chen <chen.a.chen@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Jeff Fan <jeff.fan@intel.com>
* ShellPkg/Shell: Avoid potential null pointer deferenceRuiyu Ni2017-03-291-0/+6
| | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
* ShellPkg/Shell: Make comments align with the functionDandan Bi2017-03-281-2/+2
| | | | | | | | Cc: Chen A Chen <chen.a.chen@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* ShellPkg/mm: Support UINT16 segment numberRuiyu Ni2017-03-272-20/+20
| | | | | | | | It's to follow the Shell 2.2 spec. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg: Add Shell invocation option '-exit'Chen A Chen2017-03-232-3/+3
| | | | | | | | | | According to Shell spec 2.2 '-exit' invocation option is used to specify that after running the command line when launched, the UEFI Shell must immediately exit. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chen A Chen <chen.a.chen@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg: Fix shell not able to run startup.nshChen A Chen2017-03-231-58/+56
| | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chen A Chen <chen.a.chen@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg: add GUID declaration for FILE_GUID of UEFI Shell app to packageArd Biesheuvel2017-03-222-1/+4
| | | | | | | | | | | | | In QuarkPlatformPkg/Library/PlatformBootManagerLib/PlatformBootManager.c, there is a definition of mUefiShellFileGuid which is a constant reference to the FILE_GUID as defined in ShellPkg/Application/Shell/Shell.inf. To prevent the need for duplicating it to other modules, promote it to a proper global GUID, and add it to the ShellPkg.dec package declaration. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/HandleParsingLib: Correct format specifier for LoadedImageJeff Westfahl2017-03-171-1/+1
| | | | | | | | | | | | | | | | The format specifier for the LoadOptions field of the LoadedImage protocol is "%s". However, the data in LoadOptions is often generic binary data. A format specifier of "%x" is more appropriate for this field. Using "dh -v" with format specifier "%s" on BIOS images based on EDK II source before commit 891d844 can cause a crash. Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg UefiDpLib: Handle "/" separator in debug path for GCC buildStar Zeng2017-03-161-1/+1
| | | | | | | | | | Cc: Liming Gao <liming.gao@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* ShellPkg/UefiShellBcfgCommandLib: Fix VS2012 build failureDandan Bi2017-03-151-0/+1
| | | | | | | | | Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* ShellPkg/comp: Use proper parameter namesRuiyu Ni2017-03-061-5/+5
| | | | | | | | | The patch doesn't impact the functionality. The rename also fixes the inconsistency between function header comments and function parameters. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
* ShellPkg: Refine casting expression result to bigger sizeHao Wu2017-03-062-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are cases that the operands of an expression are all with rank less than UINT64/INT64 and the result of the expression is explicitly cast to UINT64/INT64 to fit the target size. An example will be: UINT32 a,b; // a and b can be any unsigned int type with rank less than UINT64, like // UINT8, UINT16, etc. UINT64 c; c = (UINT64) (a + b); Some static code checkers may warn that the expression result might overflow within the rank of "int" (integer promotions) and the result is then cast to a bigger size. The commit refines codes by the following rules: 1). When the expression is possible to overflow the range of unsigned int/ int: c = (UINT64)a + b; 2). When the expression will not overflow within the rank of "int", remove the explicit type casts: c = a + b; 3). When the expression will be cast to pointer of possible greater size: UINT32 a,b; VOID *c; c = (VOID *)(UINTN)(a + b); --> c = (VOID *)((UINTN)a + b); 4). When one side of a comparison expression contains only operands with rank less than UINT32: UINT8 a; UINT16 b; UINTN c; if ((UINTN)(a + b) > c) {...} --> if (((UINT32)a + b) > c) {...} For rule 4), if we remove the 'UINTN' type cast like: if (a + b > c) {...} The VS compiler will complain with warning C4018 (signed/unsigned mismatch, level 3 warning) due to promoting 'a + b' to type 'int'. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg: Refine type cast for pointer subtractionHao Wu2017-03-065-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For pointer subtraction, the result is of type "ptrdiff_t". According to the C11 standard (Committee Draft - April 12, 2011): "When two pointers are subtracted, both shall point to elements of the same array object, or one past the last element of the array object; the result is the difference of the subscripts of the two array elements. The size of the result is implementation-defined, and its type (a signed integer type) is ptrdiff_t defined in the <stddef.h> header. If the result is not representable in an object of that type, the behavior is undefined." In our codes, there are cases that the pointer subtraction is not performed by pointers to elements of the same array object. This might lead to potential issues, since the behavior is undefined according to C11 standard. Also, since the size of type "ptrdiff_t" is implementation-defined. Some static code checkers may warn that the pointer subtraction might underflow first and then being cast to a bigger size. For example: UINT8 *Ptr1, *Ptr2; UINTN PtrDiff; ... PtrDiff = (UINTN) (Ptr1 - Ptr2); The commit will refine the pointer subtraction expressions by casting each pointer to UINTN first and then perform the subtraction: PtrDiff = (UINTN) Ptr1 - (UINTN) Ptr2; Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg: Link DxeSmmPerformanceLib to make DP command genericStar Zeng2017-03-021-1/+1
| | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=412 Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/bcfg: Add Shell Spec 2.2 modification functionalityChen A Chen2017-03-013-3/+360
| | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chen A Chen <chen.a.chen@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/Debug1CommandLib: Use StrToGuid/StrHexToBytes in BaseLibRuiyu Ni2017-03-014-159/+11
| | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/comp: Fix GCC build failureRuiyu Ni2017-02-281-0/+1
| | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
* ShellPkg/comp: Add "-n <diff-count>"/"-s <diff-byte>" supportChen A Chen2017-02-282-155/+229
| | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chen A Chen <chen.a.chen@intel.com> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/comp: Rename variable names to proper onesChen A Chen2017-02-281-23/+23
| | | | | | | | The change doesn't impact the functionality. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chen A Chen <chen.a.chen@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/UefiDpLib: Add check to avoid NULL pointer deferenceHao Wu2017-02-281-1/+1
| | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* ShellPkg UefiDpLib: Fixed GCC build failure caused by ef22403Star Zeng2017-02-241-1/+1
| | | | | | | | | | | Cc: Michael Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* ShellPkg UefiDpLib: Remove TimerLib dependencyStar Zeng2017-02-239-56/+25
| | | | | | | | | | | | | | | | | | | | | Current UefiDpLib implementation depends on TimerLib, as different platforms may implement and use their own TimerLib, it makes the dp command needs to be built by platform. The TimerLib dependency can be removed by using performance property configuration table to make UefiDpLib to be generic. Cc: Andrew Fish <afish@apple.com> Cc: Michael Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Cinnamon Shia <cinnamon.shia@hpe.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Andrew Fish <afish@apple.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>