public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [MdeModulePkg/PeiCore] How is Data being NULL on entry ensured?
@ 2016-08-13  2:01 Marvin H?user
  2016-08-13  2:47 ` Andrew Fish
  0 siblings, 1 reply; 3+ messages in thread
From: Marvin H?user @ 2016-08-13  2:01 UTC (permalink / raw)
  To: edk2-devel@lists.01.org

Dear list subscribers,

I have just been looking around the PeiCore code and wondered, how it is ensured, that the third ("Data") argument of the entry point is NULL on the first run.
EFI_PEI_CORE_ENTRY_POINT only has two arguments and hence most SEC implementations, including MdeModulePkg/SecCore, are going to pass only the first two arguments to the entry point.
I'm aware that the code works and I have never seen an occasion of it failing or seeming to fail because of this design, though I wondered, how is it assured, that the third argument, which is not part of the first call, is being NULL on entry and not some leftover on the temporary stack/in the argument 3 register?

Thank you for your time!

Regards,
Marvin.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [MdeModulePkg/PeiCore] How is Data being NULL on entry ensured?
  2016-08-13  2:01 [MdeModulePkg/PeiCore] How is Data being NULL on entry ensured? Marvin H?user
@ 2016-08-13  2:47 ` Andrew Fish
  2016-08-13  2:53   ` Marvin H?user
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Fish @ 2016-08-13  2:47 UTC (permalink / raw)
  To: Marvin H?user; +Cc: edk2-devel@lists.01.org


> On Aug 12, 2016, at 7:01 PM, Marvin H?user <Marvin.Haeuser@outlook.com> wrote:
> 
> Dear list subscribers,
> 
> I have just been looking around the PeiCore code and wondered, how it is ensured, that the third ("Data") argument of the entry point is NULL on the first run.
> EFI_PEI_CORE_ENTRY_POINT only has two arguments and hence most SEC implementations, including MdeModulePkg/SecCore, are going to pass only the first two arguments to the entry point.
> I'm aware that the code works and I have never seen an occasion of it failing or seeming to fail because of this design, though I wondered, how is it assured, that the third argument, which is not part of the first call, is being NULL on entry and not some leftover on the temporary stack/in the argument 3 register?
> 

Marvin,

The code you are looking for is in the entry point library. 

https://github.com/tianocore/edk2/blob/master/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.c#L59

**/
VOID
EFIAPI 
_ModuleEntryPoint(
  IN CONST  EFI_SEC_PEI_HAND_OFF    *SecCoreData,
  IN CONST  EFI_PEI_PPI_DESCRIPTOR  *PpiList
)
{
  ProcessModuleEntryPointList (SecCoreData, PpiList, NULL);
  
  //
  // Should never return
  //
  ASSERT(FALSE);
  CpuDeadLoop ();  
}


ProcessModuleEntryPointList() call is auto-generated and it will cal the entry point listed in the PEI Core INF file. So that is why it is hard to grep for. 

Thanks,

Andrew Fish

> Thank you for your time!
> 
> Regards,
> Marvin.
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [MdeModulePkg/PeiCore] How is Data being NULL on entry ensured?
  2016-08-13  2:47 ` Andrew Fish
@ 2016-08-13  2:53   ` Marvin H?user
  0 siblings, 0 replies; 3+ messages in thread
From: Marvin H?user @ 2016-08-13  2:53 UTC (permalink / raw)
  To: edk2-devel@lists.01.org; +Cc: afish@apple.com

Hey Andrew,

Thank you very much! I suppose I was misguided by the ENTRY_POINT property being PeiCore in the build file.

Regards,
Marvin.

> -----Original Message-----
> From: afish@apple.com [mailto:afish@apple.com]
> Sent: Saturday, August 13, 2016 4:47 AM
> To: Marvin H?user <Marvin.Haeuser@outlook.com>
> Cc: edk2-devel@lists.01.org
> Subject: Re: [edk2] [MdeModulePkg/PeiCore] How is Data being NULL on
> entry ensured?
> 
> 
> > On Aug 12, 2016, at 7:01 PM, Marvin H?user
> <Marvin.Haeuser@outlook.com> wrote:
> >
> > Dear list subscribers,
> >
> > I have just been looking around the PeiCore code and wondered, how it is
> ensured, that the third ("Data") argument of the entry point is NULL on the
> first run.
> > EFI_PEI_CORE_ENTRY_POINT only has two arguments and hence most SEC
> implementations, including MdeModulePkg/SecCore, are going to pass only
> the first two arguments to the entry point.
> > I'm aware that the code works and I have never seen an occasion of it
> failing or seeming to fail because of this design, though I wondered, how is it
> assured, that the third argument, which is not part of the first call, is being
> NULL on entry and not some leftover on the temporary stack/in the
> argument 3 register?
> >
> 
> Marvin,
> 
> The code you are looking for is in the entry point library.
> 
> https://github.com/tianocore/edk2/blob/master/MdePkg/Library/PeiCoreE
> ntryPoint/PeiCoreEntryPoint.c#L59
> 
> **/
> VOID
> EFIAPI
> _ModuleEntryPoint(
>   IN CONST  EFI_SEC_PEI_HAND_OFF    *SecCoreData,
>   IN CONST  EFI_PEI_PPI_DESCRIPTOR  *PpiList
> )
> {
>   ProcessModuleEntryPointList (SecCoreData, PpiList, NULL);
> 
>   //
>   // Should never return
>   //
>   ASSERT(FALSE);
>   CpuDeadLoop ();
> }
> 
> 
> ProcessModuleEntryPointList() call is auto-generated and it will cal the entry
> point listed in the PEI Core INF file. So that is why it is hard to grep for.
> 
> Thanks,
> 
> Andrew Fish
> 
> > Thank you for your time!
> >
> > Regards,
> > Marvin.
> > _______________________________________________
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-08-13  2:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-13  2:01 [MdeModulePkg/PeiCore] How is Data being NULL on entry ensured? Marvin H?user
2016-08-13  2:47 ` Andrew Fish
2016-08-13  2:53   ` Marvin H?user

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox