aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/lguest/core.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2008-03-28 12:05:53 -0400
committerRusty Russell <rusty@rustcorp.com.au>2008-03-27 20:05:54 -0400
commita6bd8e13034dd7d60b6f14217096efa192d0adc1 (patch)
tree23890908b06eb8357e6ce633d35df1216f5e4213 /drivers/lguest/core.c
parente18b094f0faa4889b06a112da17230a10b88c815 (diff)
lguest: comment documentation update.
Took some cycles to re-read the Lguest Journey end-to-end, fix some rot and tighten some phrases. Only comments change. No new jokes, but a couple of recycled old jokes. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/lguest/core.c')
-rw-r--r--drivers/lguest/core.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c
index c632c08cbbdc..5eea4356d703 100644
--- a/drivers/lguest/core.c
+++ b/drivers/lguest/core.c
@@ -1,8 +1,6 @@
1/*P:400 This contains run_guest() which actually calls into the Host<->Guest 1/*P:400 This contains run_guest() which actually calls into the Host<->Guest
2 * Switcher and analyzes the return, such as determining if the Guest wants the 2 * Switcher and analyzes the return, such as determining if the Guest wants the
3 * Host to do something. This file also contains useful helper routines, and a 3 * Host to do something. This file also contains useful helper routines. :*/
4 * couple of non-obvious setup and teardown pieces which were implemented after
5 * days of debugging pain. :*/
6#include <linux/module.h> 4#include <linux/module.h>
7#include <linux/stringify.h> 5#include <linux/stringify.h>
8#include <linux/stddef.h> 6#include <linux/stddef.h>
@@ -49,8 +47,8 @@ static __init int map_switcher(void)
49 * easy. 47 * easy.
50 */ 48 */
51 49
52 /* We allocate an array of "struct page"s. map_vm_area() wants the 50 /* We allocate an array of struct page pointers. map_vm_area() wants
53 * pages in this form, rather than just an array of pointers. */ 51 * this, rather than just an array of pages. */
54 switcher_page = kmalloc(sizeof(switcher_page[0])*TOTAL_SWITCHER_PAGES, 52 switcher_page = kmalloc(sizeof(switcher_page[0])*TOTAL_SWITCHER_PAGES,
55 GFP_KERNEL); 53 GFP_KERNEL);
56 if (!switcher_page) { 54 if (!switcher_page) {
@@ -172,7 +170,7 @@ void __lgread(struct lg_cpu *cpu, void *b, unsigned long addr, unsigned bytes)
172 } 170 }
173} 171}
174 172
175/* This is the write (copy into guest) version. */ 173/* This is the write (copy into Guest) version. */
176void __lgwrite(struct lg_cpu *cpu, unsigned long addr, const void *b, 174void __lgwrite(struct lg_cpu *cpu, unsigned long addr, const void *b,
177 unsigned bytes) 175 unsigned bytes)
178{ 176{
@@ -209,9 +207,9 @@ int run_guest(struct lg_cpu *cpu, unsigned long __user *user)
209 if (cpu->break_out) 207 if (cpu->break_out)
210 return -EAGAIN; 208 return -EAGAIN;
211 209
212 /* Check if there are any interrupts which can be delivered 210 /* Check if there are any interrupts which can be delivered now:
213 * now: if so, this sets up the hander to be executed when we 211 * if so, this sets up the hander to be executed when we next
214 * next run the Guest. */ 212 * run the Guest. */
215 maybe_do_interrupt(cpu); 213 maybe_do_interrupt(cpu);
216 214
217 /* All long-lived kernel loops need to check with this horrible 215 /* All long-lived kernel loops need to check with this horrible
@@ -246,8 +244,10 @@ int run_guest(struct lg_cpu *cpu, unsigned long __user *user)
246 lguest_arch_handle_trap(cpu); 244 lguest_arch_handle_trap(cpu);
247 } 245 }
248 246
247 /* Special case: Guest is 'dead' but wants a reboot. */
249 if (cpu->lg->dead == ERR_PTR(-ERESTART)) 248 if (cpu->lg->dead == ERR_PTR(-ERESTART))
250 return -ERESTART; 249 return -ERESTART;
250
251 /* The Guest is dead => "No such file or directory" */ 251 /* The Guest is dead => "No such file or directory" */
252 return -ENOENT; 252 return -ENOENT;
253} 253}