From: Avi Kivity Subject: Re: Question re do_switch_stack() Date: Thu, 09 Jun 2005 18:22:01 +0300 Message-ID: <1118330521.15004.38.camel@blast.qumranet.com> References: <1118328113.15004.28.camel@blast.qumranet.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Kip Macy Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org 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 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@lists.xensource.com > > http://lists.xensource.com/xen-devel > >