]> git.proxmox.com Git - mirror_qemu.git/blobdiff - hw/i386/pc.c
E820: Add interface for accessing e820 table
[mirror_qemu.git] / hw / i386 / pc.c
index 14f0d91f76d6c0daab898a0d0f4f9796a08bb84a..aefb31593b157333e2ea69eb50d6b4854d9e8b6e 100644 (file)
@@ -612,6 +612,21 @@ int e820_add_entry(uint64_t address, uint64_t length, uint32_t type)
     return e820_entries;
 }
 
+int e820_get_num_entries(void)
+{
+    return e820_entries;
+}
+
+bool e820_get_entry(int idx, uint32_t type, uint64_t *address, uint64_t *length)
+{
+    if (idx < e820_entries && e820_table[idx].type == cpu_to_le32(type)) {
+        *address = le64_to_cpu(e820_table[idx].address);
+        *length = le64_to_cpu(e820_table[idx].length);
+        return true;
+    }
+    return false;
+}
+
 /* Calculates the limit to CPU APIC ID values
  *
  * This function returns the limit for the APIC ID value, so that all