Skip to contentSkip to conversation

kvm_unit_tests: vm.c - Retrieve RAM size from fwcfg

PATCH In review Lucas Meneghel Rodrigues 2 participants 2 messages Aug 31, 2011 – Sep 1, 2011 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm_unit_tests: vm.c - Retrieve RAM size from fwcfg

Rather than letting the test dev do it.

---
 lib/x86/fwcfg.c |    5 +++++
 lib/x86/fwcfg.h |    1 +
 lib/x86/vm.c    |    2 +-
 3 files changed, 7 insertions(+), 1 deletions(-)
lib/x86/fwcfg.c +5 -0
index e2cdd15..df8548c 100644
@@ -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);
+}
lib/x86/fwcfg.h +1 -0
index e0836ca..96c75b8 100644
@@ -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
 
lib/x86/vm.c +1 -1
index abbb0c9..5b31892 100644
@@ -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);
 }
Signature · 1 line
1.7.6
#1 lore raw

lib/x86/fwcfg.c unsigned fwcfg_get_nb_cpus(void) · line 50

Quoted 7 lines · Lucas Meneghel Rodrigues

Rather than letting the test dev do it.

lib/x86/fwcfg.c +5 -0
+
+unsigned fwcfg_get_ram_size(void)
+{
+    return fwcfg_get_u64(FW_CFG_RAM_SIZE);
+}

Should return a 64-bit type here.

Signature · 1 line
error compiling committee.c: too many arguments to function