]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Roll back check in r15180 which caused the shell always returns EFI_ABORTED no matter...
authorRuiyu Ni <ruiyu.ni@intel.com>
Thu, 18 Sep 2014 01:58:03 +0000 (01:58 +0000)
committerniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 18 Sep 2014 01:58:03 +0000 (01:58 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Carsey Jaben <jaben.carsey@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16127 6f19259b-4bc3-4df7-8a09-765794883524

ShellPkg/Application/Shell/Shell.c
ShellPkg/Application/Shell/Shell.h
ShellPkg/Application/Shell/ShellProtocol.c
ShellPkg/Application/Shell/ShellProtocol.h

index 29c65b7f27eda34c5e0c558a27dab7004c3e28f7..41fa78004dcca81646bd377e7655a6506d5a9510 100644 (file)
@@ -244,9 +244,6 @@ UefiMain (
   UINTN                           Size;\r
   EFI_HANDLE                      ConInHandle;\r
   EFI_SIMPLE_TEXT_INPUT_PROTOCOL  *OldConIn;\r
   UINTN                           Size;\r
   EFI_HANDLE                      ConInHandle;\r
   EFI_SIMPLE_TEXT_INPUT_PROTOCOL  *OldConIn;\r
-  UINTN                           ExitDataSize;\r
-  CHAR16                          *ExitData;\r
-  SHELL_STATUS                    ExitStatus;\r
 \r
   if (PcdGet8(PcdShellSupportLevel) > 3) {\r
     return (EFI_UNSUPPORTED);\r
 \r
   if (PcdGet8(PcdShellSupportLevel) > 3) {\r
     return (EFI_UNSUPPORTED);\r
@@ -300,12 +297,6 @@ UefiMain (
   // install our console logger.  This will keep a log of the output for back-browsing\r
   //\r
   Status = ConsoleLoggerInstall(ShellInfoObject.LogScreenCount, &ShellInfoObject.ConsoleInfo);\r
   // install our console logger.  This will keep a log of the output for back-browsing\r
   //\r
   Status = ConsoleLoggerInstall(ShellInfoObject.LogScreenCount, &ShellInfoObject.ConsoleInfo);\r
-  if(EFI_ERROR (Status)) {\r
-    ExitStatus = (SHELL_STATUS) (Status & (~MAX_BIT));\r
-  } else {\r
-    ExitStatus = SHELL_SUCCESS;\r
-  }\r
-       \r
   if (!EFI_ERROR(Status)) {\r
     //\r
     // Enable the cursor to be visible\r
   if (!EFI_ERROR(Status)) {\r
     //\r
     // Enable the cursor to be visible\r
@@ -419,7 +410,7 @@ UefiMain (
     // Display the mapping\r
     //\r
     if (PcdGet8(PcdShellSupportLevel) >= 2 && !ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoMap) {\r
     // Display the mapping\r
     //\r
     if (PcdGet8(PcdShellSupportLevel) >= 2 && !ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoMap) {\r
-      Status = RunCommand(L"map", NULL);\r
+      Status = RunCommand(L"map");\r
       ASSERT_EFI_ERROR(Status);\r
     }\r
 \r
       ASSERT_EFI_ERROR(Status);\r
     }\r
 \r
@@ -485,11 +476,7 @@ UefiMain (
         //\r
         // process the startup script or launch the called app.\r
         //\r
         //\r
         // process the startup script or launch the called app.\r
         //\r
-        Status = DoStartupScript(\r
-                  ShellInfoObject.ImageDevPath,\r
-                  ShellInfoObject.FileDevPath,\r
-                  &ExitStatus\r
-                  );\r
+        Status = DoStartupScript(ShellInfoObject.ImageDevPath, ShellInfoObject.FileDevPath);\r
       }\r
 \r
       if (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.Exit && !ShellCommandGetExit() && (PcdGet8(PcdShellSupportLevel) >= 3 || PcdGetBool(PcdShellForceConsole)) && !EFI_ERROR(Status) && !ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn) {\r
       }\r
 \r
       if (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.Exit && !ShellCommandGetExit() && (PcdGet8(PcdShellSupportLevel) >= 3 || PcdGetBool(PcdShellForceConsole)) && !EFI_ERROR(Status) && !ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn) {\r
@@ -523,7 +510,6 @@ UefiMain (
           //\r
           Status = DoShellPrompt();\r
         } while (!ShellCommandGetExit());\r
           //\r
           Status = DoShellPrompt();\r
         } while (!ShellCommandGetExit());\r
-        ExitStatus = (SHELL_STATUS) ShellCommandGetExitCode();\r
       }\r
       if (OldConIn != NULL && ConInHandle != NULL) {\r
         CloseSimpleTextInOnFile (gST->ConIn);\r
       }\r
       if (OldConIn != NULL && ConInHandle != NULL) {\r
         CloseSimpleTextInOnFile (gST->ConIn);\r
@@ -595,33 +581,10 @@ FreeResources:
     DEBUG_CODE(ShellInfoObject.ConsoleInfo = NULL;);\r
   }\r
 \r
     DEBUG_CODE(ShellInfoObject.ConsoleInfo = NULL;);\r
   }\r
 \r
-  if (!EFI_ERROR (Status)) {\r
-    // If the command exited with an error, we pass this error out in the ExitData\r
-    // so that it can be retrieved by the EfiShellExecute function (which may\r
-    // start the shell with gBS->StartImage)\r
-    if (ExitStatus != SHELL_SUCCESS) {\r
-      // Allocate a buffer for exit data to pass to gBS->Exit().\r
-      // This buffer will contain the empty string immediately followed by\r
-      // the shell's exit status. (The empty string is required by the UEFI spec)\r
-      ExitDataSize = (sizeof (CHAR16) + sizeof (SHELL_STATUS));\r
-      ExitData = AllocatePool (ExitDataSize);\r
-      if (ExitData == NULL) {\r
-        return EFI_OUT_OF_RESOURCES;\r
-      }\r
-      ExitData[0] = '\0';\r
-      // Use CopyMem to avoid alignment faults\r
-      CopyMem ((ExitData + 1), &ExitStatus, sizeof (ExitStatus));\r
-\r
-      gBS->Exit (ImageHandle, EFI_ABORTED, ExitDataSize, ExitData);\r
-\r
-      ASSERT (FALSE);\r
-      return EFI_SUCCESS;\r
-    } else {\r
-      return EFI_SUCCESS;\r
-    }\r
-  } else {\r
-    return Status;\r
+  if (ShellCommandGetExit()) {\r
+    return ((EFI_STATUS)ShellCommandGetExitCode());\r
   }\r
   }\r
+  return (Status);\r
 }\r
 \r
 /**\r
 }\r
 \r
 /**\r
@@ -986,16 +949,13 @@ ProcessCommandLine(
   @param ImagePath              the path to the image for shell.  first place to look for the startup script\r
   @param FilePath               the path to the file for shell.  second place to look for the startup script.\r
 \r
   @param ImagePath              the path to the image for shell.  first place to look for the startup script\r
   @param FilePath               the path to the file for shell.  second place to look for the startup script.\r
 \r
-  @param[out] ExitStatus      The exit code of the script. Ignored if NULL.\r
-\r
   @retval EFI_SUCCESS           the variable is initialized.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 DoStartupScript(\r
   @retval EFI_SUCCESS           the variable is initialized.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 DoStartupScript(\r
-  IN  EFI_DEVICE_PATH_PROTOCOL *ImagePath,\r
-  IN  EFI_DEVICE_PATH_PROTOCOL *FilePath,\r
-  OUT SHELL_STATUS             *ExitStatus\r
+  IN EFI_DEVICE_PATH_PROTOCOL *ImagePath,\r
+  IN EFI_DEVICE_PATH_PROTOCOL *FilePath\r
   )\r
 {\r
   EFI_STATUS                    Status;\r
   )\r
 {\r
   EFI_STATUS                    Status;\r
@@ -1030,7 +990,7 @@ DoStartupScript(
       StrnCat(FileStringPath, L" ", NewSize/sizeof(CHAR16) - StrLen(FileStringPath) -1);\r
       StrnCat(FileStringPath, ShellInfoObject.ShellInitSettings.FileOptions, NewSize/sizeof(CHAR16) - StrLen(FileStringPath) -1);\r
     }\r
       StrnCat(FileStringPath, L" ", NewSize/sizeof(CHAR16) - StrLen(FileStringPath) -1);\r
       StrnCat(FileStringPath, ShellInfoObject.ShellInitSettings.FileOptions, NewSize/sizeof(CHAR16) - StrLen(FileStringPath) -1);\r
     }\r
-    Status = RunCommand(FileStringPath, ExitStatus);\r
+    Status = RunCommand(FileStringPath);\r
     FreePool(FileStringPath);\r
     return (Status);\r
 \r
     FreePool(FileStringPath);\r
     return (Status);\r
 \r
@@ -1107,13 +1067,7 @@ DoStartupScript(
   // If we got a file, run it\r
   //\r
   if (!EFI_ERROR(Status) && FileHandle != NULL) {\r
   // If we got a file, run it\r
   //\r
   if (!EFI_ERROR(Status) && FileHandle != NULL) {\r
-    Status = RunScriptFile (\r
-              mStartupScript,\r
-              FileHandle,\r
-              L"",\r
-              ShellInfoObject.NewShellParametersProtocol,\r
-              ExitStatus\r
-              );\r
+    Status = RunScriptFile (mStartupScript, FileHandle, L"", ShellInfoObject.NewShellParametersProtocol);\r
     ShellInfoObject.NewEfiShellProtocol->CloseFile(FileHandle);\r
   } else {\r
     FileStringPath = ShellFindFilePath(mStartupScript);\r
     ShellInfoObject.NewEfiShellProtocol->CloseFile(FileHandle);\r
   } else {\r
     FileStringPath = ShellFindFilePath(mStartupScript);\r
@@ -1124,13 +1078,7 @@ DoStartupScript(
       Status = EFI_SUCCESS;\r
       ASSERT(FileHandle == NULL);\r
     } else {\r
       Status = EFI_SUCCESS;\r
       ASSERT(FileHandle == NULL);\r
     } else {\r
-      Status = RunScriptFile(\r
-                FileStringPath,\r
-                NULL,\r
-                L"",\r
-                ShellInfoObject.NewShellParametersProtocol,\r
-                ExitStatus\r
-                );\r
+      Status = RunScriptFile(FileStringPath, NULL, L"", ShellInfoObject.NewShellParametersProtocol);\r
       FreePool(FileStringPath);\r
     }\r
   }\r
       FreePool(FileStringPath);\r
     }\r
   }\r
@@ -1195,7 +1143,7 @@ DoShellPrompt (
   //\r
   if (!EFI_ERROR (Status)) {\r
     CmdLine[BufferSize / sizeof (CHAR16)] = CHAR_NULL;\r
   //\r
   if (!EFI_ERROR (Status)) {\r
     CmdLine[BufferSize / sizeof (CHAR16)] = CHAR_NULL;\r
-    Status = RunCommand(CmdLine, NULL);\r
+    Status = RunCommand(CmdLine);\r
     }\r
 \r
   //\r
     }\r
 \r
   //\r
@@ -1526,9 +1474,6 @@ ShellConvertVariables (
   @param[in] StdIn          The pointer to the Standard input.\r
   @param[in] StdOut         The pointer to the Standard output.\r
 \r
   @param[in] StdIn          The pointer to the Standard input.\r
   @param[in] StdOut         The pointer to the Standard output.\r
 \r
-  @param[out] ExitStatus      The exit code of the last command in the pipeline.\r
-                              Ignored if NULL.\r
-\r
   @retval EFI_SUCCESS       The split command is executed successfully.\r
   @retval other             Some error occurs when executing the split command.\r
 **/\r
   @retval EFI_SUCCESS       The split command is executed successfully.\r
   @retval other             Some error occurs when executing the split command.\r
 **/\r
@@ -1537,8 +1482,7 @@ EFIAPI
 RunSplitCommand(\r
   IN CONST CHAR16             *CmdLine,\r
   IN       SHELL_FILE_HANDLE  *StdIn,\r
 RunSplitCommand(\r
   IN CONST CHAR16             *CmdLine,\r
   IN       SHELL_FILE_HANDLE  *StdIn,\r
-  IN       SHELL_FILE_HANDLE  *StdOut,\r
-  OUT      SHELL_STATUS       *ExitStatus\r
+  IN       SHELL_FILE_HANDLE  *StdOut\r
   )\r
 {\r
   EFI_STATUS        Status;\r
   )\r
 {\r
   EFI_STATUS        Status;\r
@@ -1592,7 +1536,7 @@ RunSplitCommand(
   ASSERT(Split->SplitStdOut != NULL);\r
   InsertHeadList(&ShellInfoObject.SplitList.Link, &Split->Link);\r
 \r
   ASSERT(Split->SplitStdOut != NULL);\r
   InsertHeadList(&ShellInfoObject.SplitList.Link, &Split->Link);\r
 \r
-  Status = RunCommand(OurCommandLine, NULL);\r
+  Status = RunCommand(OurCommandLine);\r
 \r
   //\r
   // move the output from the first to the in to the second.\r
 \r
   //\r
   // move the output from the first to the in to the second.\r
@@ -1607,7 +1551,7 @@ RunSplitCommand(
   ShellInfoObject.NewEfiShellProtocol->SetFilePosition(ConvertShellHandleToEfiFileProtocol(Split->SplitStdIn), 0);\r
 \r
   if (!EFI_ERROR(Status)) {\r
   ShellInfoObject.NewEfiShellProtocol->SetFilePosition(ConvertShellHandleToEfiFileProtocol(Split->SplitStdIn), 0);\r
 \r
   if (!EFI_ERROR(Status)) {\r
-    Status = RunCommand(NextCommandLine, ExitStatus);\r
+    Status = RunCommand(NextCommandLine);\r
   }\r
 \r
   //\r
   }\r
 \r
   //\r
@@ -1901,9 +1845,7 @@ VerifySplit(
 /**\r
   Process a split based operation.\r
 \r
 /**\r
   Process a split based operation.\r
 \r
-  @param[in] CmdLine      Pointer to the command line to process\r
-  @param[out] ExitStatus  The exit status of the command. Ignored if NULL.\r
-                          Invalid if this function returns an error.\r
+  @param[in] CmdLine    pointer to the command line to process\r
 \r
   @retval EFI_SUCCESS   The operation was successful\r
   @return               an error occured.\r
 \r
   @retval EFI_SUCCESS   The operation was successful\r
   @return               an error occured.\r
@@ -1911,8 +1853,7 @@ VerifySplit(
 EFI_STATUS\r
 EFIAPI\r
 ProcessNewSplitCommandLine(\r
 EFI_STATUS\r
 EFIAPI\r
 ProcessNewSplitCommandLine(\r
-  IN CONST CHAR16       *CmdLine,\r
-  OUT      SHELL_STATUS *ExitStatus\r
+  IN CONST CHAR16 *CmdLine\r
   )\r
 {\r
   SPLIT_LIST                *Split;\r
   )\r
 {\r
   SPLIT_LIST                *Split;\r
@@ -1933,14 +1874,9 @@ ProcessNewSplitCommandLine(
   }\r
 \r
   if (Split == NULL) {\r
   }\r
 \r
   if (Split == NULL) {\r
-    Status = RunSplitCommand(CmdLine, NULL, NULL, ExitStatus);\r
+    Status = RunSplitCommand(CmdLine, NULL, NULL);\r
   } else {\r
   } else {\r
-    Status = RunSplitCommand(\r
-              CmdLine,\r
-              Split->SplitStdIn,\r
-              Split->SplitStdOut,\r
-              ExitStatus\r
-              );\r
+    Status = RunSplitCommand(CmdLine, Split->SplitStdIn, Split->SplitStdOut);\r
   }\r
   if (EFI_ERROR(Status)) {\r
     ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_INVALID_SPLIT), ShellInfoObject.HiiHandle, CmdLine);\r
   }\r
   if (EFI_ERROR(Status)) {\r
     ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_INVALID_SPLIT), ShellInfoObject.HiiHandle, CmdLine);\r
@@ -2120,8 +2056,6 @@ ProcessCommandLineToFinal(
   @param[in] FirstParameter   the first parameter on the command line\r
   @param[in] ParamProtocol    the shell parameters protocol pointer\r
 \r
   @param[in] FirstParameter   the first parameter on the command line\r
   @param[in] ParamProtocol    the shell parameters protocol pointer\r
 \r
-  @param[out] ExitStatus      The exit code of the command. Ignored if NULL.\r
-\r
   @retval EFI_SUCCESS     The command was completed.\r
   @retval EFI_ABORTED     The command's operation was aborted.\r
 **/\r
   @retval EFI_SUCCESS     The command was completed.\r
   @retval EFI_ABORTED     The command's operation was aborted.\r
 **/\r
@@ -2130,8 +2064,7 @@ EFIAPI
 RunInternalCommand(\r
   IN CONST CHAR16                   *CmdLine,\r
   IN       CHAR16                   *FirstParameter,\r
 RunInternalCommand(\r
   IN CONST CHAR16                   *CmdLine,\r
   IN       CHAR16                   *FirstParameter,\r
-  IN EFI_SHELL_PARAMETERS_PROTOCOL  *ParamProtocol,\r
-  OUT      SHELL_STATUS             *ExitStatus OPTIONAL\r
+  IN EFI_SHELL_PARAMETERS_PROTOCOL  *ParamProtocol\r
 )\r
 {\r
   EFI_STATUS                Status;\r
 )\r
 {\r
   EFI_STATUS                Status;\r
@@ -2171,9 +2104,6 @@ RunInternalCommand(
       if (LastError) {\r
         SetLastError(CommandReturnedStatus);\r
       }\r
       if (LastError) {\r
         SetLastError(CommandReturnedStatus);\r
       }\r
-      if (ExitStatus != NULL) {\r
-        *ExitStatus = CommandReturnedStatus;\r
-      }\r
 \r
       //\r
       // Pass thru the exitcode from the app.\r
 \r
       //\r
       // Pass thru the exitcode from the app.\r
@@ -2229,9 +2159,6 @@ RunInternalCommand(
   @param[in] FirstParameter   the first parameter on the command line\r
   @param[in] ParamProtocol    the shell parameters protocol pointer\r
 \r
   @param[in] FirstParameter   the first parameter on the command line\r
   @param[in] ParamProtocol    the shell parameters protocol pointer\r
 \r
-  @param[out] ExitStatus      The exit code of the command or file.\r
-                              Ignored if NULL.\r
-\r
   @retval EFI_SUCCESS     The command was completed.\r
   @retval EFI_ABORTED     The command's operation was aborted.\r
 **/\r
   @retval EFI_SUCCESS     The command was completed.\r
   @retval EFI_ABORTED     The command's operation was aborted.\r
 **/\r
@@ -2241,8 +2168,7 @@ RunCommandOrFile(
   IN       SHELL_OPERATION_TYPES    Type,\r
   IN CONST CHAR16                   *CmdLine,\r
   IN       CHAR16                   *FirstParameter,\r
   IN       SHELL_OPERATION_TYPES    Type,\r
   IN CONST CHAR16                   *CmdLine,\r
   IN       CHAR16                   *FirstParameter,\r
-  IN EFI_SHELL_PARAMETERS_PROTOCOL  *ParamProtocol,\r
-  OUT      SHELL_STATUS             *ExitStatus\r
+  IN EFI_SHELL_PARAMETERS_PROTOCOL  *ParamProtocol\r
 )\r
 {\r
   EFI_STATUS                Status;\r
 )\r
 {\r
   EFI_STATUS                Status;\r
@@ -2258,12 +2184,7 @@ RunCommandOrFile(
 \r
   switch (Type) {\r
     case   Internal_Command:\r
 \r
   switch (Type) {\r
     case   Internal_Command:\r
-      Status = RunInternalCommand(\r
-                CmdLine,\r
-                FirstParameter,\r
-                ParamProtocol,\r
-                &CalleeExitStatus\r
-                );\r
+      Status = RunInternalCommand(CmdLine, FirstParameter, ParamProtocol);\r
       break;\r
     case   Script_File_Name:\r
     case   Efi_Application:\r
       break;\r
     case   Script_File_Name:\r
     case   Efi_Application:\r
@@ -2298,13 +2219,7 @@ RunCommandOrFile(
       }\r
       switch (Type) {\r
         case   Script_File_Name:\r
       }\r
       switch (Type) {\r
         case   Script_File_Name:\r
-          Status = RunScriptFile (\r
-                    CommandWithPath,\r
-                    NULL,\r
-                    CmdLine,\r
-                    ParamProtocol,\r
-                    &CalleeExitStatus\r
-                    );\r
+          Status = RunScriptFile (CommandWithPath, NULL, CmdLine, ParamProtocol);\r
           break;\r
         case   Efi_Application:\r
           //\r
           break;\r
         case   Efi_Application:\r
           //\r
@@ -2324,9 +2239,7 @@ RunCommandOrFile(
             DevPath,\r
             CmdLine,\r
             NULL,\r
             DevPath,\r
             CmdLine,\r
             NULL,\r
-            &StartStatus,\r
-            NULL,\r
-            NULL\r
+            &StartStatus\r
            );\r
 \r
           SHELL_FREE_NON_NULL(DevPath);\r
            );\r
 \r
           SHELL_FREE_NON_NULL(DevPath);\r
@@ -2359,10 +2272,6 @@ RunCommandOrFile(
 \r
   SHELL_FREE_NON_NULL(CommandWithPath);\r
 \r
 \r
   SHELL_FREE_NON_NULL(CommandWithPath);\r
 \r
-  if (ExitStatus != NULL) {\r
-    *ExitStatus = CalleeExitStatus;\r
-  }\r
-\r
   return (Status);\r
 }\r
 \r
   return (Status);\r
 }\r
 \r
@@ -2374,20 +2283,16 @@ RunCommandOrFile(
   @param[in] FirstParameter   the first parameter on the command line.\r
   @param[in] ParamProtocol    the shell parameters protocol pointer\r
 \r
   @param[in] FirstParameter   the first parameter on the command line.\r
   @param[in] ParamProtocol    the shell parameters protocol pointer\r
 \r
-  @param[out] ExitStatus      The exit code of the command or file.\r
-                              Ignored if NULL.\r
-\r
   @retval EFI_SUCCESS     The command was completed.\r
   @retval EFI_ABORTED     The command's operation was aborted.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 SetupAndRunCommandOrFile(\r
   @retval EFI_SUCCESS     The command was completed.\r
   @retval EFI_ABORTED     The command's operation was aborted.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 SetupAndRunCommandOrFile(\r
-  IN   SHELL_OPERATION_TYPES          Type,\r
-  IN   CHAR16                         *CmdLine,\r
-  IN   CHAR16                         *FirstParameter,\r
-  IN   EFI_SHELL_PARAMETERS_PROTOCOL  *ParamProtocol,\r
-  OUT  SHELL_STATUS                   *ExitStatus\r
+  IN SHELL_OPERATION_TYPES          Type,\r
+  IN CHAR16                         *CmdLine,\r
+  IN CHAR16                         *FirstParameter,\r
+  IN EFI_SHELL_PARAMETERS_PROTOCOL  *ParamProtocol\r
 )\r
 {\r
   EFI_STATUS                Status;\r
 )\r
 {\r
   EFI_STATUS                Status;\r
@@ -2407,13 +2312,7 @@ SetupAndRunCommandOrFile(
   //\r
   if (!EFI_ERROR(Status)) {\r
     TrimSpaces(&CmdLine);\r
   //\r
   if (!EFI_ERROR(Status)) {\r
     TrimSpaces(&CmdLine);\r
-    Status = RunCommandOrFile(\r
-              Type,\r
-              CmdLine,\r
-              FirstParameter,\r
-              ParamProtocol,\r
-              ExitStatus\r
-              );\r
+    Status = RunCommandOrFile(Type, CmdLine, FirstParameter, ParamProtocol);\r
   }\r
 \r
   //\r
   }\r
 \r
   //\r
@@ -2438,7 +2337,6 @@ SetupAndRunCommandOrFile(
   command or dispatch an external application.\r
 \r
   @param[in] CmdLine      The command line to parse.\r
   command or dispatch an external application.\r
 \r
   @param[in] CmdLine      The command line to parse.\r
-  @param[out] ExitStatus  The exit code of the command. Ignored if NULL.\r
 \r
   @retval EFI_SUCCESS     The command was completed.\r
   @retval EFI_ABORTED     The command's operation was aborted.\r
 \r
   @retval EFI_SUCCESS     The command was completed.\r
   @retval EFI_ABORTED     The command's operation was aborted.\r
@@ -2446,8 +2344,7 @@ SetupAndRunCommandOrFile(
 EFI_STATUS\r
 EFIAPI\r
 RunCommand(\r
 EFI_STATUS\r
 EFIAPI\r
 RunCommand(\r
-  IN CONST CHAR16         *CmdLine,\r
-  OUT      SHELL_STATUS   *ExitStatus\r
+  IN CONST CHAR16   *CmdLine\r
   )\r
 {\r
   EFI_STATUS                Status;\r
   )\r
 {\r
   EFI_STATUS                Status;\r
@@ -2507,7 +2404,7 @@ RunCommand(
   // We dont do normal processing with a split command line (output from one command input to another)\r
   //\r
   if (ContainsSplit(CleanOriginal)) {\r
   // We dont do normal processing with a split command line (output from one command input to another)\r
   //\r
   if (ContainsSplit(CleanOriginal)) {\r
-    Status = ProcessNewSplitCommandLine(CleanOriginal, ExitStatus);\r
+    Status = ProcessNewSplitCommandLine(CleanOriginal);\r
     SHELL_FREE_NON_NULL(CleanOriginal);\r
     return (Status);\r
   } \r
     SHELL_FREE_NON_NULL(CleanOriginal);\r
     return (Status);\r
   } \r
@@ -2533,13 +2430,7 @@ RunCommand(
     case   Internal_Command:\r
     case   Script_File_Name:\r
     case   Efi_Application:\r
     case   Internal_Command:\r
     case   Script_File_Name:\r
     case   Efi_Application:\r
-      Status = SetupAndRunCommandOrFile(\r
-                Type,\r
-                CleanOriginal,\r
-                FirstParameter,\r
-                ShellInfoObject.NewShellParametersProtocol,\r
-                ExitStatus\r
-                );\r
+      Status = SetupAndRunCommandOrFile(Type, CleanOriginal, FirstParameter, ShellInfoObject.NewShellParametersProtocol);\r
       break;\r
     default:\r
       //\r
       break;\r
     default:\r
       //\r
@@ -2594,16 +2485,13 @@ IsValidCommandName(
   @param[in] Handle             The handle to the already opened file.\r
   @param[in] Name               The name of the script file.\r
 \r
   @param[in] Handle             The handle to the already opened file.\r
   @param[in] Name               The name of the script file.\r
 \r
-  @param[out] ExitStatus      The exit code of the script. Ignored if NULL.\r
-\r
   @retval EFI_SUCCESS           the script completed sucessfully\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 RunScriptFileHandle (\r
   @retval EFI_SUCCESS           the script completed sucessfully\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 RunScriptFileHandle (\r
-  IN  SHELL_FILE_HANDLE  Handle,\r
-  IN  CONST CHAR16       *Name,\r
-  OUT SHELL_STATUS       *ExitStatus\r
+  IN SHELL_FILE_HANDLE  Handle,\r
+  IN CONST CHAR16       *Name\r
   )\r
 {\r
   EFI_STATUS          Status;\r
   )\r
 {\r
   EFI_STATUS          Status;\r
@@ -2619,11 +2507,8 @@ RunScriptFileHandle (
   CONST CHAR16        *CurDir;\r
   UINTN               LineCount;\r
   CHAR16              LeString[50];\r
   CONST CHAR16        *CurDir;\r
   UINTN               LineCount;\r
   CHAR16              LeString[50];\r
-  SHELL_STATUS        CalleeExitStatus;\r
 \r
   ASSERT(!ShellCommandGetScriptExit());\r
 \r
   ASSERT(!ShellCommandGetScriptExit());\r
-  \r
-  CalleeExitStatus = SHELL_SUCCESS;\r
 \r
   PreScriptEchoState = ShellCommandGetEchoState();\r
 \r
 \r
   PreScriptEchoState = ShellCommandGetEchoState();\r
 \r
@@ -2809,7 +2694,7 @@ RunScriptFileHandle (
             //\r
             PreCommandEchoState = ShellCommandGetEchoState();\r
             ShellCommandSetEchoState(FALSE);\r
             //\r
             PreCommandEchoState = ShellCommandGetEchoState();\r
             ShellCommandSetEchoState(FALSE);\r
-            Status = RunCommand(CommandLine3+1, NULL);\r
+            Status = RunCommand(CommandLine3+1);\r
 \r
             //\r
             // If command was "@echo -off" or "@echo -on" then don't restore echo state\r
 \r
             //\r
             // If command was "@echo -off" or "@echo -on" then don't restore echo state\r
@@ -2831,7 +2716,7 @@ RunScriptFileHandle (
               }\r
               ShellPrintEx(-1, -1, L"%s\r\n", CommandLine2);\r
             }\r
               }\r
               ShellPrintEx(-1, -1, L"%s\r\n", CommandLine2);\r
             }\r
-            Status = RunCommand(CommandLine3, NULL);\r
+            Status = RunCommand(CommandLine3);\r
           }\r
         }\r
 \r
           }\r
         }\r
 \r
@@ -2839,8 +2724,7 @@ RunScriptFileHandle (
           //\r
           // ShellCommandGetExitCode() always returns a UINT64\r
           //\r
           //\r
           // ShellCommandGetExitCode() always returns a UINT64\r
           //\r
-          CalleeExitStatus = (SHELL_STATUS) ShellCommandGetExitCode();\r
-          UnicodeSPrint(LeString, sizeof(LeString), L"0x%Lx", CalleeExitStatus);\r
+          UnicodeSPrint(LeString, sizeof(LeString), L"0x%Lx", ShellCommandGetExitCode());\r
           DEBUG_CODE(InternalEfiShellSetEnv(L"debuglasterror", LeString, TRUE););\r
           InternalEfiShellSetEnv(L"lasterror", LeString, TRUE);\r
 \r
           DEBUG_CODE(InternalEfiShellSetEnv(L"debuglasterror", LeString, TRUE););\r
           InternalEfiShellSetEnv(L"lasterror", LeString, TRUE);\r
 \r
@@ -2852,11 +2736,9 @@ RunScriptFileHandle (
           break;\r
         }\r
         if (EFI_ERROR(Status)) {\r
           break;\r
         }\r
         if (EFI_ERROR(Status)) {\r
-          CalleeExitStatus = (SHELL_STATUS) Status;\r
           break;\r
         }\r
         if (ShellCommandGetExit()) {\r
           break;\r
         }\r
         if (ShellCommandGetExit()) {\r
-          CalleeExitStatus = (SHELL_STATUS) ShellCommandGetExitCode();\r
           break;\r
         }\r
       }\r
           break;\r
         }\r
       }\r
@@ -2888,11 +2770,6 @@ RunScriptFileHandle (
   if (ShellCommandGetCurrentScriptFile()==NULL) {\r
     ShellCommandSetEchoState(PreScriptEchoState);\r
   }\r
   if (ShellCommandGetCurrentScriptFile()==NULL) {\r
     ShellCommandSetEchoState(PreScriptEchoState);\r
   }\r
-\r
-  if (ExitStatus != NULL) {\r
-    *ExitStatus = CalleeExitStatus;\r
-  }\r
-\r
   return (EFI_SUCCESS);\r
 }\r
 \r
   return (EFI_SUCCESS);\r
 }\r
 \r
@@ -2904,18 +2781,15 @@ RunScriptFileHandle (
   @param[in] CmdLine            the command line to run.\r
   @param[in] ParamProtocol      the shell parameters protocol pointer\r
 \r
   @param[in] CmdLine            the command line to run.\r
   @param[in] ParamProtocol      the shell parameters protocol pointer\r
 \r
-  @param[out] ExitStatus      The exit code of the script. Ignored if NULL.\r
-\r
   @retval EFI_SUCCESS           the script completed sucessfully\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 RunScriptFile (\r
   @retval EFI_SUCCESS           the script completed sucessfully\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 RunScriptFile (\r
-  IN  CONST CHAR16                   *ScriptPath,\r
-  IN  SHELL_FILE_HANDLE              Handle OPTIONAL,\r
-  IN  CONST CHAR16                   *CmdLine,\r
-  IN  EFI_SHELL_PARAMETERS_PROTOCOL  *ParamProtocol,\r
-  OUT SHELL_STATUS                   *ExitStatus\r
+  IN CONST CHAR16                   *ScriptPath,\r
+  IN SHELL_FILE_HANDLE              Handle OPTIONAL,\r
+  IN CONST CHAR16                   *CmdLine,\r
+  IN EFI_SHELL_PARAMETERS_PROTOCOL  *ParamProtocol\r
   )\r
 {\r
   EFI_STATUS          Status;\r
   )\r
 {\r
   EFI_STATUS          Status;\r
@@ -2942,7 +2816,7 @@ RunScriptFile (
         //\r
         // run it\r
         //\r
         //\r
         // run it\r
         //\r
-        Status = RunScriptFileHandle(FileHandle, ScriptPath, ExitStatus);\r
+        Status = RunScriptFileHandle(FileHandle, ScriptPath);\r
 \r
         //\r
         // now close the file\r
 \r
         //\r
         // now close the file\r
@@ -2950,7 +2824,7 @@ RunScriptFile (
         ShellCloseFile(&FileHandle);\r
       }\r
     } else {\r
         ShellCloseFile(&FileHandle);\r
       }\r
     } else {\r
-      Status = RunScriptFileHandle(Handle, ScriptPath, ExitStatus);\r
+      Status = RunScriptFileHandle(Handle, ScriptPath);\r
     }\r
   }\r
 \r
     }\r
   }\r
 \r
index 57518dfd29a81565d5ba86223aa779af0beaaeac..c20ee3a803bf3c871aceee4132caaab8da202b6d 100644 (file)
@@ -231,17 +231,14 @@ ProcessCommandLine(
 \r
   @param[in] ImagePath          The path to the image for shell.  The first place to look for the startup script.\r
   @param[in] FilePath           The path to the file for shell.  The second place to look for the startup script.\r
 \r
   @param[in] ImagePath          The path to the image for shell.  The first place to look for the startup script.\r
   @param[in] FilePath           The path to the file for shell.  The second place to look for the startup script.\r
-  @param[out] ExitStatus        The exit code of the script. Ignored if NULL.\r
-                                Invalid when this function returns an error.\r
 \r
   @retval EFI_SUCCESS           The variable is initialized.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 DoStartupScript(\r
 \r
   @retval EFI_SUCCESS           The variable is initialized.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 DoStartupScript(\r
-  IN  EFI_DEVICE_PATH_PROTOCOL *ImagePath,\r
-  IN  EFI_DEVICE_PATH_PROTOCOL *FilePath,\r
-  OUT SHELL_STATUS             *ExitStatus\r
+  IN EFI_DEVICE_PATH_PROTOCOL *ImagePath,\r
+  IN EFI_DEVICE_PATH_PROTOCOL *FilePath\r
   );\r
 \r
 /**\r
   );\r
 \r
 /**\r
@@ -286,8 +283,7 @@ AddLineToCommandHistory(
 \r
   This will determine if the command line represents an internal shell command or dispatch an external application.\r
 \r
 \r
   This will determine if the command line represents an internal shell command or dispatch an external application.\r
 \r
-  @param[in]  CmdLine     the command line to parse\r
-  @param[out] ExitStatus  The exit status of the command. Ignored if NULL.\r
+  @param[in] CmdLine  the command line to parse\r
 \r
   @retval EFI_SUCCESS     the command was completed\r
   @retval EFI_ABORTED     the command's operation was aborted\r
 \r
   @retval EFI_SUCCESS     the command was completed\r
   @retval EFI_ABORTED     the command's operation was aborted\r
@@ -295,8 +291,7 @@ AddLineToCommandHistory(
 EFI_STATUS\r
 EFIAPI\r
 RunCommand(\r
 EFI_STATUS\r
 EFIAPI\r
 RunCommand(\r
-  IN  CONST CHAR16         *CmdLine,\r
-  OUT       SHELL_STATUS   *ExitStatus\r
+  IN CONST CHAR16   *CmdLine\r
   );\r
 \r
 /**\r
   );\r
 \r
 /**\r
@@ -320,17 +315,13 @@ IsValidCommandName(
   @param[in] Handle             The handle to the already opened file.\r
   @param[in] Name               The name of the script file.\r
 \r
   @param[in] Handle             The handle to the already opened file.\r
   @param[in] Name               The name of the script file.\r
 \r
-  @param[out] ExitStatus      The exit code of the script. Ignored if NULL.\r
-                              Invalid when this function returns an error.\r
-\r
   @retval EFI_SUCCESS           the script completed sucessfully\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 RunScriptFileHandle (\r
   @retval EFI_SUCCESS           the script completed sucessfully\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 RunScriptFileHandle (\r
-  IN  SHELL_FILE_HANDLE  Handle,\r
-  IN  CONST CHAR16       *Name,\r
-  OUT SHELL_STATUS       *ExitStatus\r
+  IN SHELL_FILE_HANDLE  Handle,\r
+  IN CONST CHAR16       *Name\r
   );\r
 \r
 /**\r
   );\r
 \r
 /**\r
@@ -341,20 +332,17 @@ RunScriptFileHandle (
   @param[in] CmdLine            the command line to run.\r
   @param[in] ParamProtocol      the shell parameters protocol pointer\r
 \r
   @param[in] CmdLine            the command line to run.\r
   @param[in] ParamProtocol      the shell parameters protocol pointer\r
 \r
-  @param[out] ExitStatus      The exit code of the script. Ignored if NULL.\r
-                              Invalid when this function returns an error.\r
-\r
   @retval EFI_SUCCESS           the script completed sucessfully\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 RunScriptFile (\r
   @retval EFI_SUCCESS           the script completed sucessfully\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 RunScriptFile (\r
-  IN  CONST CHAR16                   *ScriptPath,\r
-  IN  SHELL_FILE_HANDLE              Handle OPTIONAL,\r
-  IN  CONST CHAR16                   *CmdLine,\r
-  IN  EFI_SHELL_PARAMETERS_PROTOCOL  *ParamProtocol,\r
-  OUT SHELL_STATUS                   *ExitStatus\r
+  IN CONST CHAR16                   *ScriptPath,\r
+  IN SHELL_FILE_HANDLE              Handle OPTIONAL,\r
+  IN CONST CHAR16                   *CmdLine,\r
+  IN EFI_SHELL_PARAMETERS_PROTOCOL  *ParamProtocol\r
   );\r
 \r
   );\r
 \r
+\r
 #endif //_SHELL_INTERNAL_HEADER_\r
 \r
 #endif //_SHELL_INTERNAL_HEADER_\r
 \r
index 11f5d481f9b0f19e61eb240859eeed5490dd6252..b0303962ff6939cb3771452973b6c537360aba74 100644 (file)
@@ -1401,8 +1401,6 @@ EfiShellEnablePageBreak (
                                 is NULL, then the current shell environment is used.\r
                             \r
   @param[out] StartImageStatus  Returned status from gBS->StartImage.\r
                                 is NULL, then the current shell environment is used.\r
                             \r
   @param[out] StartImageStatus  Returned status from gBS->StartImage.\r
-  @param[out] ExitDataSize      ExitDataSize as returned from gBS->StartImage\r
-  @param[out] ExitData          ExitData as returned from gBS->StartImage\r
 \r
   @retval EFI_SUCCESS       The command executed successfully. The  status code\r
                             returned by the command is pointed to by StatusCode.\r
 \r
   @retval EFI_SUCCESS       The command executed successfully. The  status code\r
                             returned by the command is pointed to by StatusCode.\r
@@ -1417,9 +1415,7 @@ InternalShellExecuteDevicePath(
   IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
   IN CONST CHAR16                   *CommandLine OPTIONAL,\r
   IN CONST CHAR16                   **Environment OPTIONAL,\r
   IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
   IN CONST CHAR16                   *CommandLine OPTIONAL,\r
   IN CONST CHAR16                   **Environment OPTIONAL,\r
-  OUT EFI_STATUS                    *StartImageStatus OPTIONAL,\r
-  OUT UINTN                         *ExitDataSize OPTIONAL,\r
-  OUT CHAR16                        **ExitData OPTIONAL\r
+  OUT EFI_STATUS                    *StartImageStatus OPTIONAL\r
   )\r
 {\r
   EFI_STATUS                    Status;\r
   )\r
 {\r
   EFI_STATUS                    Status;\r
@@ -1429,21 +1425,11 @@ InternalShellExecuteDevicePath(
   EFI_LOADED_IMAGE_PROTOCOL     *LoadedImage;\r
   LIST_ENTRY                    OrigEnvs;\r
   EFI_SHELL_PARAMETERS_PROTOCOL ShellParamsProtocol;\r
   EFI_LOADED_IMAGE_PROTOCOL     *LoadedImage;\r
   LIST_ENTRY                    OrigEnvs;\r
   EFI_SHELL_PARAMETERS_PROTOCOL ShellParamsProtocol;\r
-  UINTN                         InternalExitDataSize;\r
-  UINTN                         *ExitDataSizePtr;\r
   CHAR16                        *ImagePath;\r
   UINTN                         Index;\r
   CHAR16                        *Walker;\r
   CHAR16                        *NewCmdLine;\r
 \r
   CHAR16                        *ImagePath;\r
   UINTN                         Index;\r
   CHAR16                        *Walker;\r
   CHAR16                        *NewCmdLine;\r
 \r
-  // ExitDataSize is not OPTIONAL for gBS->BootServices, provide somewhere for\r
-  // it to be dumped if the caller doesn't want it.\r
-  if (ExitData == NULL) {\r
-    ExitDataSizePtr = &InternalExitDataSize;\r
-  } else {\r
-    ExitDataSizePtr = ExitDataSize;\r
-  }\r
-\r
   if (ParentImageHandle == NULL) {\r
     return (EFI_INVALID_PARAMETER);\r
   }\r
   if (ParentImageHandle == NULL) {\r
     return (EFI_INVALID_PARAMETER);\r
   }\r
@@ -1547,13 +1533,13 @@ InternalShellExecuteDevicePath(
     ///@todo initialize and install ShellInterface protocol on the new image for compatibility if - PcdGetBool(PcdShellSupportOldProtocols)\r
 \r
     //\r
     ///@todo initialize and install ShellInterface protocol on the new image for compatibility if - PcdGetBool(PcdShellSupportOldProtocols)\r
 \r
     //\r
-    // now start the image, passing up exit data if the caller requested it\r
+    // now start the image and if the caller wanted the return code pass it to them...\r
     //\r
     if (!EFI_ERROR(Status)) {\r
       StartStatus      = gBS->StartImage(\r
                           NewHandle,\r
     //\r
     if (!EFI_ERROR(Status)) {\r
       StartStatus      = gBS->StartImage(\r
                           NewHandle,\r
-                          ExitDataSizePtr,\r
-                          ExitData\r
+                          0,\r
+                          NULL\r
                           );\r
       if (StartImageStatus != NULL) {\r
         *StartImageStatus = StartStatus;\r
                           );\r
       if (StartImageStatus != NULL) {\r
         *StartImageStatus = StartStatus;\r
@@ -1642,8 +1628,6 @@ EfiShellExecute(
   CHAR16                    *Temp;\r
   EFI_DEVICE_PATH_PROTOCOL  *DevPath;\r
   UINTN                     Size;\r
   CHAR16                    *Temp;\r
   EFI_DEVICE_PATH_PROTOCOL  *DevPath;\r
   UINTN                     Size;\r
-  UINTN                     ExitDataSize;\r
-  CHAR16                    *ExitData;\r
 \r
   if ((PcdGet8(PcdShellSupportLevel) < 1)) {\r
     return (EFI_UNSUPPORTED);\r
 \r
   if ((PcdGet8(PcdShellSupportLevel) < 1)) {\r
     return (EFI_UNSUPPORTED);\r
@@ -1671,32 +1655,7 @@ EfiShellExecute(
     DevPath,\r
     Temp,\r
     (CONST CHAR16**)Environment,\r
     DevPath,\r
     Temp,\r
     (CONST CHAR16**)Environment,\r
-    StatusCode,\r
-    &ExitDataSize,\r
-    &ExitData);\r
-\r
-    if (Status == EFI_ABORTED) {\r
-      // If the command exited with an error, the shell should put the exit\r
-      // status in ExitData, preceded by a null-terminated string.\r
-      ASSERT (ExitDataSize == StrSize (ExitData) + sizeof (SHELL_STATUS));\r
-\r
-      if (StatusCode != NULL) {\r
-        // Skip the null-terminated string\r
-        ExitData += StrLen (ExitData) + 1;\r
-\r
-        // Use CopyMem to avoid alignment faults\r
-        CopyMem (StatusCode, ExitData, sizeof (SHELL_STATUS));\r
-\r
-        // Convert from SHELL_STATUS to EFI_STATUS\r
-        // EFI_STATUSes have top bit set when they are errors.\r
-        // (See UEFI Spec Appendix D)\r
-        if (*StatusCode != SHELL_SUCCESS) {\r
-          *StatusCode = (EFI_STATUS) *StatusCode | MAX_BIT;\r
-        }\r
-      }\r
-      FreePool (ExitData);\r
-      Status = EFI_SUCCESS;\r
-    }\r
+    StatusCode);\r
 \r
   //\r
   // de-allocate and return\r
 \r
   //\r
   // de-allocate and return\r
index 16e3718e61f448b060c7e43efcb1a827a33b864b..023ec1278976a11cb9c9fd5cc1d61d90274418b6 100644 (file)
@@ -445,8 +445,6 @@ EfiShellEnablePageBreak (
                                 environment variable name and y is the value. If this\r
                                 is NULL, then the current shell environment is used.\r
   @param[out] StartImageStatus  Returned status from gBS->StartImage.\r
                                 environment variable name and y is the value. If this\r
                                 is NULL, then the current shell environment is used.\r
   @param[out] StartImageStatus  Returned status from gBS->StartImage.\r
-  @param[out] ExitDataSize      ExitDataSize as returned from gBS->StartImage\r
-  @param[out] ExitData          ExitData as returned from gBS->StartImage\r
 \r
   @retval EFI_SUCCESS       The command executed successfully. The  status code\r
                             returned by the command is pointed to by StatusCode.\r
 \r
   @retval EFI_SUCCESS       The command executed successfully. The  status code\r
                             returned by the command is pointed to by StatusCode.\r
@@ -461,9 +459,7 @@ InternalShellExecuteDevicePath(
   IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
   IN CONST CHAR16                   *CommandLine OPTIONAL,\r
   IN CONST CHAR16                   **Environment OPTIONAL,\r
   IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
   IN CONST CHAR16                   *CommandLine OPTIONAL,\r
   IN CONST CHAR16                   **Environment OPTIONAL,\r
-  OUT EFI_STATUS                    *StartImageStatus OPTIONAL,\r
-  OUT UINTN                         *ExitDataSize OPTIONAL,\r
-  OUT CHAR16                        **ExitData OPTIONAL\r
+  OUT EFI_STATUS                    *StartImageStatus OPTIONAL\r
   );\r
 \r
 /**\r
   );\r
 \r
 /**\r