@@ -47,7 +47,7 @@ impl SystemTableView for Runtime {}
47
47
/// will be provided to replace it.
48
48
#[ repr( transparent) ]
49
49
pub struct SystemTable < View : SystemTableView > {
50
- table : & ' static SystemTableImpl ,
50
+ table : * const SystemTableImpl ,
51
51
_marker : PhantomData < View > ,
52
52
}
53
53
@@ -56,28 +56,28 @@ impl<View: SystemTableView> SystemTable<View> {
56
56
/// Return the firmware vendor string
57
57
#[ must_use]
58
58
pub fn firmware_vendor ( & self ) -> & CStr16 {
59
- unsafe { CStr16 :: from_ptr ( self . table . fw_vendor ) }
59
+ unsafe { CStr16 :: from_ptr ( ( * self . table ) . fw_vendor ) }
60
60
}
61
61
62
62
/// Return the firmware revision
63
63
#[ must_use]
64
64
pub const fn firmware_revision ( & self ) -> u32 {
65
- self . table . fw_revision
65
+ unsafe { ( * self . table ) . fw_revision }
66
66
}
67
67
68
68
/// Returns the revision of this table, which is defined to be
69
69
/// the revision of the UEFI specification implemented by the firmware.
70
70
#[ must_use]
71
71
pub const fn uefi_revision ( & self ) -> Revision {
72
- self . table . header . revision
72
+ unsafe { ( * self . table ) . header . revision }
73
73
}
74
74
75
75
/// Returns the config table entries, a linear array of structures
76
76
/// pointing to other system-specific tables.
77
77
#[ allow( clippy:: missing_const_for_fn) ] // Required until we bump the MSRV.
78
78
#[ must_use]
79
79
pub fn config_table ( & self ) -> & [ cfg:: ConfigTableEntry ] {
80
- unsafe { slice:: from_raw_parts ( self . table . cfg_table , self . table . nr_cfg ) }
80
+ unsafe { slice:: from_raw_parts ( ( * self . table ) . cfg_table , ( * self . table ) . nr_cfg ) }
81
81
}
82
82
83
83
/// Creates a new `SystemTable<View>` from a raw address. The address might
@@ -112,29 +112,29 @@ impl<View: SystemTableView> SystemTable<View> {
112
112
impl SystemTable < Boot > {
113
113
/// Returns the standard input protocol.
114
114
pub fn stdin ( & mut self ) -> & mut text:: Input {
115
- unsafe { & mut * self . table . stdin }
115
+ unsafe { & mut * ( * self . table ) . stdin }
116
116
}
117
117
118
118
/// Returns the standard output protocol.
119
119
pub fn stdout ( & mut self ) -> & mut text:: Output {
120
- unsafe { & mut * self . table . stdout . cast ( ) }
120
+ unsafe { & mut * ( * self . table ) . stdout . cast ( ) }
121
121
}
122
122
123
123
/// Returns the standard error protocol.
124
124
pub fn stderr ( & mut self ) -> & mut text:: Output {
125
- unsafe { & mut * self . table . stderr . cast ( ) }
125
+ unsafe { & mut * ( * self . table ) . stderr . cast ( ) }
126
126
}
127
127
128
128
/// Access runtime services
129
129
#[ must_use]
130
130
pub const fn runtime_services ( & self ) -> & RuntimeServices {
131
- self . table . runtime
131
+ unsafe { & * ( * self . table ) . runtime }
132
132
}
133
133
134
134
/// Access boot services
135
135
#[ must_use]
136
136
pub const fn boot_services ( & self ) -> & BootServices {
137
- unsafe { & * self . table . boot }
137
+ unsafe { & * ( * self . table ) . boot }
138
138
}
139
139
140
140
/// Get the size in bytes of the buffer to allocate for storing the memory
@@ -275,7 +275,7 @@ impl SystemTable<Boot> {
275
275
276
276
impl Debug for SystemTable < Boot > {
277
277
fn fmt ( & self , f : & mut Formatter < ' _ > ) -> core:: fmt:: Result {
278
- self . table . fmt ( f)
278
+ unsafe { & * self . table } . fmt ( f)
279
279
}
280
280
}
281
281
@@ -292,7 +292,7 @@ impl SystemTable<Runtime> {
292
292
/// "Calling Conventions" chapter of the UEFI specification for details.
293
293
#[ must_use]
294
294
pub const unsafe fn runtime_services ( & self ) -> & RuntimeServices {
295
- self . table . runtime
295
+ & * ( * self . table ) . runtime
296
296
}
297
297
298
298
/// Changes the runtime addressing mode of EFI firmware from physical to virtual.
@@ -318,22 +318,27 @@ impl SystemTable<Runtime> {
318
318
let entry_size = core:: mem:: size_of :: < MemoryDescriptor > ( ) ;
319
319
let entry_version = crate :: table:: boot:: MEMORY_DESCRIPTOR_VERSION ;
320
320
let map_ptr = map. as_mut_ptr ( ) ;
321
- ( self . table . runtime . set_virtual_address_map ) ( map_size, entry_size, entry_version, map_ptr)
322
- . into_with_val ( || {
323
- let new_table_ref =
324
- & mut * ( new_system_table_virtual_addr as usize as * mut SystemTableImpl ) ;
325
- Self {
326
- table : new_table_ref,
327
- _marker : PhantomData ,
328
- }
329
- } )
321
+ ( ( * ( * self . table ) . runtime ) . set_virtual_address_map ) (
322
+ map_size,
323
+ entry_size,
324
+ entry_version,
325
+ map_ptr,
326
+ )
327
+ . into_with_val ( || {
328
+ let new_table_ref =
329
+ & mut * ( new_system_table_virtual_addr as usize as * mut SystemTableImpl ) ;
330
+ Self {
331
+ table : new_table_ref,
332
+ _marker : PhantomData ,
333
+ }
334
+ } )
330
335
}
331
336
332
337
/// Return the address of the SystemTable that resides in a UEFI runtime services
333
338
/// memory region.
334
339
#[ must_use]
335
340
pub fn get_current_system_table_addr ( & self ) -> u64 {
336
- self . table as * const _ as usize as u64
341
+ self . table as u64
337
342
}
338
343
}
339
344
@@ -351,7 +356,7 @@ struct SystemTableImpl {
351
356
stderr_handle : Handle ,
352
357
stderr : * mut text:: Output ,
353
358
/// Runtime services table.
354
- runtime : & ' static RuntimeServices ,
359
+ runtime : * const RuntimeServices ,
355
360
/// Boot services table.
356
361
boot : * const BootServices ,
357
362
/// Number of entries in the configuration table.
0 commit comments