Revision: 17893
          http://sourceforge.net/p/edk2/code/17893
Author:   vanjeff
Date:     2015-07-09 02:29:58 +0000 (Thu, 09 Jul 2015)
Log Message:
-----------
SourceLevelDebugPkg: Fix PEI timer interrupt regression

Recent changes to debug timer initialization (commit 2befbc82, svn 17572)
modified the Sec/Pei InitializeDebugAgent() routine to enable debug timer
interrupts.  This causes problems in the DEBUG_AGENT_INIT_POSTMEM_SEC case:
the callers appear to assume that if they block timer interrupts before the
call, interrupts will remain blocked afterwards.

It is not always safe to have interrupts enabled on return from
InitializeDebugAgent().  For instance, after calling InitializeDebugAgent(),
OvmfPkg's TemporaryRamMigration() moves the stack, heap, and IDT to RAM, then
switches to the new stack.  Only then does it reenable timer interrupts.
Taking an interrupt during this process can corrupt state, causing crashes.

Do not unmask the debug timer interrupt in the DEBUG_AGENT_INIT_POSTMEM_SEC
case.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brian J. Johnson <[email protected]>
Reviewed-by: Jeff Fan <[email protected]>

Modified Paths:
--------------
    
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c

Modified: 
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c
===================================================================
--- 
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c
    2015-07-09 01:54:38 UTC (rev 17892)
+++ 
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c
    2015-07-09 02:29:58 UTC (rev 17893)
@@ -612,9 +612,11 @@
   }
 
   //
-  // Enable Debug Timer interrupt
+  // Enable Debug Timer interrupt. In post-memory SEC, the caller enables it.
   //
-  SaveAndSetDebugTimerInterrupt (TRUE);
+  if (InitFlag != DEBUG_AGENT_INIT_POSTMEM_SEC) {
+    SaveAndSetDebugTimerInterrupt (TRUE);
+  }
   //
   // Enable CPU interrupts so debug timer interrupts can be delivered
   //


------------------------------------------------------------------------------
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-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to