Newer
Older
AMI-Aptio-BIOS-Reversed / MdeModulePkg / Universal / Console / GraphicsConsoleDxe / GraphicsConsole / GraphicsConsole.md
@Ajax Dong Ajax Dong 2 days ago 4 KB Full restructure

GraphicsConsole

Function Table

Address Name Description
ModuleEntryPoint
GraphicsConsoleDriverEntry
GopNotificationEvent
TextOutConstructor
TextOutDestructor
TextOutResetGop
TextOutReset
TextOutOutputString
TextOutTestString
TextOutQueryMode
TextOutSetMode
TextOutSetAttribute
FlushCursor
EnableCursor
SetCursorPosition
ClearScreen
GraphicsOutputFindMode
InitializeGraphicsMode
ScrollUp
ScrollDown
ScrollRow
TextOutClearLine
FlushCurrentLine
TextOutSetModeCallback
TextOutFlushStub
TextOutFlush
IsValidChar
Global state variables for text output line buffer
UINT16 *gOutputBuffer = NULL;
cached HII_FONT protocol pointer
cached HII_FONT protocol handle
Standard UEFI globals (set by ModuleEntryPoint)
EFI_HANDLE gImageHandle = NULL;
EFI_HANDLE gImageHandle_0 = NULL;
Standard UEFI Module Entry Point
Driver Entry Point
Create GOP notification event (TPL_NOTIFY)
Status = gBootServices_0->CreateEvent (
Install protocol notification for SimpleTextOut on GOP
Status = gBootServices_0->InstallProtocolInterface (
Install driver binding + component name protocols
return gBootServices_0->InstallMultipleProtocolInterfaces (
GOP Notification Event Handler
Locate all handles with GOP protocol
Status = gBootServices_0->LocateHandleBuffer (
Match GOP handle by comparing first 16 bytes of mode info
if (CompareMem (GopModeInfo, &mGopModeInfoSource, 16) != 0) {
Cache HII_FONT protocol
if (gHiiFontInterface == NULL) {
Validate HII font with notification buffer
AllocationSize = (ModeEntry->ModeNumber & 0xFFFFFF) + 24;
TextOutConstructor (Driver Binding Start)
Allocate private context (266 bytes)
Status = gBootServices_0->AllocatePool (
Copy function table template (80 bytes at off_2990)
Allocate and init SimpleTextOutMode (24 bytes)
Allocate mode table (4 modes x 25 bytes = 100 bytes)
Open GOP protocol BY_DRIVER
Status = gBootServices_0->OpenProtocol (
Open HII Font protocol BY_DRIVER (optional)
if (EFI_ERROR (gBootServices_0->OpenProtocol (
Locate HII Font on any handle
Initialize graphics mode table
Status = InitializeGraphicsMode (Private);
Initialize private fields
Set default mode 0 and clear screen
if (TextOutSetMode (Private, 0) >= 0) {
Install protocols on new handle
Status = gBootServices_0->InstallMultipleProtocolInterfaces (
TextOutDestructor (Driver Binding Stop)
Retrieve private data from the protocol interface
Close GOP protocol (opened BY_DRIVER)
Uninstall protocols
Status = gBootServices_0->UninstallMultipleProtocolInterfaces (
Free resources
TextOutResetGop - Reset GOP state for this instance
Locate the controller handle via GOP protocol
Status = gBootServices_0->LocateProtocol (
Reopen GOP protocol
Convert char to glyph via HII Font
Status = Private->HiiFont->StringToImage (
Force width to 8 for wide chars
if ((((UINT16 )GlyphBuffer - 8) & 0xFFF7) != 0) {
Accumulate character in output buffer
CharPixelWidth = (UINT16 )GlyphBuffer >> 3;
Free glyph buffer
if (GlyphBuffer != NULL) {
Flush remaining buffered characters
FlushCurrentLine (Private);
Set GOP mode if needed
GopCurrentMode = Private->Gop->Mode->Mode;
if (gOutputBuffer != NULL) {
Internal Helper Functions
Dump mode table (debug output)
DEBUG ((EFI_D_INFO, " Mode# Text Col Text Row Vid Col Vid Row Supported GraphicsMode\n\r"));
Flush cursor stub with width info
Blit to GOP framebuffer
TPL check

Generated by HR650X BIOS Decompilation Project