forked from pool/acpica
50 lines
1.6 KiB
Diff
50 lines
1.6 KiB
Diff
Avoid unaligend accesses for IA64 in acpidump
|
|
|
|
From: Andreas Schwab <schwab@suse.de>
|
|
|
|
--- pmtools-20071116/acpidump/acpidump.c
|
|
+++ pmtools-20071116/acpidump/acpidump.c
|
|
@@ -312,7 +312,10 @@ static int acpi_dump_RSDT(int fd, struct
|
|
num = (sdt->length - sizeof(struct acpi_table_header))/sizeof(u32);
|
|
offset = (char *)sdt + sizeof(struct acpi_table_header);
|
|
for (i = 0; i < num; ++i, offset += sizeof(u32)) {
|
|
- addr = (unsigned long)(*(u32 *)offset);
|
|
+ u32 tmp;
|
|
+ memcpy(&tmp, offset, sizeof(tmp));
|
|
+ addr = (unsigned long)(tmp);
|
|
+
|
|
if (!addr) continue;
|
|
tbl = acpi_map_table(addr, 0);
|
|
if (!tbl) continue;
|
|
@@ -325,7 +328,8 @@ static int acpi_dump_RSDT(int fd, struct
|
|
}
|
|
acpi_unmap_table(tbl);
|
|
if (connect) {
|
|
- (*(u32*)offset) = lseek(fd, 0, SEEK_CUR);
|
|
+ tmp = lseek(fd, 0, SEEK_CUR);
|
|
+ memcpy(offset, &tmp, sizeof(tmp));
|
|
}
|
|
}
|
|
addr = (unsigned long)rsdp->rsdt_physical_address;
|
|
@@ -357,7 +361,9 @@ static int acpi_dump_XSDT(int fd, struct
|
|
num = (sdt->length - sizeof(struct acpi_table_header))/sizeof(u64);
|
|
offset = (char *)sdt + sizeof(struct acpi_table_header);
|
|
for (i = 0; i < num; ++i, offset += sizeof(u64)) {
|
|
- addr = (unsigned long)(*(u64 *)offset);
|
|
+ u64 tmp;
|
|
+ memcpy(&tmp, offset, sizeof(tmp));
|
|
+ addr = (unsigned long)tmp;
|
|
if (!addr) continue;
|
|
tbl = acpi_map_table(addr, 0);
|
|
if (!tbl) continue;
|
|
@@ -370,7 +376,8 @@ static int acpi_dump_XSDT(int fd, struct
|
|
}
|
|
acpi_unmap_table(tbl);
|
|
if (connect) {
|
|
- (*(u64*)offset) = lseek(fd, 0, SEEK_CUR);
|
|
+ tmp = lseek(fd, 0, SEEK_CUR);
|
|
+ memcpy(offset, &tmp, sizeof(tmp));
|
|
}
|
|
}
|
|
addr = (unsigned long)rsdp->xsdt_physical_address;
|