OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
OcLegacyThunkLib.h File Reference

Go to the source code of this file.

Macros

#define LEGACY_REGION_BASE   0x0C0000
 
#define LEGACY_REGION_SIZE   0x10000
 
#define EFI_SEGMENT(_Adr)
 
#define EFI_OFFSET(_Adr)
 

Functions

EFI_STATUS OcLegacyThunkInitializeBiosIntCaller (IN OUT 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)
 

Detailed Description

This library 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.h.

Macro Definition Documentation

◆ EFI_OFFSET

#define EFI_OFFSET ( _Adr)
Value:
(UINT16) (((UINT16) ((UINTN) (_Adr))) & 0xffff)

Definition at line 21 of file OcLegacyThunkLib.h.

◆ EFI_SEGMENT

#define EFI_SEGMENT ( _Adr)
Value:
(UINT16) ((UINT16) (((UINTN) (_Adr)) >> 4) & 0xf000)

Definition at line 20 of file OcLegacyThunkLib.h.

◆ LEGACY_REGION_BASE

#define LEGACY_REGION_BASE   0x0C0000

Definition at line 17 of file OcLegacyThunkLib.h.

◆ LEGACY_REGION_SIZE

#define LEGACY_REGION_SIZE   0x10000

Definition at line 18 of file OcLegacyThunkLib.h.

Function Documentation

◆ OcLegacyThunkBiosInt86()

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.

Parameters
ThunkContextThe instance pointer of THUNK_CONTEXT.
Legacy8259Instance pointer for EFI_LEGACY_8259_PROTOCOL.
BiosIntProcessor interrupt vector to invoke
RegRegister contexted passed into (and returned) from thunk to 16-bit mode
Return values
TRUEThunk completed, and there were no BIOS errors in the target code. See Regs for status.
FALSEThere was a BIOS error in the target code.

Definition at line 241 of file OcLegacyThunkLib.c.

◆ OcLegacyThunkDisconnectEfiGraphics()

VOID OcLegacyThunkDisconnectEfiGraphics ( VOID )

Disconnect all EFI graphics device handles in preparation for calling to legacy mode.

Definition at line 168 of file OcLegacyThunkLib.c.

◆ OcLegacyThunkFarCall86()

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.

◆ OcLegacyThunkInitializeBiosIntCaller()

EFI_STATUS OcLegacyThunkInitializeBiosIntCaller ( IN OUT THUNK_CONTEXT * ThunkContext)

Initialize legacy environment for BIOS INI caller.

Parameters
ThunkContextThe instance pointer of THUNK_CONTEXT.

◆ OcLegacyThunkInitializeInterruptRedirection()

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.

Parameters
Legacy8259Instance pointer for EFI_LEGACY_8259_PROTOCOL.

Definition at line 105 of file OcLegacyThunkLib.c.