This repository has been archived on 2024-11-07. You can view files and clone it, but cannot push or open issues or pull requests.
refit/refit-0.14-libeg_uefi_call_wrapper.patch
Silvan Calarco 7228158b62 added patches from https://patches.ubuntu.com/doh/r/refit/extracted/ to build refit.efi
added icons and default configuration file [release 0.14-2mamba;Wed Jul 11 2012]
2024-01-05 17:24:44 +01:00

168 lines
7.4 KiB
Diff

#! /bin/sh /usr/share/dpatch/dpatch-run
## 43_libeg_uefi_call_wrapper.dpatch by <jblache@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Wrap EFI API calls with uefi_call_wrapper(), mandatory for GNU EFI
## DP: especially on x86_64.
@DPATCH@
diff -urNad refit-0.12~/libeg/image.c refit-0.12/libeg/image.c
--- refit-0.12~/libeg/image.c 2008-10-23 18:35:42.000000000 +0200
+++ refit-0.12/libeg/image.c 2008-10-23 18:36:02.603613917 +0200
@@ -108,13 +108,13 @@
UINTN BufferSize;
UINT8 *Buffer;
- Status = BaseDir->Open(BaseDir, &FileHandle, FileName, EFI_FILE_MODE_READ, 0);
+ Status = uefi_call_wrapper(BaseDir->Open, 5, BaseDir, &FileHandle, FileName, EFI_FILE_MODE_READ, 0);
if (EFI_ERROR(Status))
return Status;
FileInfo = LibFileInfo(FileHandle);
if (FileInfo == NULL) {
- FileHandle->Close(FileHandle);
+ uefi_call_wrapper(FileHandle->Close, 1, FileHandle);
return EFI_NOT_FOUND;
}
ReadSize = FileInfo->FileSize;
@@ -125,12 +125,12 @@
BufferSize = (UINTN)ReadSize; // was limited to 1 GB above, so this is safe
Buffer = (UINT8 *) AllocatePool(BufferSize);
if (Buffer == NULL) {
- FileHandle->Close(FileHandle);
+ uefi_call_wrapper(FileHandle->Close, 1, FileHandle);
return EFI_OUT_OF_RESOURCES;
}
- Status = FileHandle->Read(FileHandle, &BufferSize, Buffer);
- FileHandle->Close(FileHandle);
+ Status = uefi_call_wrapper(FileHandle->Read, 3, FileHandle, &BufferSize, Buffer);
+ uefi_call_wrapper(FileHandle->Close, 1, FileHandle);
if (EFI_ERROR(Status)) {
FreePool(Buffer);
return Status;
@@ -172,14 +172,14 @@
return Status;
}
- Status = BaseDir->Open(BaseDir, &FileHandle, FileName,
+ Status = uefi_call_wrapper(BaseDir->Open, 5, BaseDir, &FileHandle, FileName,
EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0);
if (EFI_ERROR(Status))
return Status;
BufferSize = FileDataLength;
- Status = FileHandle->Write(FileHandle, &BufferSize, FileData);
- FileHandle->Close(FileHandle);
+ Status = uefi_call_wrapper(FileHandle->Write, 3, FileHandle, &BufferSize, FileData);
+ uefi_call_wrapper(FileHandle->Close, 1, FileHandle);
return Status;
}
diff -urNad refit-0.12~/libeg/screen.c refit-0.12/libeg/screen.c
--- refit-0.12~/libeg/screen.c 2008-10-23 18:35:42.000000000 +0200
+++ refit-0.12/libeg/screen.c 2008-10-23 18:36:47.797628379 +0200
@@ -37,7 +37,7 @@
#include "libegint.h"
#include <efiUgaDraw.h>
-#include <efiGraphicsOutput.h>
+/* #include <efiGraphicsOutput.h> */
#include <efiConsoleControl.h>
// Console defines and variables
@@ -84,7 +84,7 @@
egScreenHeight = GraphicsOutput->Mode->Info->VerticalResolution;
egHasGraphics = TRUE;
} else if (UgaDraw != NULL) {
- Status = UgaDraw->GetMode(UgaDraw, &UGAWidth, &UGAHeight, &UGADepth, &UGARefreshRate);
+ Status = uefi_call_wrapper(UgaDraw->GetMode, 5, UgaDraw, &UGAWidth, &UGAHeight, &UGADepth, &UGARefreshRate);
if (EFI_ERROR(Status)) {
UgaDraw = NULL; // graphics not available
} else {
@@ -130,7 +130,7 @@
EFI_CONSOLE_CONTROL_SCREEN_MODE CurrentMode;
if (ConsoleControl != NULL) {
- ConsoleControl->GetMode(ConsoleControl, &CurrentMode, NULL, NULL);
+ uefi_call_wrapper(ConsoleControl->GetMode, 4, ConsoleControl, &CurrentMode, NULL, NULL);
return (CurrentMode == EfiConsoleControlScreenGraphics) ? TRUE : FALSE;
}
@@ -143,12 +143,12 @@
EFI_CONSOLE_CONTROL_SCREEN_MODE NewMode;
if (ConsoleControl != NULL) {
- ConsoleControl->GetMode(ConsoleControl, &CurrentMode, NULL, NULL);
+ uefi_call_wrapper(ConsoleControl->GetMode, 4, ConsoleControl, &CurrentMode, NULL, NULL);
NewMode = Enable ? EfiConsoleControlScreenGraphics
: EfiConsoleControlScreenText;
if (CurrentMode != NewMode)
- ConsoleControl->SetMode(ConsoleControl, NewMode);
+ uefi_call_wrapper(ConsoleControl->SetMode, 2, ConsoleControl, NewMode);
}
}
@@ -172,10 +172,10 @@
// EFI_GRAPHICS_OUTPUT_BLT_PIXEL and EFI_UGA_PIXEL have the same
// layout, and the header from TianoCore actually defines them
// to be the same type.
- GraphicsOutput->Blt(GraphicsOutput, (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)&FillColor, EfiBltVideoFill,
+ uefi_call_wrapper(GraphicsOutput->Blt, 10, GraphicsOutput, (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)&FillColor, EfiBltVideoFill,
0, 0, 0, 0, egScreenWidth, egScreenHeight, 0);
} else if (UgaDraw != NULL) {
- UgaDraw->Blt(UgaDraw, &FillColor, EfiUgaVideoFill,
+ uefi_call_wrapper(UgaDraw->Blt, 10, UgaDraw, &FillColor, EfiUgaVideoFill,
0, 0, 0, 0, egScreenWidth, egScreenHeight, 0);
}
}
@@ -191,10 +191,10 @@
}
if (GraphicsOutput != NULL) {
- GraphicsOutput->Blt(GraphicsOutput, (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)Image->PixelData, EfiBltBufferToVideo,
+ uefi_call_wrapper(GraphicsOutput->Blt, 10, GraphicsOutput, (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)Image->PixelData, EfiBltBufferToVideo,
0, 0, ScreenPosX, ScreenPosY, Image->Width, Image->Height, 0);
} else if (UgaDraw != NULL) {
- UgaDraw->Blt(UgaDraw, (EFI_UGA_PIXEL *)Image->PixelData, EfiUgaBltBufferToVideo,
+ uefi_call_wrapper(UgaDraw->Blt, 10, UgaDraw, (EFI_UGA_PIXEL *)Image->PixelData, EfiUgaBltBufferToVideo,
0, 0, ScreenPosX, ScreenPosY, Image->Width, Image->Height, 0);
}
}
@@ -217,10 +217,10 @@
}
if (GraphicsOutput != NULL) {
- GraphicsOutput->Blt(GraphicsOutput, (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)Image->PixelData, EfiBltBufferToVideo,
+ uefi_call_wrapper(GraphicsOutput->Blt, 10, GraphicsOutput, (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)Image->PixelData, EfiBltBufferToVideo,
AreaPosX, AreaPosY, ScreenPosX, ScreenPosY, AreaWidth, AreaHeight, Image->Width * 4);
} else if (UgaDraw != NULL) {
- UgaDraw->Blt(UgaDraw, (EFI_UGA_PIXEL *)Image->PixelData, EfiUgaBltBufferToVideo,
+ uefi_call_wrapper(UgaDraw->Blt, 10, UgaDraw, (EFI_UGA_PIXEL *)Image->PixelData, EfiUgaBltBufferToVideo,
AreaPosX, AreaPosY, ScreenPosX, ScreenPosY, AreaWidth, AreaHeight, Image->Width * 4);
}
}
@@ -249,10 +249,10 @@
// get full screen image
if (GraphicsOutput != NULL) {
- GraphicsOutput->Blt(GraphicsOutput, (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)Image->PixelData, EfiBltVideoToBltBuffer,
+ uefi_call_wrapper(GraphicsOutput->Blt, 10, GraphicsOutput, (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)Image->PixelData, EfiBltVideoToBltBuffer,
0, 0, 0, 0, Image->Width, Image->Height, 0);
} else if (UgaDraw != NULL) {
- UgaDraw->Blt(UgaDraw, (EFI_UGA_PIXEL *)Image->PixelData, EfiUgaVideoToBltBuffer,
+ uefi_call_wrapper(UgaDraw->Blt, 10, UgaDraw, (EFI_UGA_PIXEL *)Image->PixelData, EfiUgaVideoToBltBuffer,
0, 0, 0, 0, Image->Width, Image->Height, 0);
}
@@ -277,7 +277,7 @@
// DEBUG: switch to text mode
bailout_wait:
egSetGraphicsModeEnabled(FALSE);
- BS->WaitForEvent(1, &ST->ConIn->WaitForKey, &Index);
+ uefi_call_wrapper(BS->WaitForEvent, 3, 1, &ST->ConIn->WaitForKey, &Index);
}
/* EOF */