Jeff,

My current implementation starts earlier in PEI Core flow and was using the 
call back function to allocate memory on the stack. Your example is quite a bit 
father into PEI Core init. I modeled after DXE Core location, but I can't use a 
global like in DXE, so I think I need the callback and a 2nd call when memory 
is discovered.

I'm also worried that the debugger does not shutdown properly prior to 
switching IDTs in the DXE IPL. I'm also worried about the S3 path too. So I 
think we need a defined way to shutdown the debugger prior changing the IDT. 
Maybe this could be a generic call for all phases.

I'm starting to think we need a 3rd API to shutdown the debugger. I'm worried 
that if we start adding InitializeDebugAgent() to more modules we will end up 
with multiple modules pulling chunks of the debugger that they do not need. 
This would be caused by the case statement in 
InitializeDebugAgent() pulling in all parts of the debugger. Note it would be 
possible to make extra instances of the debug agent libs to handle this case.


Sent from my iPad

On Aug 27, 2012, at 10:40 PM, "Fan, Jeff" <[email protected]> wrote:

> Andrew,
>  
> We have defined one InitFlag DEBUG_AGENT_INIT_PEI, which could be used by one 
> PEI module to initialize Debug Agent. I think it also could be used by PEI 
> Core.
>  
> For example,
> It could be invoked in PEI Core at below,
>   //
>   // Initialize PEI Core Services
>   // 
>   InitializeMemoryServices   (&PrivateData,    SecCoreData, OldCoreData);
>   InitializePpiServices      (&PrivateData,    OldCoreData);
>  
>   InitializeDebugAgent (DEBUG_AGENT_INIT_PEI, NULL, NULL);
>  
> Debug Agent Library instance could initialize Debug Agent and use HOB service 
> to save some private contents. HOB services will be consistence before/after 
> physical memory is ready.
> Debug Agent Library instance also could register one PPI callback function on 
> gEfiPeiMemoryDiscoveredPpiGuid, to send memory ready packet to HOST when 
> memory is ready.
>  
> Does it meet your requirement?
>  
> Now I think DEBUG_AGENT_INIT_PEI_POSTMEM is not needed. If you encountered 
> some issue when enabling Debug Agent in PEI Core module, we could revisit 
> this flag at that time.
>  
> Thanks!
> Jeff
>  
> From: Andrew Fish [mailto:[email protected]] 
> Sent: Tuesday, August 28, 2012 2:45 AM
> To: [email protected]
> Subject: Re: [edk2] DebugAgentLib question
>  
> Jeff, 
>  
> Since we need to add an InitFlag, can we also add 
> DEBUG_AGENT_INIT_PEI_POSTMEM?
>  
> The code base does not seem to offer the option of having the debugger be 
> part of the PEI Core, which I think is a design bug. I could envision system 
> architectures where it is not wise to have a debugger integrated into the 
> SEcurity Core, but a debugger for PEI is till wanted. So I think the PEI Core 
> should have InitializeDebugagent() calls for DEBUG_AGENT_INIT_PEI, and 
> DEBUG_AGENT_INIT_PEI_POSTMEM.
>  
> Thanks,
>  
> Andrew Fish
>  
>  
> 
> 
>  
> On Aug 27, 2012, at 1:15 AM, Fan, Jeff wrote:
> 
> 
> Andrew,
>  
> Good catch! Now, only Debug Timer interrupt was disabled before hand-off to 
> OS. 
>  
> Besides Debug Registers, we also need to think how to clear the soft break 
> points set by WinDbg or GDB in runtime services or in SMM code. One new 
> InitFlag could be introduced to help HOST debugger to clear such break points 
> if needed.
>  
> Jeff
> From: Andrew Fish [mailto:[email protected]] 
> Sent: Saturday, August 25, 2012 3:01 AM
> To: [email protected]
> Subject: [edk2] DebugAgentLib question
>  
> #define DEBUG_AGENT_INIT_PREMEM_SEC      1
> #define DEBUG_AGENT_INIT_POSTMEM_SEC     2
> #define DEBUG_AGENT_INIT_DXE_CORE        3
> #define DEBUG_AGENT_INIT_SMM             4
> #define DEBUG_AGENT_INIT_ENTER_SMI       5
> #define DEBUG_AGENT_INIT_EXIT_SMI        6
> #define DEBUG_AGENT_INIT_S3              7
> #define DEBUG_AGENT_INIT_DXE_AP          8
> #define DEBUG_AGENT_INIT_PEI             9
> #define DEBUG_AGENT_INIT_DXE_LOAD       10
> #define DEBUG_AGENT_INIT_DXE_UNLOAD     11
>  
> I was looking for a InitializeDebugAgent() InitFlag to turn off the debugger 
> on boot? I was worried that if debug register were active when the OS boots 
> that may cause an issue. Is it safe to assume the OS would clear debug 
> registers prior to switching over the IDT? That seems to be implied by this 
> interface?
>  
> Andrew Fish
>  
> https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/MdeModulePkg/Include/Library/DebugAgentLib.h
>  
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. 
> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
> edk2-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>  
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> edk2-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to