Skip to content

Commit 60b6eb5

Browse files
committed
use RT instead of RS
Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
1 parent d836611 commit 60b6eb5

File tree

9 files changed

+74
-55
lines changed

9 files changed

+74
-55
lines changed

Include/Library/GenericBdsLib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ BdsLibVariableToOption (
352352
353353
@retval EFI_SUCCESS The boot#### or driver#### have been successfully
354354
registered.
355-
@retval EFI_STATUS Return the status of gRS->SetVariable ().
355+
@retval EFI_STATUS Return the status of gRT->SetVariable ().
356356
357357
**/
358358
EFI_STATUS

rEFIt_UEFI/Platform/DataHubCpu.c

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -138,43 +138,43 @@ LogDataHub(IN EFI_GUID *TypeGuid,
138138
}
139139

140140
// SetVariablesForOSX
141-
/** Installs our runtime services overrides. */
142-
/** Original runtime services. */
143-
EFI_RUNTIME_SERVICES gOrgRS;
144-
145-
EFI_STATUS EFIAPI
146-
OvrSetVariable(
147-
IN CHAR16 *VariableName,
148-
IN EFI_GUID *VendorGuid,
149-
IN UINT32 Attributes,
150-
IN UINTN DataSize,
151-
IN VOID *Data
152-
)
153-
{
154-
EFI_STATUS Status;
155-
UINTN i;
156-
157-
for (i = 0; i < RtVariablesNum; i++) {
158-
if (!CompareGuid(&RtVariables[i].VarGuid, VendorGuid)) {
159-
continue;
160-
}
161-
if (!RtVariables[i].Name || RtVariables[i].Name[0] == L'*' || StrCmp(VariableName, RtVariables[i].Name) == 0) {
162-
return EFI_SUCCESS;
163-
}
164-
}
165-
Status = gOrgRS.SetVariable(VariableName, VendorGuid, Attributes, DataSize, Data);
166-
return Status;
167-
}
168-
169-
EFI_STATUS EFIAPI
170-
OvrRuntimeServices(EFI_RUNTIME_SERVICES *RS)
171-
{
172-
EFI_STATUS Status;
173-
CopyMem(&gOrgRS, RS, sizeof(EFI_RUNTIME_SERVICES));
174-
RS->SetVariable = OvrSetVariable;
175-
RS->Hdr.CRC32 = 0;
176-
Status = gBS->CalculateCrc32(RS, RS->Hdr.HeaderSize, &RS->Hdr.CRC32);
177-
return Status;
141+
/** Installs our runtime services overrides. */
142+
/** Original runtime services. */
143+
EFI_RUNTIME_SERVICES gOrgRS;
144+
145+
EFI_STATUS EFIAPI
146+
OvrSetVariable(
147+
IN CHAR16 *VariableName,
148+
IN EFI_GUID *VendorGuid,
149+
IN UINT32 Attributes,
150+
IN UINTN DataSize,
151+
IN VOID *Data
152+
)
153+
{
154+
EFI_STATUS Status;
155+
UINTN i;
156+
157+
for (i = 0; i < RtVariablesNum; i++) {
158+
if (!CompareGuid(&RtVariables[i].VarGuid, VendorGuid)) {
159+
continue;
160+
}
161+
if (!RtVariables[i].Name || RtVariables[i].Name[0] == L'*' || StrCmp(VariableName, RtVariables[i].Name) == 0) {
162+
return EFI_SUCCESS;
163+
}
164+
}
165+
Status = gOrgRS.SetVariable(VariableName, VendorGuid, Attributes, DataSize, Data);
166+
return Status;
167+
}
168+
169+
EFI_STATUS EFIAPI
170+
OvrRuntimeServices(EFI_RUNTIME_SERVICES *RS)
171+
{
172+
EFI_STATUS Status;
173+
CopyMem(&gOrgRS, RS, sizeof(EFI_RUNTIME_SERVICES));
174+
RS->SetVariable = OvrSetVariable;
175+
RS->Hdr.CRC32 = 0;
176+
Status = gBS->CalculateCrc32(RS, RS->Hdr.HeaderSize, &RS->Hdr.CRC32);
177+
return Status;
178178
}
179179

180180
/// Sets the volatile and non-volatile variables used by OS X
@@ -198,8 +198,8 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
198198
//
199199
// firmware Variables
200200
//
201-
if (RtVariablesNum > 0) {
202-
OvrRuntimeServices(gRS);
201+
if (RtVariablesNum > 0) {
202+
OvrRuntimeServices(gRT);
203203
}
204204

205205
// As found on a real Mac, the system-id variable solely has the BS flag

rEFIt_UEFI/Platform/LegacyBoot.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ EFI_STATUS bootPBRtest(REFIT_VOLUME* volume)
701701
Facs = (EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE*)(UINTN)(FadtPointer->FirmwareCtrl);
702702
Facs->FirmwareWakingVector = 0x7F00;
703703

704-
gRS->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, NULL);
704+
gRT->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, NULL);
705705

706706

707707
/*
@@ -731,7 +731,7 @@ if (FadtPointer == NULL) {
731731
Facs = (EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE*)(UINTN)(FadtPointer->FirmwareCtrl);
732732
Facs->FirmwareWakingVector = 0x7F00;
733733
734-
gRS->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, NULL);
734+
gRT->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, NULL);
735735
*/
736736

737737
#define EFI_CPU_EFLAGS_IF 0x200

rEFIt_UEFI/Platform/Nvram.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,7 @@ PutNvramPlistToRtVars ()
10631063
}
10641064

