The memory size is currently hardcoded into the linker script (end_of_memory).
This prevents the memory size from being specified dynamically in kvmctl.
This patch adds a PIO port that can be used to query the memory size in the
tests.
Signed-off-by: Anthony Liguori <[EMAIL PROTECTED]>
diff --git a/user/flat.lds b/user/flat.lds
index 7dd922c..61f1057 100644
--- a/user/flat.lds
+++ b/user/flat.lds
@@ -13,6 +13,5 @@ SECTIONS
.bss : { *(.bss) }
. = ALIGN(4K);
edata = .;
- end_of_memory = 128M;
}
diff --git a/user/main.c b/user/main.c
index 3eb8dea..9a57a24 100644
--- a/user/main.c
+++ b/user/main.c
@@ -144,7 +144,15 @@ static int test_inl(void *opaque, uint16_t addr, uint32_t
*value)
{
if (apic_io(addr, 0, value))
return 0;
- printf("inl 0x%x\n", addr);
+
+ switch (addr) {
+ case 0xd1:
+ *value = 128 * 1024 * 1024;
+ break;
+ default:
+ printf("inl 0x%x\n", addr);
+ break;
+ }
return 0;
}
diff --git a/user/test/vm.c b/user/test/vm.c
index 2eb8d96..e0e78d7 100644
--- a/user/test/vm.c
+++ b/user/test/vm.c
@@ -58,7 +58,8 @@ void free_page(void *page)
free = page;
}
-extern char edata, end_of_memory;
+extern char edata;
+static unsigned long end_of_memory;
#define PTE_PRESENT (1ull << 0)
#define PTE_PSE (1ull << 7)
@@ -202,10 +203,18 @@ static void setup_mmu(unsigned long len)
print("paging enabled\n");
}
+static unsigned int inl(unsigned short port)
+{
+ unsigned int val;
+ asm volatile("inl %w1, %0" : "=a"(val) : "Nd"(port));
+ return val;
+}
+
void setup_vm()
{
- free_memory(&edata, &end_of_memory - &edata);
- setup_mmu((long)&end_of_memory);
+ end_of_memory = inl(0xd1);
+ free_memory(&edata, end_of_memory - (unsigned long)&edata);
+ setup_mmu(end_of_memory);
}
void *vmalloc(unsigned long size)
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
kvm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel