From cc6d4fbcef328acdc9fa7023e69f39f753f72fe1 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 22 Oct 2007 11:03:30 +1000 Subject: Introduce "hcall" pointer to indicate pending hypercall. Currently we look at the "trapnum" to see if the Guest wants a hypercall. But once the hypercall is done we have to reset trapnum to a bogus value, otherwise if we exit to userspace and return, we'd run the same hypercall twice (that was a nasty bug to find!). This has two main effects: 1) When Jes's patch changes the hypercall args to be a generic "struct hcall_args" we simply change the type of "lg->hcall". It's set by arch code, so if it has to copy args or something it can do so, and point "hcall" into lg->arch somewhere. 2) Async hypercalls only get run when an actual hypercall is pending. This simplfies the code a little and is a more logical semantic. Signed-off-by: Rusty Russell --- drivers/lguest/x86/core.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'drivers/lguest/x86') diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c index e2f46b1..0cc251c 100644 --- a/drivers/lguest/x86/core.c +++ b/drivers/lguest/x86/core.c @@ -316,13 +316,14 @@ void lguest_arch_handle_trap(struct lguest *lg) return; break; case 32 ... 255: - /* These values mean a real interrupt occurred, in - * which case the Host handler has already been run. - * We just do a friendly check if another process - * should now be run, then fall through to loop - * around: */ + /* These values mean a real interrupt occurred, in which case + * the Host handler has already been run. We just do a + * friendly check if another process should now be run, then + * return to run the Guest again */ cond_resched(); - case LGUEST_TRAP_ENTRY: /* Handled before re-entering Guest */ + return; + case LGUEST_TRAP_ENTRY: + lg->hcall = lg->regs; return; } -- cgit v1.1