summaryrefslogtreecommitdiffstats
path: root/documentation/UEFI_from_spec/EFI_IMAGE_ENTRY_POINT
blob: 4f9044e90947136a74fd8aa70cd9cc5b75105334 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
System Table contains pointers to the active concole devices, a pointer to the Boot Services Table,
a pointer to the Runtime Services Table, and a pointer to the list of system configuration tables such as
ACPI, SMBIOS and the SAL System Table.

Entry point is the same for UEFI applications and UEDI drivers.


PROTOTYPE
	typedef
	EFI_STATUS
	(EFIAPI *EFI_IMAGE_ENTRY_POINT) (
	IN EFI_HANDLE	ImageHandle,
	IN EFI_SYSTEM_TABLE *SystemTabel
	);

PARAMETERS
	ImageHandle The firmware allocated handle for the UEFI image
	SystemTable 	A pointer to the EFI System Table. Contains standard output and input handles,
			plus pointers to the EFI_BOOT_SERVICES and EFI RUNTIME_SERVICES tables.
			The service tables contain the entry points in the firmware for accessing the core EFI system
			functionality. The handles in the system table are used to obtain basci access to the console.
			In addition, the System Table contains pointers to other standard tables that a loaded image 
			may use if the associated pointers are initialized to nonzero values.
			Example of such tables: ACPI, SMBIOS, SAL System Table, ...



If the UEFI image is a UEFI application that is not a UEFI OS loader, then the application executes and
either returns or calls the EFI Boot Services EFI_BOOT_SERVICES.Exit(). A UEFI application is always
unloaded from memory when it exits, and its return status is returned to the component that started the
UEFI application.

EFI_TABLE_HEADER
Datastructure that precedes all of the standard EFI table types

typedef struct {
	UINT64 Signature;
	UINT32 Revision;
	UINT32 HeaderSize;
	UINT32 CRC32;
	UINT32 Reserved;
	} EFI_TABLE_HEADER;


EFI_SYSTEM_TABLE
Except for the table header, all elements in the service tables are pointers to functions as defined
in Section7 (Services - Boot Services) and Section8 (Services - Runtime Services).

Prior to a call to EFI_BOOT_SERVICES.ExitBootServices(), all of the fields of the EFI System Table are valid.
After an operating system has taken control of the platform with a call to ExitBootServices(), pmöy
Hdr, FirmwareVendor, FirmwareRevision, RuntimeServices, NumberOfTableEntries, ConfigurationTable fields
are valid.

typedef struct {
	EFI_TABLE_HEADER		Hdr;
	CHAR16				*FirmwareVendor;
	UINT32				FirmwareRevision;
	EFI_HANDLE			ConsoleInHandle;
	EFI_SIMPLE_TEXT_INPUT_PROTOCOL	*ConIn;
	EFI_HANDLE			ConsoleOutHandle;
	EFI_SYSTEM_TEXT_OUTPUT_PROTOCOL *ConOut;
	EFI_HANDLE			StandardErrorHandle;
	EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL	*stdErr;
	EFI_RUNTIME_SERVICES		*RuntimeServices:
	EFI_BOOT_SERVICES		*BootServices;
	UINTN				NumberOfTableEntries;
	EFI_CONFIGURATION_TABLE		*Configuration_Table;
	} EFI_SYSTEM_TABLE;

PARAMETERS
	ConcoleHandle		The handle for the active console input device. This handle must support
		EFI_SIMPLE_TEXT_INPUT_PROTOCOL and EFI_SIMPLE_TECT_INPUT_EX_PROTOCOL.
	ConIn			A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL interface that is
				associated with ConsoleInHandle.
	ConsoleOutHandle	The handle for the active console output device. This handle must
				EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.
	ConOut			A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface that is
				associated with ConsoleOutHandle.
	StandardErrorHandle	The handle for the active standard error console device. Must support
				EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.
	StdErr			A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL inte4rface that is
				assiciated with StandardErrorHandle
	RuntimeServices		A pointer to the EFI Runtime Services Table (Section 4.5)
	BootServices		Section 4.4
	NumberOfTableEntries	Number of system configuration tables in the buffer ConfigurationTable
	ConfigurationTable	A pointer to the system configuration tables. Number of entries in the table is
				NumberOfTableEntries.








References
[1] UEFI Specification 2.8 Errata A, February 2020 - 4.1 UEFI Image Entry Point - pp 89