Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147992
b: refs/heads/master
c: cefcad1
h: refs/heads/master
v: v3
  • Loading branch information
Matias Zabaljauregui authored and Rusty Russell committed Jun 12, 2009
1 parent 1fbdd57 commit d2c4773
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ebe0ba84f55950a89cb7af94c7ffc35ee3992f9e
refs/heads/master: cefcad1773197523e11e18b669f245e6a8d32058
9 changes: 5 additions & 4 deletions trunk/arch/x86/include/asm/lguest_hcall.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
*
* We use the KVM hypercall mechanism. Eighteen hypercalls are
* available: the hypercall number is put in the %eax register, and the
* arguments (when required) are placed in %ebx, %ecx and %edx. If a return
* value makes sense, it's returned in %eax.
* arguments (when required) are placed in %ebx, %ecx, %edx and %esi.
* If a return value makes sense, it's returned in %eax.
*
* Grossly invalid calls result in Sudden Death at the hands of the vengeful
* Host, rather than returning failure. This reflects Winston Churchill's
Expand All @@ -48,8 +48,9 @@

#define LHCALL_RING_SIZE 64
struct hcall_args {
/* These map directly onto eax, ebx, ecx, edx in struct lguest_regs */
unsigned long arg0, arg1, arg2, arg3;
/* These map directly onto eax, ebx, ecx, edx and esi
* in struct lguest_regs */
unsigned long arg0, arg1, arg2, arg3, arg4;
};

#endif /* !__ASSEMBLY__ */
Expand Down
26 changes: 20 additions & 6 deletions trunk/arch/x86/lguest/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ struct lguest_data lguest_data = {

/*G:037 async_hcall() is pretty simple: I'm quite proud of it really. We have a
* ring buffer of stored hypercalls which the Host will run though next time we
* do a normal hypercall. Each entry in the ring has 4 slots for the hypercall
* do a normal hypercall. Each entry in the ring has 5 slots for the hypercall
* arguments, and a "hcall_status" word which is 0 if the call is ready to go,
* and 255 once the Host has finished with it.
*
Expand All @@ -96,7 +96,8 @@ struct lguest_data lguest_data = {
* effect of causing the Host to run all the stored calls in the ring buffer
* which empties it for next time! */
static void async_hcall(unsigned long call, unsigned long arg1,
unsigned long arg2, unsigned long arg3)
unsigned long arg2, unsigned long arg3,
unsigned long arg4)
{
/* Note: This code assumes we're uniprocessor. */
static unsigned int next_call;
Expand All @@ -108,12 +109,13 @@ static void async_hcall(unsigned long call, unsigned long arg1,
local_irq_save(flags);
if (lguest_data.hcall_status[next_call] != 0xFF) {
/* Table full, so do normal hcall which will flush table. */
kvm_hypercall3(call, arg1, arg2, arg3);
kvm_hypercall4(call, arg1, arg2, arg3, arg4);
} else {
lguest_data.hcalls[next_call].arg0 = call;
lguest_data.hcalls[next_call].arg1 = arg1;
lguest_data.hcalls[next_call].arg2 = arg2;
lguest_data.hcalls[next_call].arg3 = arg3;
lguest_data.hcalls[next_call].arg4 = arg4;
/* Arguments must all be written before we mark it to go */
wmb();
lguest_data.hcall_status[next_call] = 0;
Expand Down Expand Up @@ -141,7 +143,7 @@ static void lazy_hcall1(unsigned long call,
if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_NONE)
kvm_hypercall1(call, arg1);
else
async_hcall(call, arg1, 0, 0);
async_hcall(call, arg1, 0, 0, 0);
}

static void lazy_hcall2(unsigned long call,
Expand All @@ -151,7 +153,7 @@ static void lazy_hcall2(unsigned long call,
if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_NONE)
kvm_hypercall2(call, arg1, arg2);
else
async_hcall(call, arg1, arg2, 0);
async_hcall(call, arg1, arg2, 0, 0);
}

static void lazy_hcall3(unsigned long call,
Expand All @@ -162,7 +164,19 @@ static void lazy_hcall3(unsigned long call,
if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_NONE)
kvm_hypercall3(call, arg1, arg2, arg3);
else
async_hcall(call, arg1, arg2, arg3);
async_hcall(call, arg1, arg2, arg3, 0);
}

static void lazy_hcall4(unsigned long call,
unsigned long arg1,
unsigned long arg2,
unsigned long arg3,
unsigned long arg4)
{
if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_NONE)
kvm_hypercall4(call, arg1, arg2, arg3, arg4);
else
async_hcall(call, arg1, arg2, arg3, arg4);
}

/* When lazy mode is turned off reset the per-cpu lazy mode variable and then
Expand Down

0 comments on commit d2c4773

Please sign in to comment.