ReactOS 0.4.16-dev-297-gc569aee
uefildr.c File Reference
#include <uefildr.h>
#include <debug.h>
Include dependency graph for uefildr.c:

Go to the source code of this file.

Functions

 DBG_DEFAULT_CHANNEL (WARNING)
 
void _changestack (VOID)
 
EFI_STATUS EfiEntry (_In_ EFI_HANDLE ImageHandle, _In_ EFI_SYSTEM_TABLE *SystemTable)
 
void ExecuteLoaderCleanly (PVOID PreviousStack)
 
VOID __cdecl Reboot (VOID)
 

Variables

EFI_HANDLE GlobalImageHandle
 
EFI_SYSTEM_TABLEGlobalSystemTable
 
PVOID UefiServiceStack
 
PVOID BasicStack
 

Function Documentation

◆ _changestack()

void _changestack ( VOID  )

Referenced by EfiEntry().

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( WARNING  )

◆ EfiEntry()

EFI_STATUS EfiEntry ( _In_ EFI_HANDLE  ImageHandle,
_In_ EFI_SYSTEM_TABLE SystemTable 
)

Definition at line 25 of file uefildr.c.

28{
29 PCSTR CmdLine = ""; // FIXME: Determine a command-line from UEFI boot options
30
31 SystemTable->ConOut->OutputString(SystemTable->ConOut, L"UEFI EntryPoint: Starting freeldr from UEFI");
32 GlobalImageHandle = ImageHandle;
33 GlobalSystemTable = SystemTable;
34
35 /* Load the default settings from the command-line */
37
38 /* Debugger pre-initialization */
40
42
43 /* UI pre-initialization */
44 if (!UiInitialize(FALSE))
45 {
46 UiMessageBoxCritical("Unable to initialize UI.");
47 goto Quit;
48 }
49
50 /* Initialize memory manager */
52 {
53 UiMessageBoxCritical("Unable to initialize memory manager.");
54 goto Quit;
55 }
56
57 /* Initialize I/O subsystem */
58 FsInit();
59
60 /* 0x32000 is what UEFI defines, but we can go smaller if we want */
63
64Quit:
65 /* If we reach this point, something went wrong before, therefore reboot */
66 Reboot();
67
69 return 0;
70}
void LoadSettings(void)
Definition: settings.c:53
@ Reboot
Definition: bl.h:891
#define DebugInit(DebugString)
Definition: debug.h:120
VOID FsInit(VOID)
Definition: fs.c:646
PVOID MmAllocateMemoryWithType(SIZE_T MemorySize, TYPE_OF_MEMORY MemoryType)
Definition: mm.c:31
BOOLEAN MmInitializeMemoryManager(VOID)
Definition: meminit.c:315
BOOTMGRINFO BootMgrInfo
Definition: settings.c:18
VOID UiMessageBoxCritical(_In_ PCSTR MessageText)
Definition: ui.c:372
BOOLEAN UiInitialize(BOOLEAN ShowUi)
Definition: ui.c:92
#define FALSE
Definition: types.h:117
static const WCHAR CmdLine[]
Definition: install.c:48
#define ULONG_PTR
Definition: config.h:101
VOID MachInit(IN PCCH CommandLine)
Definition: macharm.c:182
#define UNREACHABLE
#define L(x)
Definition: ntvdm.h:50
@ LoaderOsloaderStack
Definition: arc.h:182
PCSTR DebugString
Definition: settings.h:12
void * PVOID
Definition: typedefs.h:50
const char * PCSTR
Definition: typedefs.h:52
uint32_t ULONG_PTR
Definition: typedefs.h:65
void _changestack(VOID)
PVOID BasicStack
Definition: uefildr.c:18
EFI_SYSTEM_TABLE * GlobalSystemTable
Definition: uefildr.c:16
EFI_HANDLE GlobalImageHandle
Definition: uefildr.c:15

◆ ExecuteLoaderCleanly()

void ExecuteLoaderCleanly ( PVOID  PreviousStack)

Definition at line 73 of file uefildr.c.

74{
75 TRACE("ExecuteLoaderCleanly Entry\n");
76 UefiServiceStack = PreviousStack;
77
78 RunLoader();
80}
VOID RunLoader(VOID)
Definition: bootmgr.c:356
#define TRACE(s)
Definition: solgame.cpp:4
PVOID UefiServiceStack
Definition: uefildr.c:17

◆ Reboot()

VOID __cdecl Reboot ( VOID  )

Definition at line 83 of file uefildr.c.

84{
85 //TODO: Replace with a true firmware reboot eventually
86 WARN("Something has gone wrong - halting FreeLoader\n");
87 for (;;)
88 {
89 NOTHING;
90 }
91}
#define WARN(fmt,...)
Definition: precomp.h:61
#define NOTHING
Definition: input_list.c:10

Variable Documentation

◆ BasicStack

PVOID BasicStack

Definition at line 18 of file uefildr.c.

Referenced by EfiEntry().

◆ GlobalImageHandle

EFI_HANDLE GlobalImageHandle

Definition at line 15 of file uefildr.c.

Referenced by EfiEntry(), UefiExitBootServices(), and UefiMemGetMemoryMap().

◆ GlobalSystemTable

◆ UefiServiceStack

PVOID UefiServiceStack

Definition at line 17 of file uefildr.c.

Referenced by ExecuteLoaderCleanly().