10651065
// set RT var: all vars visible in nvram.plist are gEfiAppleBootGuid
1066-
/* Status = gRS->SetVariable (
1066+
/* Status = gRT->SetVariable (
10671067
KeyBuf,
10681068
VendorGuid,
10691069
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,

rEFIt_UEFI/Platform/Pointer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ VOID UpdatePointer()
230230
INTN ScreenRelX;
231231
INTN ScreenRelY;
232232

233-
// Now = gRS->GetTime(&Now, NULL);
233+
// Now = gRT->GetTime(&Now, NULL);
234234
Now = AsmReadTsc();
235235
Status = gPointer.SimplePointerProtocol->GetState(gPointer.SimplePointerProtocol, &tmpState);
236236
if (!EFI_ERROR(Status)) {

rEFIt_UEFI/refit/lib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
extern EFI_HANDLE gImageHandle;
7777
extern EFI_SYSTEM_TABLE* gST;
7878
extern EFI_BOOT_SERVICES* gBS;
79-
extern EFI_RUNTIME_SERVICES* gRS;
79+
extern EFI_RUNTIME_SERVICES* gRT;
8080

8181
#define TAG_ABOUT (1)
8282
#define TAG_RESET (2)

rEFIt_UEFI/refit/main.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ BOOLEAN APFSSupport = FALSE;
8686
//extern EFI_SYSTEM_TABLE* gST;
8787
//extern EFI_BOOT_SERVICES* gBS;
8888
//extern EFI_DXE_SERVICES* gDS;
89-
EFI_RUNTIME_SERVICES* gRS;
89+
//EFI_RUNTIME_SERVICES* gRS;
9090

9191
DRIVERS_FLAGS gDriversFlags; //the initializer is not needed for global variables
9292

@@ -121,7 +121,9 @@ extern HDA_OUTPUTS AudioList[20];
121121
extern CHAR8 *AudioOutputNames[];
122122
extern EFI_AUDIO_IO_PROTOCOL *AudioIo;
123123

124+
#ifdef __cplusplus
124125
}
126+
#endif
125127

126128
static EFI_STATUS LoadEFIImageList(IN EFI_DEVICE_PATH **DevicePaths,
127129
IN CHAR16 *ImageTitle,
@@ -1774,9 +1776,9 @@ VOID ResetNvram ()
17741776
}
17751777

17761778
// Attempt warm reboot
1777-
// gRS->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, NULL);
1779+
// gRT->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, NULL);
17781780
// Warm reboot may not be supported attempt cold reboot
1779-
// gRS->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL);
1781+
// gRT->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL);
17801782
// Terminate the screen and just exit
17811783
// TerminateScreen();
17821784
}
@@ -2071,13 +2073,13 @@ RefitMain (IN EFI_HANDLE ImageHandle,
20712073
gST = SystemTable;
20722074
gImageHandle = ImageHandle;
20732075
gBS = SystemTable->BootServices;
2074-
gRS = SystemTable->RuntimeServices;
2076+
gRT = SystemTable->RuntimeServices;
20752077
/*Status = */EfiGetSystemConfigurationTable (&gEfiDxeServicesTableGuid, (VOID **) &gDS);
20762078

