]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Drivers/CpuDxe/ExceptionSupport.ARMv6.asm
Patch from open source community for CryptoPkg to allow it to build for ARM using...
[mirror_edk2.git] / ArmPkg / Drivers / CpuDxe / ExceptionSupport.ARMv6.asm
index 3bcca4d6aa69af76e10274965ab4dfb9d52c21cf..240e1e38ae7d788331c1a57a067fbd50acb582b4 100644 (file)
@@ -2,9 +2,9 @@
 //
 // Use ARMv6 instruction to operate on a single stack
 //
-// Copyright (c) 2008-2010 Apple Inc. All rights reserved.
+// Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
 //
-// All rights reserved. This program and the accompanying materials
+// This program and the accompanying materials
 // are licensed and made available under the terms and conditions of the BSD License
 // which accompanies this distribution.  The full text of the license may be found at
 // http://opensource.org/licenses/bsd-license.php
@@ -14,7 +14,7 @@
 //
 //------------------------------------------------------------------------------
 
-
+#include <Library/PcdLib.h>
 
 /*
 
@@ -61,6 +61,8 @@ This is the stack constructed by the exception handler (low address to high addr
   PRESERVE8
   AREA  DxeExceptionHandlers, CODE, READONLY
   
+  ALIGN   32
+  
 //
 // This code gets copied to the ARM vector table
 // ExceptionHandlersStart - ExceptionHandlersEnd gets copied
@@ -190,7 +192,7 @@ FiqEntry
 // This gets patched by the C code that patches in the vector table
 //
 CommonExceptionEntry
-  dcd       0x12345678
+  dcd       AsmCommonExceptionEntry
 
 ExceptionHandlersEnd
 
@@ -243,6 +245,10 @@ NoAdjustNeeded
                                     ; R0 is ExceptionType 
   mov       R1,SP                   ; R1 is SystemContext 
 
+#if (FixedPcdGet32(PcdVFPEnabled))
+  vpush    {d0-d15}                  ; save vstm registers in case they are used in optimizations\r
+#endif
+
 /* 
 VOID
 EFIAPI
@@ -253,6 +259,16 @@ CommonCExceptionHandler (
 
 */
   blx       CommonCExceptionHandler ; Call exception handler
+\r
+#if (FixedPcdGet32(PcdVFPEnabled))
+  vpop      {d0-d15}\r
+#endif
+  
+  ldr       R1, [SP, #0x4c]         ; Restore EFI_SYSTEM_CONTEXT_ARM.IFSR
+  mcr       p15, 0, R1, c5, c0, 1   ; Write IFSR
+
+  ldr       R1, [SP, #0x44]         ; sRestore EFI_SYSTEM_CONTEXT_ARM.DFSR
+  mcr       p15, 0, R1, c5, c0, 0   ; Write DFSR
   
   ldr       R1,[SP,#0x3c]           ; EFI_SYSTEM_CONTEXT_ARM.PC
   str       R1,[SP,#0x58]           ; Store it back to srsfd stack slot so it can be restored