]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Make these drivers more compatible with a projected Debug Agent Library implementation.
authorandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 5 Mar 2010 00:57:07 +0000 (00:57 +0000)
committerandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 5 Mar 2010 00:57:07 +0000 (00:57 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10196 6f19259b-4bc3-4df7-8a09-765794883524

ArmPkg/Drivers/CpuDxe/Exception.c
Omap35xxPkg/InterruptDxe/HardwareInterrupt.c

index e313cf3fe97034e0c8d47f30f22586a4eecb4361..d99d3d1d01d16fd12338cc8d3e2e8c75c16b9ea4 100644 (file)
@@ -180,6 +180,7 @@ InitializeExceptions (
   UINTN                Index;\r
   BOOLEAN              Enabled;\r
   EFI_PHYSICAL_ADDRESS Base;\r
+  UINT32               *VectorBase;\r
 \r
   //\r
   // Disable interrupts\r
@@ -187,16 +188,6 @@ InitializeExceptions (
   Cpu->GetInterruptState (Cpu, &Enabled);\r
   Cpu->DisableInterrupt (Cpu);\r
 \r
-  //\r
-  // Initialize the C entry points for interrupts\r
-  //\r
-  for (Index = 0; Index <= MAX_ARM_EXCEPTION; Index++) {\r
-    Status = RegisterInterruptHandler (Index, NULL);\r
-    ASSERT_EFI_ERROR (Status);\r
-    \r
-    Status = RegisterDebuggerInterruptHandler (Index, NULL);\r
-    ASSERT_EFI_ERROR (Status);\r
-  }\r
   \r
   //\r
   // Copy an implementation of the ARM exception vectors to PcdCpuVectorBaseAddress.\r
@@ -207,6 +198,7 @@ InitializeExceptions (
   // Reserve space for the exception handlers\r
   //\r
   Base = (EFI_PHYSICAL_ADDRESS)PcdGet32 (PcdCpuVectorBaseAddress);\r
+  VectorBase = (UINT32 *)(UINTN)Base;\r
   Status = gBS->AllocatePages (AllocateAddress, EfiBootServicesCode, EFI_SIZE_TO_PAGES (Length), &Base);\r
   // If the request was for memory that's not in the memory map (which is often the case for 0x00000000\r
   // on embedded systems, for example, we don't want to hang up.  So we'll check here for a status of \r
@@ -215,7 +207,25 @@ InitializeExceptions (
     ASSERT_EFI_ERROR (Status);\r
   }\r
 \r
-  CopyMem ((VOID *)(UINTN)PcdGet32 (PcdCpuVectorBaseAddress), (VOID *)ExceptionHandlersStart, Length);\r
+  // Save existing vector table, in case debugger is already hooked in\r
+  CopyMem ((VOID *)gDebuggerExceptionHandlers, (VOID *)VectorBase, sizeof (gDebuggerExceptionHandlers));\r
+\r
+  //\r
+  // Initialize the C entry points for interrupts\r
+  //\r
+  for (Index = 0; Index <= MAX_ARM_EXCEPTION; Index++) {\r
+    Status = RegisterInterruptHandler (Index, NULL);\r
+    ASSERT_EFI_ERROR (Status);\r
+    \r
+    if (VectorBase[Index] == 0xEAFFFFFE) {\r
+      // Exception handler contains branch to vector location (jmp $) so no handler\r
+      // NOTE: This code assumes vectors are ARM and not Thumb code\r
+      gDebuggerExceptionHandlers[Index] = NULL;\r
+    }\r
+  }\r
+\r
+  // Copy our assembly code into the page that contains the exception vectors. \r
+  CopyMem ((VOID *)VectorBase, (VOID *)ExceptionHandlersStart, Length);\r
 \r
   //\r
   // Patch in the common Assembly exception handler\r
index eae92067d67dd15b91840e09437bd85bafaa081a..55e137361598e2943f2c0c311e804741522d981b 100644 (file)
@@ -345,7 +345,7 @@ InterruptDxeInitialize (
   MmioWrite32 (INTCPS_MIR(0), 0xFFFFFFFF);\r
   MmioWrite32 (INTCPS_MIR(1), 0xFFFFFFFF);\r
   MmioWrite32 (INTCPS_MIR(2), 0xFFFFFFFF);\r
-  MmioWrite32 (INTCPS_CONTROL, INTCPS_CONTROL_NEWIRQAGR);\r
+  MmioOr32 (INTCPS_CONTROL, INTCPS_CONTROL_NEWIRQAGR);\r
  \r
   Status = gBS->InstallMultipleProtocolInterfaces(&gHardwareInterruptHandle,\r
                                                   &gHardwareInterruptProtocolGuid,   &gHardwareInterruptProtocol,\r