kvm_unit_tests: vm.c - Retrieve RAM size from fwcfg
PATCH 1/1 kvm_unit_tests: vm.c - Retrieve RAM size from fwcfg
Rather than letting the test dev do it.
CC Avi Kivity <[email protected]>
CC Marcelo Tosatti <[email protected]>
Signed-off-by Lucas Meneghel Rodrigues <[email protected]>
--- 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
@@ -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
@@ -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
@@ -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
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