diff options
author | Glauber de Oliveira Costa <gcosta@redhat.com> | 2008-01-07 08:05:27 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2008-01-30 06:50:08 -0500 |
commit | 73044f05a4ac65f2df42753e9566444b9d2a660f (patch) | |
tree | 80a3e1d1bda31a769554a8c51f8c189ccec0b9f8 /drivers/lguest/x86 | |
parent | 7ea07a1500f05e06ebf0136763c781244f77a2a1 (diff) |
lguest: make hypercalls use the vcpu struct
this patch changes do_hcall() and do_async_hcall() interfaces (and obviously their
callers) to get a vcpu struct. Again, a vcpu services the hypercall, not the whole
guest
Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/lguest/x86')
-rw-r--r-- | drivers/lguest/x86/core.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c index 3d2131e169fd..5962160aff3d 100644 --- a/drivers/lguest/x86/core.c +++ b/drivers/lguest/x86/core.c | |||
@@ -283,8 +283,9 @@ static int emulate_insn(struct lguest *lg) | |||
283 | } | 283 | } |
284 | 284 | ||
285 | /*H:050 Once we've re-enabled interrupts, we look at why the Guest exited. */ | 285 | /*H:050 Once we've re-enabled interrupts, we look at why the Guest exited. */ |
286 | void lguest_arch_handle_trap(struct lguest *lg) | 286 | void lguest_arch_handle_trap(struct lg_cpu *cpu) |
287 | { | 287 | { |
288 | struct lguest *lg = cpu->lg; | ||
288 | switch (lg->regs->trapnum) { | 289 | switch (lg->regs->trapnum) { |
289 | case 13: /* We've intercepted a General Protection Fault. */ | 290 | case 13: /* We've intercepted a General Protection Fault. */ |
290 | /* Check if this was one of those annoying IN or OUT | 291 | /* Check if this was one of those annoying IN or OUT |
@@ -336,7 +337,7 @@ void lguest_arch_handle_trap(struct lguest *lg) | |||
336 | case LGUEST_TRAP_ENTRY: | 337 | case LGUEST_TRAP_ENTRY: |
337 | /* Our 'struct hcall_args' maps directly over our regs: we set | 338 | /* Our 'struct hcall_args' maps directly over our regs: we set |
338 | * up the pointer now to indicate a hypercall is pending. */ | 339 | * up the pointer now to indicate a hypercall is pending. */ |
339 | lg->hcall = (struct hcall_args *)lg->regs; | 340 | cpu->hcall = (struct hcall_args *)lg->regs; |
340 | return; | 341 | return; |
341 | } | 342 | } |
342 | 343 | ||
@@ -491,8 +492,10 @@ void __exit lguest_arch_host_fini(void) | |||
491 | 492 | ||
492 | 493 | ||
493 | /*H:122 The i386-specific hypercalls simply farm out to the right functions. */ | 494 | /*H:122 The i386-specific hypercalls simply farm out to the right functions. */ |
494 | int lguest_arch_do_hcall(struct lguest *lg, struct hcall_args *args) | 495 | int lguest_arch_do_hcall(struct lg_cpu *cpu, struct hcall_args *args) |
495 | { | 496 | { |
497 | struct lguest *lg = cpu->lg; | ||
498 | |||
496 | switch (args->arg0) { | 499 | switch (args->arg0) { |
497 | case LHCALL_LOAD_GDT: | 500 | case LHCALL_LOAD_GDT: |
498 | load_guest_gdt(lg, args->arg1, args->arg2); | 501 | load_guest_gdt(lg, args->arg1, args->arg2); |
@@ -511,13 +514,14 @@ int lguest_arch_do_hcall(struct lguest *lg, struct hcall_args *args) | |||
511 | } | 514 | } |
512 | 515 | ||
513 | /*H:126 i386-specific hypercall initialization: */ | 516 | /*H:126 i386-specific hypercall initialization: */ |
514 | int lguest_arch_init_hypercalls(struct lguest *lg) | 517 | int lguest_arch_init_hypercalls(struct lg_cpu *cpu) |
515 | { | 518 | { |
516 | u32 tsc_speed; | 519 | u32 tsc_speed; |
520 | struct lguest *lg = cpu->lg; | ||
517 | 521 | ||
518 | /* The pointer to the Guest's "struct lguest_data" is the only | 522 | /* The pointer to the Guest's "struct lguest_data" is the only |
519 | * argument. We check that address now. */ | 523 | * argument. We check that address now. */ |
520 | if (!lguest_address_ok(lg, lg->hcall->arg1, sizeof(*lg->lguest_data))) | 524 | if (!lguest_address_ok(lg, cpu->hcall->arg1, sizeof(*lg->lguest_data))) |
521 | return -EFAULT; | 525 | return -EFAULT; |
522 | 526 | ||
523 | /* Having checked it, we simply set lg->lguest_data to point straight | 527 | /* Having checked it, we simply set lg->lguest_data to point straight |
@@ -525,7 +529,7 @@ int lguest_arch_init_hypercalls(struct lguest *lg) | |||
525 | * copy_to_user/from_user from now on, instead of lgread/write. I put | 529 | * copy_to_user/from_user from now on, instead of lgread/write. I put |
526 | * this in to show that I'm not immune to writing stupid | 530 | * this in to show that I'm not immune to writing stupid |
527 | * optimizations. */ | 531 | * optimizations. */ |
528 | lg->lguest_data = lg->mem_base + lg->hcall->arg1; | 532 | lg->lguest_data = lg->mem_base + cpu->hcall->arg1; |
529 | 533 | ||
530 | /* We insist that the Time Stamp Counter exist and doesn't change with | 534 | /* We insist that the Time Stamp Counter exist and doesn't change with |
531 | * cpu frequency. Some devious chip manufacturers decided that TSC | 535 | * cpu frequency. Some devious chip manufacturers decided that TSC |