[edk2] [PATCH] UefiCpuPkg/SecMain: Add NORETURN decorator to SecStartup().

Marvin Häuser posted 1 patch 6 years, 1 month ago
Failed in applying to current master (apply log)
UefiCpuPkg/SecCore/SecMain.c | 6 ++++++
UefiCpuPkg/SecCore/SecMain.h | 1 +
2 files changed, 7 insertions(+)
[edk2] [PATCH] UefiCpuPkg/SecMain: Add NORETURN decorator to SecStartup().
Posted by Marvin Häuser 6 years, 1 month ago
The function SecStartup() is not supposed to return. Hence, add the
NORETURN decorator.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com>
---
 UefiCpuPkg/SecCore/SecMain.c | 6 ++++++
 UefiCpuPkg/SecCore/SecMain.h | 1 +
 2 files changed, 7 insertions(+)

diff --git a/UefiCpuPkg/SecCore/SecMain.c b/UefiCpuPkg/SecCore/SecMain.c
index c241d3704af7..6f9db0584ce1 100644
--- a/UefiCpuPkg/SecCore/SecMain.c
+++ b/UefiCpuPkg/SecCore/SecMain.c
@@ -113,6 +113,7 @@ SecPerformancePpiCallBack (
   @param BootFirmwareVolume  Base address of the Boot Firmware Volume.
 **/
 VOID
+NORETURN
 EFIAPI
 SecStartup (
   IN UINT32                   SizeOfRam,
@@ -201,6 +202,11 @@ SecStartup (
   // Initialize Debug Agent to support source level debug in SEC/PEI phases before memory ready.
   //
   InitializeDebugAgent (DEBUG_AGENT_INIT_PREMEM_SEC, &SecCoreData, SecStartupPhase2);
+
+  //
+  // Should not come here.
+  //
+  UNREACHABLE ();
 }
 
 /**
diff --git a/UefiCpuPkg/SecCore/SecMain.h b/UefiCpuPkg/SecCore/SecMain.h
index 46c7d41c6e3e..42a5718cfdd5 100644
--- a/UefiCpuPkg/SecCore/SecMain.h
+++ b/UefiCpuPkg/SecCore/SecMain.h
@@ -76,6 +76,7 @@ SecTemporaryRamDone (
   @param BootFirmwareVolume  Base address of the Boot Firmware Volume.
 **/
 VOID
+NORETURN
 EFIAPI
 SecStartup (
   IN UINT32                   SizeOfRam,
-- 
2.16.0.windows.2

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] UefiCpuPkg/SecMain: Add NORETURN decorator to SecStartup().
Posted by Laszlo Ersek 6 years, 1 month ago
On 02/27/18 17:50, Marvin Häuser wrote:
> The function SecStartup() is not supposed to return. Hence, add the
> NORETURN decorator.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com>
> ---
>  UefiCpuPkg/SecCore/SecMain.c | 6 ++++++
>  UefiCpuPkg/SecCore/SecMain.h | 1 +
>  2 files changed, 7 insertions(+)
> 
> diff --git a/UefiCpuPkg/SecCore/SecMain.c b/UefiCpuPkg/SecCore/SecMain.c
> index c241d3704af7..6f9db0584ce1 100644
> --- a/UefiCpuPkg/SecCore/SecMain.c
> +++ b/UefiCpuPkg/SecCore/SecMain.c
> @@ -113,6 +113,7 @@ SecPerformancePpiCallBack (
>    @param BootFirmwareVolume  Base address of the Boot Firmware Volume.
>  **/
>  VOID
> +NORETURN
>  EFIAPI
>  SecStartup (
>    IN UINT32                   SizeOfRam,
> @@ -201,6 +202,11 @@ SecStartup (
>    // Initialize Debug Agent to support source level debug in SEC/PEI phases before memory ready.
>    //
>    InitializeDebugAgent (DEBUG_AGENT_INIT_PREMEM_SEC, &SecCoreData, SecStartupPhase2);
> +
> +  //
> +  // Should not come here.
> +  //
> +  UNREACHABLE ();
>  }
>  
>  /**
> diff --git a/UefiCpuPkg/SecCore/SecMain.h b/UefiCpuPkg/SecCore/SecMain.h
> index 46c7d41c6e3e..42a5718cfdd5 100644
> --- a/UefiCpuPkg/SecCore/SecMain.h
> +++ b/UefiCpuPkg/SecCore/SecMain.h
> @@ -76,6 +76,7 @@ SecTemporaryRamDone (
>    @param BootFirmwareVolume  Base address of the Boot Firmware Volume.
>  **/
>  VOID
> +NORETURN
>  EFIAPI
>  SecStartup (
>    IN UINT32                   SizeOfRam,
> 

I checked the NORETURN and UNREACHABLE() macros in
"MdePkg/Include/Base.h", and also the InitializeDebugAgent() API. I
think the patch is correct.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>

Thanks
Laszlo
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel