Calculate "RamSize" needed by 16bit interface dynamically.

Calculate a LegacyRamSize directly from the e820 map for use by
handle_1588() and handle_15e801() (the only two external interfaces
that require "RamSize").  All other users of the existing RamSize (and
RamSizeOver4G) variables are specific to QEMU, so move the
declarations to paravirt.c.

Signed-off-by: Kevin O'Connor <>
diff --git a/src/paravirt.c b/src/paravirt.c
index 9ea3dd5..f061039 100644
--- a/src/paravirt.c
+++ b/src/paravirt.c
@@ -21,6 +21,10 @@
 #include "pci.h" // create_pirtable
 #include "xen.h" // xen_biostable_setup
+// Amount of continuous ram under 4Gig
+u32 RamSize;
+// Amount of continuous ram >4Gig
+u64 RamSizeOver4G;
 // Type of emulator platform.
 int PlatformRunningOn VARFSEG;
@@ -83,6 +87,8 @@
     /* reserve 256KB BIOS area at the end of 4 GB */
     add_e820(0xfffc0000, 256*1024, E820_RESERVED);
+    dprintf(1, "Ram Size=0x%08x (0x%016llx high)\n", RamSize, RamSizeOver4G);