All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Martin <furryfuttock@gmail.com>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: Simon Martin <smartin@milliways.cl>, xen-devel <xen-devel@lists.xen.org>
Subject: Re: Stack switching in a PV guest
Date: Mon, 16 Dec 2013 10:50:10 -0300	[thread overview]
Message-ID: <121927688.20131216105010@gmail.com> (raw)
In-Reply-To: <1387200969.10247.36.camel@kazak.uk.xensource.com>

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.

  reply	other threads:[~2013-12-16 13:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-16 13:31 Stack switching in a PV guest Simon Martin
2013-12-16 13:36 ` Ian Campbell
2013-12-16 13:50   ` Simon Martin [this message]
2013-12-16 14:45     ` Jan Beulich
2013-12-16 14:56       ` Simon Martin
2013-12-20 14:12         ` Simon Martin
2013-12-20 14:47           ` Jan Beulich
2013-12-20 15:10             ` Simon Martin
2013-12-20 15:48               ` Jan Beulich
2013-12-21  0:51           ` Mukesh Rathor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=121927688.20131216105010@gmail.com \
    --to=furryfuttock@gmail.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=smartin@milliways.cl \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.