OpenCore
1.0.4
OpenCore Bootloader
|
#include <Uefi.h>
#include <IndustryStandard/Pci.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/IoLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/OcDeviceMiscLib.h>
#include <Library/OcLegacyThunkLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
#include <Protocol/PciIo.h>
#include <Protocol/Timer.h>
Go to the source code of this file.
Macros | |
#define | TIMER0_COUNT_PORT 0x40 |
#define | TIMER1_COUNT_PORT 0x41 |
#define | TIMER2_COUNT_PORT 0x42 |
#define | TIMER_CONTROL_PORT 0x43 |
#define | TIMER0_CONTROL_WORD 0x36 |
#define | LEGACY_MODE_BASE_VECTOR_MASTER 0x08 |
#define | LEGACY_MODE_BASE_VECTOR_SLAVE 0x70 |
#define | PROTECTED_MODE_BASE_VECTOR_MASTER 0x68 |
#define | PROTECTED_MODE_BASE_VECTOR_SLAVE 0x70 |
Functions | |
EFI_STATUS | OcLegacyThunkInitializeBiosIntCaller (THUNK_CONTEXT *ThunkContext) |
EFI_STATUS | OcLegacyThunkInitializeInterruptRedirection (IN EFI_LEGACY_8259_PROTOCOL *Legacy8259) |
VOID | OcLegacyThunkDisconnectEfiGraphics (VOID) |
BOOLEAN EFIAPI | OcLegacyThunkBiosInt86 (IN THUNK_CONTEXT *ThunkContext, IN EFI_LEGACY_8259_PROTOCOL *Legacy8259, IN UINT8 BiosInt, IN IA32_REGISTER_SET *Regs) |
BOOLEAN EFIAPI | OcLegacyThunkFarCall86 (IN THUNK_CONTEXT *ThunkContext, IN EFI_LEGACY_8259_PROTOCOL *Legacy8259, IN UINT16 Segment, IN UINT16 Offset, IN IA32_REGISTER_SET *Regs, IN VOID *Stack, IN UINTN StackSize) |
This file implements thunking to legacy 16-bit environment.
Copyright (c) 2023, Goldfish64. All rights reserved.
Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause
Definition in file OcLegacyThunkLib.c.
#define LEGACY_MODE_BASE_VECTOR_MASTER 0x08 |
Definition at line 41 of file OcLegacyThunkLib.c.
#define LEGACY_MODE_BASE_VECTOR_SLAVE 0x70 |
Definition at line 42 of file OcLegacyThunkLib.c.
#define PROTECTED_MODE_BASE_VECTOR_MASTER 0x68 |
Definition at line 50 of file OcLegacyThunkLib.c.
#define PROTECTED_MODE_BASE_VECTOR_SLAVE 0x70 |
Definition at line 51 of file OcLegacyThunkLib.c.
#define TIMER0_CONTROL_WORD 0x36 |
Definition at line 33 of file OcLegacyThunkLib.c.
#define TIMER0_COUNT_PORT 0x40 |
Definition at line 29 of file OcLegacyThunkLib.c.
#define TIMER1_COUNT_PORT 0x41 |
Definition at line 30 of file OcLegacyThunkLib.c.
#define TIMER2_COUNT_PORT 0x42 |
Definition at line 31 of file OcLegacyThunkLib.c.
#define TIMER_CONTROL_PORT 0x43 |
Definition at line 32 of file OcLegacyThunkLib.c.
BOOLEAN EFIAPI OcLegacyThunkBiosInt86 | ( | IN THUNK_CONTEXT * | ThunkContext, |
IN EFI_LEGACY_8259_PROTOCOL * | Legacy8259, | ||
IN UINT8 | BiosInt, | ||
IN IA32_REGISTER_SET * | Regs ) |
Thunk to 16-bit real mode and execute a software interrupt with a vector of BiosInt. Regs will contain the 16-bit register context on entry and exit.
ThunkContext | The instance pointer of THUNK_CONTEXT. |
Legacy8259 | Instance pointer for EFI_LEGACY_8259_PROTOCOL. |
BiosInt | Processor interrupt vector to invoke |
Reg | Register contexted passed into (and returned) from thunk to 16-bit mode |
TRUE | Thunk completed, and there were no BIOS errors in the target code. See Regs for status. |
FALSE | There was a BIOS error in the target code. |
Definition at line 241 of file OcLegacyThunkLib.c.
VOID OcLegacyThunkDisconnectEfiGraphics | ( | VOID | ) |
Disconnect all EFI graphics device handles in preparation for calling to legacy mode.
Definition at line 168 of file OcLegacyThunkLib.c.
BOOLEAN EFIAPI OcLegacyThunkFarCall86 | ( | IN THUNK_CONTEXT * | ThunkContext, |
IN EFI_LEGACY_8259_PROTOCOL * | Legacy8259, | ||
IN UINT16 | Segment, | ||
IN UINT16 | Offset, | ||
IN IA32_REGISTER_SET * | Regs, | ||
IN VOID * | Stack, | ||
IN UINTN | StackSize ) |
Definition at line 328 of file OcLegacyThunkLib.c.
EFI_STATUS OcLegacyThunkInitializeBiosIntCaller | ( | THUNK_CONTEXT * | ThunkContext | ) |
Initialize legacy environment for BIOS INI caller.
ThunkContext | The instance pointer of THUNK_CONTEXT. |
Definition at line 59 of file OcLegacyThunkLib.c.
EFI_STATUS OcLegacyThunkInitializeInterruptRedirection | ( | IN EFI_LEGACY_8259_PROTOCOL * | Legacy8259 | ) |
Initialize interrupt redirection code and entries, because IDT Vectors 0x68-0x6f must be redirected to IDT Vectors 0x08-0x0f. Or the interrupt will lost when we do thunk. NOTE: We do not reset 8259 vector base, because it will cause pending interrupt lost.
Legacy8259 | Instance pointer for EFI_LEGACY_8259_PROTOCOL. |
Definition at line 105 of file OcLegacyThunkLib.c.