Index: /trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/edk2.patch-memdetect
===================================================================
--- /trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/edk2.patch-memdetect	(revision 30270)
+++ /trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/edk2.patch-memdetect	(revision 30271)
@@ -3,11 +3,38 @@
 --- OvmfPkg/PlatformPei/MemDetect.c	(revision 9332)
 +++ OvmfPkg/PlatformPei/MemDetect.c	(working copy)
-@@ -53,7 +53,7 @@
-   Cmos0x34 = (UINT8) CmosRead8 (0x34);
-   Cmos0x35 = (UINT8) CmosRead8 (0x35);
+@@ -34,12 +34,12 @@
+ #include "Cmos.h"
  
--  return ((((Cmos0x35 << 8) + Cmos0x34) << 16) + SIZE_16MB);
-+  return ((((UINTN)(Cmos0x35 << 8) + Cmos0x34) << 16) + SIZE_16MB);
+ STATIC
+-UINTN
++UINT64
+ GetSystemMemorySize (
+   )
+ {
+-  UINT8 Cmos0x34;
+-  UINT8 Cmos0x35;
++  UINT64 Cmos0x34;
++  UINT64 Cmos0x35;
+ 
+   //
+   // CMOS 0x34/0x35 specifies the system memory above 16 MB.
+@@ -50,8 +50,8 @@
+   //   into the calculation to get the total memory size.
+   //
+ 
+-  Cmos0x34 = (UINT8) CmosRead8 (0x34);
+-  Cmos0x35 = (UINT8) CmosRead8 (0x35);
++  Cmos0x34 = CmosRead8(0x34);
++  Cmos0x35 = CmosRead8(0x35);
+ 
+   return ((((Cmos0x35 << 8) + Cmos0x34) << 16) + SIZE_16MB);
  }
+@@ -77,7 +77,7 @@
+   //
+   // Determine total memory size available
+   //
+-  TotalMemorySize = (UINT64)GetSystemMemorySize ();
++  TotalMemorySize = GetSystemMemorySize ();
  
- 
+   MemoryBase = 0x800000;
+   MemorySize = TotalMemorySize - MemoryBase - 0x100000;
