Move ram size definitions from ebda to global variables.
diff --git a/src/acpi.c b/src/acpi.c
index cdc90db..0daa3f6 100644
--- a/src/acpi.c
+++ b/src/acpi.c
@@ -310,7 +310,7 @@
     rsdp = (void *)(bios_table_cur_addr);
     bios_table_cur_addr += sizeof(*rsdp);
 
-    addr = base_addr = GET_EBDA(ram_size) - CONFIG_ACPI_DATA_SIZE;
+    addr = base_addr = RamSize - CONFIG_ACPI_DATA_SIZE;
     add_e820(addr, CONFIG_ACPI_DATA_SIZE, E820_ACPI);
     rsdt_addr = addr;
     rsdt = (void *)(addr);
diff --git a/src/biosvar.h b/src/biosvar.h
index bac978c..b106bb0 100644
--- a/src/biosvar.h
+++ b/src/biosvar.h
@@ -274,10 +274,6 @@
     // 0x121 - Begin custom storage.
     u8 ps2ctr;
 
-    // Physical memory available.
-    u32 ram_size;        // Amount of continuous ram under 4Gig
-    u64 ram_size_over4G; // Amount of continuous ram >4Gig
-
     // ATA Driver data
     struct ata_s ata;
 
diff --git a/src/coreboot.c b/src/coreboot.c
index ac8cf33..8b93e26 100644
--- a/src/coreboot.c
+++ b/src/coreboot.c
@@ -219,8 +219,8 @@
         add_e820(m->start, m->size, type);
     }
 
-    SET_EBDA(ram_size, maxram);
-    SET_EBDA(ram_size_over4G, maxram_over4G);
+    RamSize = maxram;
+    RamSizeOver4G = maxram_over4G;
 
     // Ughh - coreboot likes to set a map at 0x0000-0x1000, but this
     // confuses grub.  So, override it.
@@ -235,8 +235,8 @@
 fail:
     // No table found..  Use 16Megs as a dummy value.
     dprintf(1, "Unable to find coreboot table!\n");
-    SET_EBDA(ram_size, 16*1024*1024);
-    SET_EBDA(ram_size_over4G, 0);
+    RamSize = 16*1024*1024;
+    RamSizeOver4G = 0;
     add_e820(0, 16*1024*1024, E820_RAM);
     return;
 }
diff --git a/src/pciinit.c b/src/pciinit.c
index c228ea0..6d35eea 100644
--- a/src/pciinit.c
+++ b/src/pciinit.c
@@ -192,7 +192,7 @@
 
     pci_bios_io_addr = 0xc000;
     pci_bios_mem_addr = 0xf0000000;
-    pci_bios_bigmem_addr = GET_EBDA(ram_size);
+    pci_bios_bigmem_addr = RamSize;
     if (pci_bios_bigmem_addr < 0x90000000)
         pci_bios_bigmem_addr = 0x90000000;
 
diff --git a/src/post.c b/src/post.c
index 5951644..ec55ab2 100644
--- a/src/post.c
+++ b/src/post.c
@@ -107,14 +107,14 @@
             rs = (((inb_cmos(CMOS_MEM_EXTMEM_LOW) << 10)
                    | (inb_cmos(CMOS_MEM_EXTMEM_HIGH) << 18))
                   + 1 * 1024 * 1024);
-        SET_EBDA(ram_size, rs);
+        RamSize = rs;
         add_e820(0, rs, E820_RAM);
 
         // Check for memory over 4Gig
         u64 high = ((inb_cmos(CMOS_MEM_HIGHMEM_LOW) << 16)
                     | (inb_cmos(CMOS_MEM_HIGHMEM_MID) << 24)
                     | ((u64)inb_cmos(CMOS_MEM_HIGHMEM_HIGH) << 32));
-        SET_EBDA(ram_size_over4G, high);
+        RamSizeOver4G = high;
         add_e820(0x100000000ull, high, E820_RAM);
 
         /* reserve 256KB BIOS area at the end of 4 GB */
