Browse Source

[efi] Show details of intercepted LoadImage() calls

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 years ago
parent
commit
3357a8e369
1 changed files with 30 additions and 0 deletions
  1. 30
    0
      src/interface/efi/efi_wrap.c

+ 30
- 0
src/interface/efi/efi_wrap.c View File

@@ -135,6 +135,35 @@ efi_locate_handle_wrapper ( EFI_LOCATE_SEARCH_TYPE search_type,
135 135
 	return efirc;
136 136
 }
137 137
 
138
+/**
139
+ * Wrap LoadImage()
140
+ *
141
+ */
142
+static EFI_STATUS EFIAPI
143
+efi_load_image_wrapper ( BOOLEAN boot_policy, EFI_HANDLE parent_image_handle,
144
+			 EFI_DEVICE_PATH_PROTOCOL *device_path,
145
+			 VOID *source_buffer, UINTN source_size,
146
+			 EFI_HANDLE *image_handle ) {
147
+	EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
148
+	void *retaddr = __builtin_return_address ( 0 );
149
+	EFI_STATUS efirc;
150
+
151
+	DBGC ( colour, "LoadImage ( %d, %p %s, ", boot_policy,
152
+	       parent_image_handle, efi_handle_name ( parent_image_handle ) );
153
+	DBGC ( colour, "%s, %p, %#llx, ... ) ",
154
+	       efi_devpath_text ( device_path ), source_buffer,
155
+	       ( ( unsigned long long ) source_size ) );
156
+	efirc = bs->LoadImage ( boot_policy, parent_image_handle, device_path,
157
+				source_buffer, source_size, image_handle );
158
+	DBGC ( colour, "= %s ( ", efi_status ( efirc ) );
159
+	if ( efirc == 0 ) {
160
+		DBGC ( colour, "%p %s ", *image_handle,
161
+		       efi_handle_name ( *image_handle ) );
162
+	}
163
+	DBGC ( colour, ") -> %p\n", retaddr );
164
+	return efirc;
165
+}
166
+
138 167
 /**
139 168
  * Wrap LocateDevicePath()
140 169
  *
@@ -222,6 +251,7 @@ void efi_wrap ( EFI_HANDLE handle, EFI_LOADED_IMAGE_PROTOCOL *loaded ) {
222 251
 	efi_bs_wrapper.HandleProtocol	= efi_handle_protocol_wrapper;
223 252
 	efi_bs_wrapper.LocateHandle	= efi_locate_handle_wrapper;
224 253
 	efi_bs_wrapper.LocateDevicePath	= efi_locate_device_path_wrapper;
254
+	efi_bs_wrapper.LoadImage	= efi_load_image_wrapper;
225 255
 	efi_bs_wrapper.OpenProtocol	= efi_open_protocol_wrapper;
226 256
 	efi_bs_wrapper.LocateProtocol	= efi_locate_protocol_wrapper;
227 257
 

Loading…
Cancel
Save