20772079
ConsoleInHandle = SystemTable->ConsoleInHandle;
20782080

20792081

2080-
gRS->GetTime(&Now, NULL);
2082+
gRT->GetTime(&Now, NULL);
20812083

20822084
// firmware detection
20832085
gFirmwareClover = StrCmp(gST->FirmwareVendor, L"CLOVER") == 0;
@@ -2782,9 +2784,9 @@ destruct_globals_objects(NULL); // That should be done just before quitting clov
27822784
// }
27832785
}
27842786
// Attempt warm reboot
2785-
gRS->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, NULL);
2787+
gRT->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, NULL);
27862788
// Warm reboot may not be supported attempt cold reboot
2787-
gRS->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL);
2789+
gRT->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL);
27882790
// Terminate the screen and just exit
27892791
TerminateScreen();
27902792
MainLoopRunning = FALSE;
@@ -2794,7 +2796,7 @@ destruct_globals_objects(NULL); // That should be done just before quitting clov
27942796

27952797
case TAG_SHUTDOWN: // It is not Shut Down, it is Exit from Clover
27962798
TerminateScreen();
2797-
// gRS->ResetSystem(EfiResetShutdown, EFI_SUCCESS, 0, NULL);
2799+
// gRT->ResetSystem(EfiResetShutdown, EFI_SUCCESS, 0, NULL);
27982800
MainLoopRunning = FALSE; // just in case we get this far
27992801
ReinitDesktop = FALSE;
28002802
AfterTool = TRUE;
@@ -2983,7 +2985,7 @@ destruct_globals_objects(NULL); // That should be done just before quitting clov
29832985
// If we end up here, things have gone wrong. Try to reboot, and if that
29842986
// fails, go into an endless loop.
29852987
//Slice - NO!!! Return to EFI GUI
2986-
// gRS->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL);
2988+
// gRT->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL);
29872989
// EndlessIdleLoop();
29882990

29892991
#ifdef ENABLE_SECURE_BOOT
@@ -2997,3 +2999,5 @@ destruct_globals_objects(NULL); // That should be done just before quitting clov
29972999
}
29983000
return EFI_SUCCESS;
29993001
}
3002+
3003+

rEFIt_UEFI/refit/menu.c renamed to rEFIt_UEFI/refit/menu.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@
3737
//#include "Platform.h"
3838
#include "libegint.h" //this includes platform.h
3939
//#include "../include/scroll_images.h"
40+
41+
//#include "../Platform/Platform.h"
42+
#include "../cpp_util/XStringW.h"
43+
#include "../cpp_util/globals_ctor.h"
44+
#include "../cpp_util/globals_dtor.h"
45+
46+
#ifdef __cplusplus
47+
extern "C" {
48+
#endif
49+
4050
#include "Version.h"
4151
//#include "colors.h"
4252

@@ -5704,3 +5714,8 @@ UINTN RunMainMenu(IN REFIT_MENU_SCREEN *Screen, IN INTN DefaultSelection, OUT RE
57045714
}
57055715
return MenuExit;
57065716
}
5717+
5718+
#ifdef __cplusplus
5719+
}
5720+
#endif
5721+

rEFIt_UEFI/refit_cpp.inf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
refit/icns.c
4040
refit/lib.c
4141
refit/lib.h
42-
refit/menu.c
42+
refit/menu.cpp
4343
refit/screen.c
4444
refit/IO.c
4545
refit/IO.h

0 commit comments

Comments
 (0)