@@ -8,7 +8,7 @@ use bootloader_api::{info::FrameBufferInfo, BootloaderConfig};
8
8
use bootloader_x86_64_common:: { legacy_memory_region:: LegacyFrameAllocator , Kernel , SystemInfo } ;
9
9
use core:: { arch:: asm, cell:: UnsafeCell , fmt:: Write , mem, panic:: PanicInfo , ptr, slice} ;
10
10
use uefi:: {
11
- prelude:: { entry, Boot , Handle , ResultExt , Status , SystemTable } ,
11
+ prelude:: { entry, Boot , Handle , Status , SystemTable } ,
12
12
proto:: {
13
13
console:: gop:: { GraphicsOutput , PixelFormat } ,
14
14
device_path:: DevicePath ,
@@ -22,7 +22,9 @@ use uefi::{
22
22
IpAddress ,
23
23
} ,
24
24
} ,
25
- table:: boot:: { AllocateType , MemoryDescriptor , MemoryType } ,
25
+ table:: boot:: {
26
+ AllocateType , MemoryDescriptor , MemoryType , OpenProtocolAttributes , OpenProtocolParams ,
27
+ } ,
26
28
CStr16 , CStr8 ,
27
29
} ;
28
30
use x86_64:: {
@@ -140,25 +142,46 @@ fn load_kernel_file_from_disk(image: Handle, st: &SystemTable<Boot>) -> Option<&
140
142
let file_system_raw = {
141
143
let ref this = st. boot_services ( ) ;
142
144
let loaded_image = this
143
- . handle_protocol :: < LoadedImage > ( image)
145
+ . open_protocol :: < LoadedImage > (
146
+ OpenProtocolParams {
147
+ handle : image,
148
+ agent : image,
149
+ controller : None ,
150
+ } ,
151
+ OpenProtocolAttributes :: Exclusive ,
152
+ )
144
153
. expect ( "Failed to retrieve `LoadedImage` protocol from handle" ) ;
145
- let loaded_image = unsafe { & * loaded_image. get ( ) } ;
154
+ let loaded_image = unsafe { & * loaded_image. interface . get ( ) } ;
146
155
147
156
let device_handle = loaded_image. device ( ) ;
148
157
149
158
let device_path = this
150
- . handle_protocol :: < DevicePath > ( device_handle)
159
+ . open_protocol :: < DevicePath > (
160
+ OpenProtocolParams {
161
+ handle : device_handle,
162
+ agent : image,
163
+ controller : None ,
164
+ } ,
165
+ OpenProtocolAttributes :: Exclusive ,
166
+ )
151
167
. expect ( "Failed to retrieve `DevicePath` protocol from image's device handle" ) ;
152
- let mut device_path = unsafe { & * device_path. get ( ) } ;
168
+ let mut device_path = unsafe { & * device_path. interface . get ( ) } ;
153
169
154
- let device_handle = this
170
+ let fs_handle = this
155
171
. locate_device_path :: < SimpleFileSystem > ( & mut device_path)
156
172
. ok ( ) ?;
157
173
158
- this. handle_protocol :: < SimpleFileSystem > ( device_handle)
174
+ this. open_protocol :: < SimpleFileSystem > (
175
+ OpenProtocolParams {
176
+ handle : fs_handle,
177
+ agent : image,
178
+ controller : None ,
179
+ } ,
180
+ OpenProtocolAttributes :: Exclusive ,
181
+ )
159
182
}
160
183
. unwrap ( ) ;
161
- let file_system = unsafe { & mut * file_system_raw. get ( ) } ;
184
+ let file_system = unsafe { & mut * file_system_raw. interface . get ( ) } ;
162
185
163
186
let mut root = file_system. open_volume ( ) . unwrap ( ) ;
164
187
let mut buf = [ 0 ; 14 * 2 ] ;
@@ -200,21 +223,44 @@ fn load_kernel_file_from_tftp_boot_server(
200
223
// Try to locate a `BaseCode` protocol on the boot device.
201
224
202
225
let loaded_image = this
203
- . handle_protocol :: < LoadedImage > ( image)
226
+ . open_protocol :: < LoadedImage > (
227
+ OpenProtocolParams {
228
+ handle : image,
229
+ agent : image,
230
+ controller : None ,
231
+ } ,
232
+ OpenProtocolAttributes :: Exclusive ,
233
+ )
204
234
. expect ( "Failed to retrieve `LoadedImage` protocol from handle" ) ;
205
- let loaded_image = unsafe { & * loaded_image. get ( ) } ;
235
+ let loaded_image = unsafe { & * loaded_image. interface . get ( ) } ;
206
236
207
237
let device_handle = loaded_image. device ( ) ;
208
238
209
239
let device_path = this
210
- . handle_protocol :: < DevicePath > ( device_handle)
240
+ . open_protocol :: < DevicePath > (
241
+ OpenProtocolParams {
242
+ handle : device_handle,
243
+ agent : image,
244
+ controller : None ,
245
+ } ,
246
+ OpenProtocolAttributes :: Exclusive ,
247
+ )
211
248
. expect ( "Failed to retrieve `DevicePath` protocol from image's device handle" ) ;
212
- let mut device_path = unsafe { & * device_path. get ( ) } ;
213
-
214
- let device_handle = this. locate_device_path :: < BaseCode > ( & mut device_path) . ok ( ) ?;
215
-
216
- let base_code_raw = this. handle_protocol :: < BaseCode > ( device_handle) . unwrap ( ) ;
217
- let base_code = unsafe { & mut * base_code_raw. get ( ) } ;
249
+ let mut device_path = unsafe { & * device_path. interface . get ( ) } ;
250
+
251
+ let base_code_handle = this. locate_device_path :: < BaseCode > ( & mut device_path) . ok ( ) ?;
252
+
253
+ let base_code_raw = this
254
+ . open_protocol :: < BaseCode > (
255
+ OpenProtocolParams {
256
+ handle : base_code_handle,
257
+ agent : image,
258
+ controller : None ,
259
+ } ,
260
+ OpenProtocolAttributes :: Exclusive ,
261
+ )
262
+ . unwrap ( ) ;
263
+ let base_code = unsafe { & mut * base_code_raw. interface . get ( ) } ;
218
264
219
265
// Find the TFTP boot server.
220
266
let mode = base_code. mode ( ) ;
0 commit comments