<br clear="all">Hi. This is my first ever post on any kernel mailing list so be gentle :)<br><br>In lguest.c in the function async_hcall the local variable next_call is always 0 and in consequence we always access lguest_data.hcall_status[0] and lguest_data.hcalls[0].
<br>Also, why does the next_call variable is incremented at the end of the function considering that it's a local variable and it will disappear afterwards.<br>This code would be correct only if somehow the value of local variable next_call is remembered across function calls. If this is the case, could you please explain?
<br><br>Sorry if my post is stupid but I promise my posts will get better over time.<br><br>void async_hcall(unsigned long call,<br> unsigned long arg1, unsigned long arg2, unsigned long arg3)<br>{<br> /* Note: This code assumes we're uniprocessor. */
<br> static unsigned int next_call;<br> unsigned long flags;<br><br> /* Disable interrupts if not already disabled: we don't want an<br> * interrupt handler making a hypercall while we're already doing
<br> * one! */<br> local_irq_save(flags);<br> if (lguest_data.hcall_status[next_call] != 0xFF) {<br> /* Table full, so do normal hcall which will flush table. */<br> hcall(call, arg1, arg2, arg3);<br>
} else {<br> lguest_data.hcalls[next_call].eax = call;<br> lguest_data.hcalls[next_call].edx = arg1;<br> lguest_data.hcalls[next_call].ebx = arg2;<br> lguest_data.hcalls[next_call].ecx = arg3;
<br> /* Arguments must all be written before we mark it to go */<br> wmb();<br> lguest_data.hcall_status[next_call] = 0;<br> if (++next_call == LHCALL_RING_SIZE)<br> next_call = 0;<br>
}<br> local_irq_restore(flags);<br>}<br><br>-- <br>Catalin Morosan