Discussion:
[edk2] Apparent timer bug in SourceLevelDebugPkg
Brian J. Johnson
2015-07-01 18:27:36 UTC
Permalink
SourceLevelDebugPkg maintainers,

I noticed what looks like a regression in the SecPeiDebugAgentLib.
InitializeDebugAgent() calls SaveAndSetDebugTimerInterrupt() before a
normal return, but it is not called when execution continues via
InitializeDebugAgentPhase2(), as in the DEBUG_AGENT_INIT_PREMEM_SEC
case. The result is that debug timer interrupts are not enabled in PEI,
so it's impossible to stop execution via the debugger.

A fix is to add a call to SaveAndSetDebugTimerInterrupt() in
InitializeDebugAgentPhase2(), like the one near the end of
InitializeDebugAgent():

diff --git
a/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c
b/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c
index fcc7a4b..ea75742 100644
---
a/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c
+++
b/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c
@@ -684,6 +684,10 @@ InitializeDebugAgentPhase2 (
TriggerSoftInterrupt (MEMORY_READY_SIGNATURE);
}
//
+ // Enable Debug Timer interrupt
+ //
+ SaveAndSetDebugTimerInterrupt (TRUE);
+ //
// Enable CPU interrupts so debug timer interrupts can be delivered
//
EnableInterrupts ();

I haven't tried this fix with the stock SourceLevelDebugPkg, but it
works well in a customized version we use internally.

Thanks,
--
Brian J. Johnson

--------------------------------------------------------------------

My statements are my own, are not authorized by SGI, and do not
necessarily represent SGI’s positions.
Fan, Jeff
2015-07-02 03:20:16 UTC
Permalink
Johnson,

Thanks your fix. I verified it in SourceLevelDebugPkg, it works well.

Could you re-send the patch after refined the commit log format to add TianoCore Contribution Agreement and Signed-off-by section?

Thanks!
Jeff
-----Original Message-----
From: Brian J. Johnson [mailto:***@sgi.com]
Sent: Thursday, July 02, 2015 2:28 AM
To: edk2-***@lists.sourceforge.net; Fan, Jeff
Subject: [edk2] Apparent timer bug in SourceLevelDebugPkg

SourceLevelDebugPkg maintainers,

I noticed what looks like a regression in the SecPeiDebugAgentLib.
InitializeDebugAgent() calls SaveAndSetDebugTimerInterrupt() before a normal return, but it is not called when execution continues via InitializeDebugAgentPhase2(), as in the DEBUG_AGENT_INIT_PREMEM_SEC case. The result is that debug timer interrupts are not enabled in PEI, so it's impossible to stop execution via the debugger.

A fix is to add a call to SaveAndSetDebugTimerInterrupt() in InitializeDebugAgentPhase2(), like the one near the end of
InitializeDebugAgent():

diff --git
a/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c
b/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c
index fcc7a4b..ea75742 100644
---
a/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c
+++
b/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c
@@ -684,6 +684,10 @@ InitializeDebugAgentPhase2 (
TriggerSoftInterrupt (MEMORY_READY_SIGNATURE);
}
//
+ // Enable Debug Timer interrupt
+ //
+ SaveAndSetDebugTimerInterrupt (TRUE);
+ //
// Enable CPU interrupts so debug timer interrupts can be delivered
//
EnableInterrupts ();

I haven't tried this fix with the stock SourceLevelDebugPkg, but it works well in a customized version we use internally.

Thanks,
--

Brian J. Johnson

--------------------------------------------------------------------

My statements are my own, are not authorized by SGI, and do not
necessarily represent SGI’s positions.

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
edk2-devel mailing list
edk2-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Loading...