aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/lguest/lguest_user.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2007-10-21 21:03:36 -0400
committerRusty Russell <rusty@rustcorp.com.au>2007-10-23 01:49:54 -0400
commit47436aa4ad054c1c7c8231618e86ebd9305308dc (patch)
treea9ba6e0521f9116442144a86e781a3164ec86094 /drivers/lguest/lguest_user.c
parentc18acd73ffc209def08003a1927473096f66c5ad (diff)
Boot with virtual == physical to get closer to native Linux.
1) This allows us to get alot closer to booting bzImages. 2) It means we don't have to know page_offset. 3) The Guest needs to modify the boot pagetables to create the PAGE_OFFSET mapping before jumping to C code. 4) guest_pa() walks the page tables rather than using page_offset. 5) We don't use page_offset to figure out whether to emulate: it was always kinda quesationable, and won't work for instructions done before remapping (bzImage unpacking in particular). 6) We still want the kernel address for tlb flushing: have the initial hypercall give us that, too. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/lguest/lguest_user.c')
-rw-r--r--drivers/lguest/lguest_user.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c
index b184652e45d7..61b177e1e649 100644
--- a/drivers/lguest/lguest_user.c
+++ b/drivers/lguest/lguest_user.c
@@ -111,7 +111,7 @@ static ssize_t read(struct file *file, char __user *user, size_t size,loff_t*o)
111 return run_guest(lg, (unsigned long __user *)user); 111 return run_guest(lg, (unsigned long __user *)user);
112} 112}
113 113
114/*L:020 The initialization write supplies 5 pointer sized (32 or 64 bit) 114/*L:020 The initialization write supplies 4 pointer sized (32 or 64 bit)
115 * values (in addition to the LHREQ_INITIALIZE value). These are: 115 * values (in addition to the LHREQ_INITIALIZE value). These are:
116 * 116 *
117 * base: The start of the Guest-physical memory inside the Launcher memory. 117 * base: The start of the Guest-physical memory inside the Launcher memory.
@@ -124,12 +124,6 @@ static ssize_t read(struct file *file, char __user *user, size_t size,loff_t*o)
124 * pagetables (which are set up by the Launcher). 124 * pagetables (which are set up by the Launcher).
125 * 125 *
126 * start: The first instruction to execute ("eip" in x86-speak). 126 * start: The first instruction to execute ("eip" in x86-speak).
127 *
128 * page_offset: The PAGE_OFFSET constant in the Guest kernel. We should
129 * probably wean the code off this, but it's a very useful constant! Any
130 * address above this is within the Guest kernel, and any kernel address can
131 * quickly converted from physical to virtual by adding PAGE_OFFSET. It's
132 * 0xC0000000 (3G) by default, but it's configurable at kernel build time.
133 */ 127 */
134static int initialize(struct file *file, const unsigned long __user *input) 128static int initialize(struct file *file, const unsigned long __user *input)
135{ 129{
@@ -137,7 +131,7 @@ static int initialize(struct file *file, const unsigned long __user *input)
137 * Guest. */ 131 * Guest. */
138 struct lguest *lg; 132 struct lguest *lg;
139 int err; 133 int err;
140 unsigned long args[5]; 134 unsigned long args[4];
141 135
142 /* We grab the Big Lguest lock, which protects against multiple 136 /* We grab the Big Lguest lock, which protects against multiple
143 * simultaneous initializations. */ 137 * simultaneous initializations. */
@@ -162,7 +156,6 @@ static int initialize(struct file *file, const unsigned long __user *input)
162 /* Populate the easy fields of our "struct lguest" */ 156 /* Populate the easy fields of our "struct lguest" */
163 lg->mem_base = (void __user *)(long)args[0]; 157 lg->mem_base = (void __user *)(long)args[0];
164 lg->pfn_limit = args[1]; 158 lg->pfn_limit = args[1];
165 lg->page_offset = args[4];
166 159
167 /* We need a complete page for the Guest registers: they are accessible 160 /* We need a complete page for the Guest registers: they are accessible
168 * to the Guest and we can only grant it access to whole pages. */ 161 * to the Guest and we can only grant it access to whole pages. */