]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SourceLevelDebugPkg: Fix PEI timer interrupt regression
authorBrian J. Johnson <bjohnson@sgi.com>
Thu, 9 Jul 2015 02:29:58 +0000 (02:29 +0000)
committervanjeff <vanjeff@Edk2>
Thu, 9 Jul 2015 02:29:58 +0000 (02:29 +0000)
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 <bjohnson@sgi.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17893 6f19259b-4bc3-4df7-8a09-765794883524

SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c

index ea757423d13f9c1244cee5c7793e75a9315873b8..09216c20fe8239fee72bf7bbe50ddc95468794f9 100644 (file)
@@ -612,9 +612,11 @@ InitializeDebugAgent (
   }\r
 \r
   //\r
-  // Enable Debug Timer interrupt\r
+  // Enable Debug Timer interrupt. In post-memory SEC, the caller enables it.\r
   //\r
-  SaveAndSetDebugTimerInterrupt (TRUE);\r
+  if (InitFlag != DEBUG_AGENT_INIT_POSTMEM_SEC) {\r
+    SaveAndSetDebugTimerInterrupt (TRUE);\r
+  }\r
   //\r
   // Enable CPU interrupts so debug timer interrupts can be delivered\r
   //\r