]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Library/CpuExceptionHandlerLib.h
MdeModulePkg: Add match2 opcode support in SetupBrowserDxe and sample code in DriverS...
[mirror_edk2.git] / MdeModulePkg / Include / Library / CpuExceptionHandlerLib.h
CommitLineData
1e172d6b 1/** @file\r
57f360f2
JF
2 CPU Exception library provides the default CPU interrupt/exception handler.\r
3 It also provides capability to register user interrupt/exception handler.\r
1e172d6b 4\r
57f360f2 5 Copyright (c) 2012 - 2013, Intel Corporation. All rights reserved.<BR>\r
1e172d6b 6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
57f360f2
JF
16#ifndef __CPU_EXCEPTION_HANDLER_LIB_H__\r
17#define __CPU_EXCEPTION_HANDLER_LIB_H__\r
18\r
19#include <Ppi/VectorHandoffInfo.h>\r
20#include <Protocol/Cpu.h>\r
1e172d6b 21\r
22/**\r
57f360f2
JF
23 Initializes all CPU exceptions entries and provides the default exception handlers.\r
24 \r
25 Caller should try to get an array of interrupt and/or exception vectors that are in use and need to\r
26 persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification.\r
27 If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. \r
28 If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly.\r
29\r
30 @param[in] VectorInfo Pointer to reserved vector list.\r
31 \r
32 @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized \r
33 with default exception handlers.\r
34 @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.\r
35 @retval EFI_UNSUPPORTED This function is not supported.\r
36\r
1e172d6b 37**/\r
57f360f2
JF
38EFI_STATUS\r
39EFIAPI\r
40InitializeCpuExceptionHandlers (\r
41 IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL\r
42 );\r
43\r
44/**\r
45 Initializes all CPU interrupt/exceptions entries and provides the default interrupt/exception handlers.\r
46 \r
47 Caller should try to get an array of interrupt and/or exception vectors that are in use and need to\r
48 persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification.\r
49 If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. \r
50 If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly.\r
51\r
52 @param[in] VectorInfo Pointer to reserved vector list.\r
53 \r
54 @retval EFI_SUCCESS All CPU interrupt/exception entries have been successfully initialized \r
55 with default interrupt/exception handlers.\r
56 @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.\r
57 @retval EFI_UNSUPPORTED This function is not supported.\r
58\r
59**/\r
60EFI_STATUS\r
61EFIAPI\r
62InitializeCpuInterruptHandlers (\r
63 IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL\r
64 );\r
65\r
66/**\r
67 Registers a function to be called from the processor interrupt handler.\r
68\r
69 This function registers and enables the handler specified by InterruptHandler for a processor \r
70 interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the \r
71 handler for the processor interrupt or exception type specified by InterruptType is uninstalled. \r
72 The installed handler is called once for each processor interrupt or exception.\r
73 NOTE: This function should be invoked after InitializeCpuExceptionHandlers() or\r
74 InitializeCpuInterruptHandlers() invoked, otherwise EFI_UNSUPPORTED returned.\r
75\r
76 @param[in] InterruptType Defines which interrupt or exception to hook.\r
77 @param[in] InterruptHandler A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called\r
78 when a processor interrupt occurs. If this parameter is NULL, then the handler\r
79 will be uninstalled.\r
80\r
81 @retval EFI_SUCCESS The handler for the processor interrupt was successfully installed or uninstalled.\r
82 @retval EFI_ALREADY_STARTED InterruptHandler is not NULL, and a handler for InterruptType was\r
83 previously installed.\r
84 @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not\r
85 previously installed.\r
86 @retval EFI_UNSUPPORTED The interrupt specified by InterruptType is not supported,\r
87 or this function is not supported.\r
3f25e6ea 88**/\r
57f360f2 89EFI_STATUS\r
1e172d6b 90EFIAPI\r
57f360f2
JF
91RegisterCpuInterruptHandler (\r
92 IN EFI_EXCEPTION_TYPE InterruptType,\r
93 IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler\r
1e172d6b 94 );\r
95\r
96#endif\r