7 efi image entry point examples, 1 efi image entry point examples – Intel Extensible Firmware Interface User Manual

Page 92

Advertising
background image

Extensible Firmware Interface Specification

4-14

12/01/02

Version 1.10

4.7 EFI Image Entry Point Examples

The examples in the following sections show how the various table examples are presented in
the EFI environment.

4.7.1

EFI Image Entry Point Examples

The following example shows the EFI image entry point for an EFI Application. This
application makes use of the EFI System Table, the EFI Boot Services Table, and the EFI
Runtime Services Table.

EFI_SYSTEM_TABLE *gST;
EFI_BOOT_SERVICES_TABLE *gBS;
EFI_RUNTIME_SERVICES_TABLE *gRT;

EfiApplicationEntryPoint(
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)

{
EFI_STATUS Status;
EFI_TIME *Time;

gST = SystemTable;
gBS = gST->BootServices;
gRT = gST->RuntimeServices;

//
// Use EFI System Table to print “Hello World” to the active console output
// device.
//
Status = gST->ConOut->OutputString (gST->ConOut, L”Hello World\n\r”);
if (EFI_ERROR (Status)) {
return Status;
}

//
// Use EFI Boot Services Table to allocate a buffer to store the current time
// and date.
//
Status = gBS->AllocatePool (
EfiBootServicesData,
sizeof (EFI_TIME),
(VOID **)&Time
);
if (EFI_ERROR (Status)) {
return Status;
}

Advertising