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