1 /** @file
2 *  Main file supporting the transition to PEI Core in Normal World for Versatile Express
3 *
4 *  Copyright (c) 2012-2013, ARM Limited. All rights reserved.
5 *
6 *  This program and the accompanying materials
7 *  are licensed and made available under the terms and conditions of the BSD License
8 *  which accompanies this distribution.  The full text of the license may be found at
9 *  http://opensource.org/licenses/bsd-license.php
10 *
11 *  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 *  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 *
14 **/
15 
16 #include <Library/PrintLib.h>
17 #include <Library/SerialPortLib.h>
18 
19 #include "PrePeiCore.h"
20 
21 VOID
PeiCommonExceptionEntry(IN UINT32 Entry,IN UINTN LR)22 PeiCommonExceptionEntry (
23   IN UINT32 Entry,
24   IN UINTN LR
25   )
26 {
27   CHAR8           Buffer[100];
28   UINTN           CharCount;
29 
30   switch (Entry) {
31   case EXCEPT_AARCH64_SYNCHRONOUS_EXCEPTIONS:
32     CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Synchronous Exception at 0x%X\n\r", LR);
33     break;
34   case EXCEPT_AARCH64_IRQ:
35     CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"IRQ Exception at 0x%X\n\r", LR);
36     break;
37   case EXCEPT_AARCH64_FIQ:
38     CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"FIQ Exception at 0x%X\n\r", LR);
39     break;
40   case EXCEPT_AARCH64_SERROR:
41     CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"SError/Abort Exception at 0x%X\n\r", LR);
42     break;
43   default:
44     CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Unknown Exception at 0x%X\n\r", LR);
45     break;
46   }
47 
48   SerialPortWrite ((UINT8 *) Buffer, CharCount);
49 
50   while(1);
51 }
52 
53