Index: /trunk/src/VBox/Devices/Graphics/DevVGA.cpp
===================================================================
--- /trunk/src/VBox/Devices/Graphics/DevVGA.cpp	(revision 32977)
+++ /trunk/src/VBox/Devices/Graphics/DevVGA.cpp	(revision 32978)
@@ -6151,4 +6151,25 @@
 }
 
+/**
+ * Adjust VBE mode information
+ *
+ * Depending on the configured VRAM size, certain parts of VBE mode
+ * information must be updated.
+ *
+ * @param   pThis       The device instance data.
+ * @param   pMode       The mode information structure.
+ */
+static void vgaAdjustModeInfo(PVGASTATE pThis, ModeInfoListItem *pMode)
+{
+    int         nPages;
+
+    /* The "number of image pages" is really the max page index... */
+    nPages = pThis->vram_size / (pMode->info.YResolution * pMode->info.BytesPerScanLine) - 1;
+    Assert(nPages);
+    if (nPages > 255)
+        nPages = 255;   /* 8-bit value. */
+    pMode->info.NumberOfImagePages  = nPages;
+    pMode->info.LinNumberOfPages    = nPages;
+}
 
 /**
@@ -6165,5 +6186,4 @@
     uint32_t    cyReduction;
     uint32_t    cbPitch;
-    int         nPages;
     PVBEHEADER  pVBEDataHdr;
     ModeInfoListItem *pCurMode;
@@ -6569,4 +6589,5 @@
             continue;
         *pCurMode = mode_info_list[i];
+        vgaAdjustModeInfo(pThis, pCurMode);
         pCurMode++;
     }
@@ -6674,15 +6695,9 @@
 
                 /* adjust defaults */
-                /* The "number of image pages" is really the max page index... */
-                nPages = pThis->vram_size / (cy * cbPitch) - 1;
-                Assert(nPages);
-                if (nPages > 255)
-                    nPages = 255;   /* 8-bit value. */
                 pCurMode->info.XResolution = cx;
                 pCurMode->info.YResolution = cy;
                 pCurMode->info.BytesPerScanLine    = cbPitch;
                 pCurMode->info.LinBytesPerScanLine = cbPitch;
-                pCurMode->info.NumberOfImagePages  = nPages;
-                pCurMode->info.LinNumberOfPages    = nPages;
+                vgaAdjustModeInfo(pThis, pCurMode);
 
                 /* commit it */
