]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/FdtParser.c
ArmVirtPkg/FdtParser: avoid unaligned accesses with the MMU off
[mirror_edk2.git] / ArmVirtPkg / Library / ArmQemuRelocatablePlatformLib / FdtParser.c
index 46a5fe6409f613346337e972bca7d425fda44976..afdc81a8839df66e87c24b61f4e218bf342bb7df 100644 (file)
@@ -65,17 +65,15 @@ FindMemnode (
     return FALSE;\r
   }\r
 \r
-  if (AddressCells == 1) {\r
-    *SystemMemoryBase = fdt32_to_cpu (*Prop);\r
-  } else {\r
-    *SystemMemoryBase = fdt64_to_cpu (*(UINT64 *)Prop);\r
+  *SystemMemoryBase = fdt32_to_cpu (Prop[0]);\r
+  if (AddressCells > 1) {\r
+    *SystemMemoryBase = (*SystemMemoryBase << 32) | fdt32_to_cpu (Prop[1]);\r
   }\r
   Prop += AddressCells;\r
 \r
-  if (SizeCells == 1) {\r
-    *SystemMemorySize = fdt32_to_cpu (*Prop);\r
-  } else {\r
-    *SystemMemorySize = fdt64_to_cpu (*(UINT64 *)Prop);\r
+  *SystemMemorySize = fdt32_to_cpu (Prop[0]);\r
+  if (SizeCells > 1) {\r
+    *SystemMemorySize = (*SystemMemorySize << 32) | fdt32_to_cpu (Prop[1]);\r
   }\r
 \r
   return TRUE;\r