All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] Remove memory size from linker script (v2)
@ 2007-10-10 20:03 Anthony Liguori
       [not found] ` <11920466271613-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Anthony Liguori @ 2007-10-10 20:03 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: Anthony Liguori, Jerone Young, Avi Kivity

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 <aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

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/

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-10-11 11:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-10 20:03 [PATCH 1/3] Remove memory size from linker script (v2) Anthony Liguori
     [not found] ` <11920466271613-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-10-10 20:03   ` [PATCH 2/3] Allow memory to be specified in kvmctl (v2) Anthony Liguori
2007-10-10 20:03   ` [PATCH 3/3] Use a table to dispatch IO requests " Anthony Liguori
2007-10-11 11:24   ` [PATCH 1/3] Remove memory size from linker script (v2) Avi Kivity

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.