1 | /** @file DxeExceptionLib.h
|
---|
2 |
|
---|
3 | Common header file for CPU Exception Handler Library.
|
---|
4 |
|
---|
5 | Copyright (c) 2024, Loongson Technology Corporation Limited. All rights reserved.<BR>
|
---|
6 |
|
---|
7 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
8 | **/
|
---|
9 |
|
---|
10 | #ifndef EXCEPTION_COMMON_H_
|
---|
11 | #define EXCEPTION_COMMON_H_
|
---|
12 |
|
---|
13 | #define MAX_DEBUG_MESSAGE_LENGTH 0x100
|
---|
14 |
|
---|
15 | //
|
---|
16 | // For coding convenience, define the maximum valid
|
---|
17 | // LoongArch exception.
|
---|
18 | // Since UEFI V2.11, it will be present in DebugSupport.h.
|
---|
19 | //
|
---|
20 | #define MAX_LOONGARCH_EXCEPTION 64
|
---|
21 |
|
---|
22 | extern INTN mExceptionKnownNameNum;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | Get ASCII format string exception name by exception type.
|
---|
26 |
|
---|
27 | @param[in] ExceptionType Exception type.
|
---|
28 |
|
---|
29 | @return ASCII format string exception name.
|
---|
30 |
|
---|
31 | **/
|
---|
32 | CONST CHAR8 *
|
---|
33 | GetExceptionNameStr (
|
---|
34 | IN EFI_EXCEPTION_TYPE ExceptionType
|
---|
35 | );
|
---|
36 |
|
---|
37 | /**
|
---|
38 | Prints a message to the serial port.
|
---|
39 |
|
---|
40 | @param[in] Format Format string for the message to print.
|
---|
41 | @param[in] ... Variable argument list whose contents are accessed
|
---|
42 | based on the format string specified by Format.
|
---|
43 |
|
---|
44 | **/
|
---|
45 | VOID
|
---|
46 | EFIAPI
|
---|
47 | InternalPrintMessage (
|
---|
48 | IN CONST CHAR8 *Format,
|
---|
49 | ...
|
---|
50 | );
|
---|
51 |
|
---|
52 | /**
|
---|
53 | Find and display image base address and return image base and its entry point.
|
---|
54 |
|
---|
55 | @param[in] CurrentEip Current instruction pointer.
|
---|
56 |
|
---|
57 | **/
|
---|
58 | VOID
|
---|
59 | DumpModuleImageInfo (
|
---|
60 | IN UINTN CurrentEip
|
---|
61 | );
|
---|
62 |
|
---|
63 | /**
|
---|
64 | IPI Interrupt Handler.
|
---|
65 |
|
---|
66 | @param InterruptType The type of interrupt that occurred
|
---|
67 | @param SystemContext A pointer to the system context when the interrupt occurred
|
---|
68 | **/
|
---|
69 | VOID
|
---|
70 | EFIAPI
|
---|
71 | IpiInterruptHandler (
|
---|
72 | IN EFI_EXCEPTION_TYPE InterruptType,
|
---|
73 | IN EFI_SYSTEM_CONTEXT SystemContext
|
---|
74 | );
|
---|
75 |
|
---|
76 | /**
|
---|
77 | Default exception handler.
|
---|
78 |
|
---|
79 | @param[in] ExceptionType Exception type.
|
---|
80 | @param[in] SystemContext Pointer to EFI_SYSTEM_CONTEXT.
|
---|
81 |
|
---|
82 | **/
|
---|
83 | VOID
|
---|
84 | EFIAPI
|
---|
85 | DefaultExceptionHandler (
|
---|
86 | IN EFI_EXCEPTION_TYPE ExceptionType,
|
---|
87 | IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
---|
88 | );
|
---|
89 |
|
---|
90 | /**
|
---|
91 | Display CPU information.
|
---|
92 |
|
---|
93 | @param[in] ExceptionType Exception type.
|
---|
94 | @param[in] SystemContext Pointer to EFI_SYSTEM_CONTEXT.
|
---|
95 |
|
---|
96 | **/
|
---|
97 | VOID
|
---|
98 | DumpImageAndCpuContent (
|
---|
99 | IN EFI_EXCEPTION_TYPE ExceptionType,
|
---|
100 | IN EFI_SYSTEM_CONTEXT SystemContext
|
---|
101 | );
|
---|
102 |
|
---|
103 | /**
|
---|
104 | Get exception types
|
---|
105 |
|
---|
106 | @param[in] SystemContext Pointer to EFI_SYSTEM_CONTEXT.
|
---|
107 |
|
---|
108 | @return Exception type.
|
---|
109 |
|
---|
110 | **/
|
---|
111 | EFI_EXCEPTION_TYPE
|
---|
112 | EFIAPI
|
---|
113 | GetExceptionType (
|
---|
114 | IN EFI_SYSTEM_CONTEXT SystemContext
|
---|
115 | );
|
---|
116 |
|
---|
117 | /**
|
---|
118 | Get Common interrupt types
|
---|
119 |
|
---|
120 | @param[in] SystemContext Pointer to EFI_SYSTEM_CONTEXT.
|
---|
121 |
|
---|
122 | @return Interrupt type.
|
---|
123 |
|
---|
124 | **/
|
---|
125 | EFI_EXCEPTION_TYPE
|
---|
126 | EFIAPI
|
---|
127 | GetInterruptType (
|
---|
128 | IN EFI_SYSTEM_CONTEXT SystemContext
|
---|
129 | );
|
---|
130 |
|
---|
131 | #endif
|
---|