qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] kvm_unit_tests: vm.c - Retrieve RAM size from fwcfg


From: Lucas Meneghel Rodrigues
Subject: [Qemu-devel] [PATCH] kvm_unit_tests: vm.c - Retrieve RAM size from fwcfg
Date: Wed, 31 Aug 2011 18:11:12 -0300

Rather than letting the test dev do it.

CC: Avi Kivity <address@hidden>
CC: Marcelo Tosatti <address@hidden>
Signed-off-by: Lucas Meneghel Rodrigues <address@hidden>
---
 lib/x86/fwcfg.c |    5 +++++
 lib/x86/fwcfg.h |    1 +
 lib/x86/vm.c    |    2 +-
 3 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/lib/x86/fwcfg.c b/lib/x86/fwcfg.c
index e2cdd15..df8548c 100644
--- a/lib/x86/fwcfg.c
+++ b/lib/x86/fwcfg.c
@@ -43,3 +43,8 @@ unsigned fwcfg_get_nb_cpus(void)
 {
     return fwcfg_get_u16(FW_CFG_NB_CPUS);
 }
+
+unsigned fwcfg_get_ram_size(void)
+{
+    return fwcfg_get_u64(FW_CFG_RAM_SIZE);
+}
diff --git a/lib/x86/fwcfg.h b/lib/x86/fwcfg.h
index e0836ca..96c75b8 100644
--- a/lib/x86/fwcfg.h
+++ b/lib/x86/fwcfg.h
@@ -39,6 +39,7 @@ uint32_t fwcfg_get_u32(unsigned index);
 uint64_t fwcfg_get_u64(unsigned index);
 
 unsigned fwcfg_get_nb_cpus(void);
+unsigned fwcfg_get_ram_size(void);
 
 #endif
 
diff --git a/lib/x86/vm.c b/lib/x86/vm.c
index abbb0c9..5b31892 100644
--- a/lib/x86/vm.c
+++ b/lib/x86/vm.c
@@ -194,7 +194,7 @@ static unsigned int inl(unsigned short port)
 
 void setup_vm()
 {
-    end_of_memory = inl(0xd1);
+    end_of_memory = fwcfg_get_ram_size();
     free_memory(&edata, end_of_memory - (unsigned long)&edata);
     setup_mmu(end_of_memory);
 }
-- 
1.7.6




reply via email to

[Prev in Thread] Current Thread [Next in Thread]