@@ -129,7 +129,7 @@
              , E820_RESERVED);
     add_e820(BUILD_BIOS_ADDR, BUILD_BIOS_SIZE, E820_RESERVED);
 
-    dprintf(1, "ram_size=0x%08x\n", GET_EBDA(ram_size));
+    dprintf(1, "Ram Size=0x%08x\n", RamSize);
 }
 
 static void
diff --git a/src/smbios.c b/src/smbios.c
index 4510148..d0e1ebe 100644
--- a/src/smbios.c
+++ b/src/smbios.c
@@ -400,7 +400,7 @@
     p->location = 0x01; /* other */
     p->use = 0x03; /* system memory */
     p->error_correction = 0x01; /* other */
-    u64 memsize = GET_EBDA(ram_size) + GET_EBDA(ram_size_over4G);
+    u64 memsize = RamSize + RamSizeOver4G;
     p->maximum_capacity = memsize / 1024;
     p->memory_error_information_handle = 0xfffe; /* none provided */
     p->number_of_memory_devices = 1;
@@ -426,7 +426,7 @@
     p->data_width = 64;
     /* truncate memory_size_mb to 16 bits and clear most significant
        bit [indicates size in MB] */
-    u64 memsize = GET_EBDA(ram_size) + GET_EBDA(ram_size_over4G);
+    u64 memsize = RamSize + RamSizeOver4G;
     p->size = (u16) (memsize / (1024*1024)) & 0x7fff;
     p->form_factor = 0x09; /* DIMM */
     p->device_set = 0;
@@ -454,11 +454,11 @@
     p->header.handle = 0x1300;
 
     p->starting_address = 0;
-    u64 memsize = GET_EBDA(ram_size_over4G);
+    u64 memsize = RamSizeOver4G;
     if (memsize)
         memsize += 0x100000000ull;
     else
-        memsize = GET_EBDA(ram_size);
+        memsize = RamSize;
     p->ending_address = memsize / 1024 - 1;
     p->memory_array_handle = 0x1000;
     p->partition_width = 1;
@@ -480,11 +480,11 @@
     p->header.handle = 0x1400;
 
     p->starting_address = 0;
-    u64 memsize = GET_EBDA(ram_size_over4G);
+    u64 memsize = RamSizeOver4G;
     if (memsize)
         memsize += 0x100000000ull;
     else
-        memsize = GET_EBDA(ram_size);
+        memsize = RamSize;
     p->ending_address = memsize / 1024 - 1;
     p->memory_device_handle = 0x1100;
     p->memory_array_mapped_address_handle = 0x1300;
diff --git a/src/system.c b/src/system.c
index fcbbaf6..abbfbbf 100644
--- a/src/system.c
+++ b/src/system.c
@@ -191,7 +191,7 @@
 static void
 handle_1588(struct bregs *regs)
 {
-    u32 rs = GET_EBDA(ram_size);
+    u32 rs = GET_GLOBAL(RamSize);
 
     // According to Ralf Brown's interrupt the limit should be 15M,
     // but real machines mostly return max. 63M.
@@ -246,7 +246,7 @@
     // regs.u.r16.ax = 0;
     // regs.u.r16.bx = 0;
 
-    u32 rs = GET_EBDA(ram_size);
+    u32 rs = GET_GLOBAL(RamSize);
 
     // Get the amount of extended memory (above 1M)
     if (rs > 16*1024*1024) {
@@ -269,6 +269,10 @@
 // Info on e820 map location and size.
 struct e820entry *e820_list VAR16;
 int e820_count VAR16;
+// Amount of continuous ram under 4Gig
+u32 RamSize VAR16;
+// Amount of continuous ram >4Gig
+u64 RamSizeOver4G VAR16;
 
 static void
 handle_15e820(struct bregs *regs)
diff --git a/src/util.h b/src/util.h
index ee885f7..89f049a 100644
--- a/src/util.h
+++ b/src/util.h
@@ -114,6 +114,8 @@
 void mouse_setup();
 
 // system.c
+extern u32 RamSize;
+extern u64 RamSizeOver4G;
 void mathcp_setup();
 
 // serial.c