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

Re: [Xen-devel] Question re do_switch_stack()



On Thu, 2005-06-09 at 07:44 -0700, Kip Macy wrote:
> The stack_switch you're looking at is for setting the trap stack.
> 

I'm still confused :(

the guest kernel's __switch_to() does

  
        tss->esp0 = next->esp0;
        mcl->op      = __HYPERVISOR_stack_switch;
        mcl->args[0] = tss->ss0;
        mcl->args[1] = tss->esp0;
        mcl++;


eventually calling into xen with that multicall. do_multicall_call()
calls, via hypercall_table, do_stack_switch(). there is only one
do_stack_switch() (for x86-32) which reads:

    int nr = smp_processor_id();
    struct tss_struct *t = &init_tss[nr];

    if ( (ss & 3) != 1 )
        return -EPERM;

    current->arch.kernel_ss = ss;
    current->arch.kernel_sp = esp;
    t->ss1  = ss;
    t->esp1 = esp;

    return 0;

the tss is not consulted on iretd as far as I can tell, and kernel_sp is
only loaded in create_bounce_frame. what did I miss?

thanks in advance.


> On 6/9/05, Avi Kivity <avi.kivity@xxxxxxxxxxxx> wrote:
> > looking at do_stack_switch() (x86-32), I see that the switch is effected
> > by moving the new stack pointer into current->arch.kernel_sp. however,
> > entry.S only looks at kernel_sp in create_bounce_frame, but only if
> > we're not returning into ring 1.
> > 
> > how then is the switch caused? obviously the call to do_stack_switch
> > came from ring 1.
> > 
> > confused,
> > Avi
> > 
> > _______________________________________________
> > Xen-devel mailing list
> > Xen-devel@xxxxxxxxxxxxxxxxxxx
> > http://lists.xensource.com/xen-devel
> >

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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