File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -412,7 +412,8 @@ fn parse_fadt(fadt: AcpiTable<'_>) {
412
412
413
413
// Map the "Differentiated System Description Table" (DSDT).
414
414
// TODO: This must not require "unsafe", see https://github.com/rust-lang/rust/issues/46043#issuecomment-393072398
415
- let x_dsdt_field_address = unsafe { & fadt_table. x_dsdt as * const _ as usize } ;
415
+ let x_dsdt = core:: ptr:: addr_of!( fadt_table. x_dsdt) ;
416
+ let x_dsdt_field_address = unsafe { x_dsdt. read_unaligned ( ) as usize } ;
416
417
let dsdt_address = if x_dsdt_field_address < fadt. table_end_address ( ) && fadt_table. x_dsdt > 0 {
417
418
PhysAddr ( fadt_table. x_dsdt )
418
419
} else {
Original file line number Diff line number Diff line change @@ -233,13 +233,14 @@ fn detect_from_acpi() -> Result<PhysAddr, ()> {
233
233
1 => {
234
234
// I/O APIC
235
235
let ioapic_record = unsafe { & * ( current_address as * const IoApicRecord ) } ;
236
+ let ioapic_addr = core:: ptr:: addr_of!( ioapic_record. address) ;
236
237
debug ! ( "Found I/O APIC record: {}" , ioapic_record) ;
237
238
238
239
unsafe {
239
240
IOAPIC_ADDRESS = virtualmem:: allocate ( BasePageSize :: SIZE ) . unwrap ( ) ;
240
241
debug ! (
241
242
"Mapping IOAPIC at {:#X} to virtual address {:#X}" ,
242
- ioapic_record . address , IOAPIC_ADDRESS
243
+ ioapic_addr . read_unaligned ( ) , IOAPIC_ADDRESS
243
244
) ;
244
245
245
246
let mut flags = PageTableEntryFlags :: empty ( ) ;
You can’t perform that action at this time.
0 commit comments