[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Stack switching in a PV guest



Thanks Ian,

>> I am currently trying to implement multitasking inside my little PV.
>> This is done by a a simple stack switch.
>>  
> Need more details of what you have done to advise properly I think.

For the moment I have just intercepted the main hypervisor callback.

I have simplified to the bare minimum what I am doing here (removed
the  nested  hypercall  handling  and  storing  the register file in a
static  memory  area). As long as I don't touch the stack pointer then
it  works quite happily. As soon as point it to a different stack then
everything falls over.

> Perhaps you need to be using HYPERVISOR_iret, or perhaps you need to
> make sure that your stack frame actually returns you to the correct
> context (which I expect hypervisor context is not).

I  have  checked  using gdb and when it gets to the iretq statement in
HYPERVISOR_iret the stack is as follows

%rsp    -> valid instruction pointer
%rsp+8  -> same CS as the original stack frame.
%rsp+16 -> 0 (initial rFLAGS)

Regards.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.