]>
Commit | Line | Data |
---|---|---|
8f07f895 | 1 | /** @file\r |
2 | Common header file for CPU Exception Handler Library.\r | |
3 | \r | |
4 | Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>\r | |
5 | This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #ifndef _CPU_EXCEPTION_COMMON_H_\r | |
16 | #define _CPU_EXCEPTION_COMMON_H_\r | |
17 | \r | |
18 | #include <Library/BaseLib.h>\r | |
19 | #include <Library/SerialPortLib.h>\r | |
20 | #include <Library/PrintLib.h>\r | |
21 | #include <Library/LocalApicLib.h>\r | |
22 | #include <Library/PeCoffGetEntryPointLib.h>\r | |
23 | \r | |
24 | #define CPU_EXCEPTION_NUM 32\r | |
25 | //\r | |
26 | // Record exception handler information\r | |
27 | //\r | |
28 | typedef struct {\r | |
29 | UINTN ExceptionStart;\r | |
30 | UINTN ExceptionStubHeaderSize;\r | |
31 | } EXCEPTION_HANDLER_TEMPLATE_MAP;\r | |
32 | \r | |
33 | extern UINT32 mErrorCodeFlag;\r | |
34 | extern CONST UINTN mImageAlignSize;\r | |
35 | \r | |
36 | /**\r | |
37 | Return address map of exception handler template so that C code can generate\r | |
38 | exception tables.\r | |
39 | \r | |
40 | @param AddressMap Pointer to a buffer where the address map is returned.\r | |
41 | **/\r | |
42 | VOID\r | |
43 | EFIAPI\r | |
44 | GetTemplateAddressMap (\r | |
45 | OUT EXCEPTION_HANDLER_TEMPLATE_MAP *AddressMap\r | |
46 | );\r | |
47 | \r | |
48 | /**\r | |
49 | Internal function to setup CPU exception handlers.\r | |
50 | \r | |
51 | **/\r | |
52 | VOID\r | |
53 | InternalSetupCpuExceptionHandlers (\r | |
54 | VOID\r | |
55 | );\r | |
56 | \r | |
57 | /**\r | |
58 | Prints a message to the serial port.\r | |
59 | \r | |
60 | @param Format Format string for the message to print.\r | |
61 | @param ... Variable argument list whose contents are accessed \r | |
62 | based on the format string specified by Format.\r | |
63 | \r | |
64 | **/\r | |
65 | VOID\r | |
66 | EFIAPI\r | |
67 | InternalPrintMessage (\r | |
68 | IN CONST CHAR8 *Format,\r | |
69 | ...\r | |
70 | );\r | |
71 | \r | |
72 | /**\r | |
73 | Find and display image base address and return image base and its entry point.\r | |
74 | \r | |
75 | @return EFI_SUCCESS Image base address.\r | |
76 | @return 0 Image header cannot be found.\r | |
77 | **/\r | |
78 | UINTN \r | |
79 | FindModuleImageBase (\r | |
80 | IN UINTN CurrentEip,\r | |
81 | OUT UINTN *EntryPoint\r | |
82 | );\r | |
83 | \r | |
84 | /**\r | |
85 | Display CPU information.\r | |
86 | \r | |
87 | @param InterruptType Exception type.\r | |
88 | @param SystemContext Pointer to EFI_SYSTEM_CONTEXT.\r | |
89 | **/\r | |
90 | VOID\r | |
91 | DumpCpuContent (\r | |
92 | IN UINTN InterruptType,\r | |
93 | IN EFI_SYSTEM_CONTEXT SystemContext\r | |
94 | );\r | |
95 | \r | |
96 | #endif\r |