From: =?gb2312?B?wO7Rx8ft?= Subject: =?gb2312?B?tPC4tDogtPC4tDogW1hlbi1kZXZlbF0gQWJvdXQgVFNTaW5pdGlhbA==?= =?gb2312?B?aXphdGlvbiB3aGVuIFhlbiBib290aW5nLg==?= Date: Tue, 7 Aug 2007 15:20:52 +0800 Message-ID: <20070807070938.923BF13685E@ncic.ac.cn> References: <1186469557.6686.5.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <1186469557.6686.5.camel@localhost.localdomain> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: 'Ian Campbell' Cc: "'Li, Xin B'" , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Hi,Ian I know what you mean. But the problem is that guest_cpu_user_regs.es (the macro of get_frame_bottom() returns this value) is used to = initialize the TSS when it has not been initialized. If TSS has not been = initialized correctly, Xen can't switch to the kernel stack of the current cpu when = a interrupt or trap occurs. Tss initialization should correctly be = initialized before a interrupt or trap occurs. But I can't find where guest_cpu_user_regs.es is initialized before used to initialize TSS in function percpu_traps_init(). Hope your reply! -Techie.lee 2007-8-7 -----=D3=CA=BC=FE=D4=AD=BC=FE----- =B7=A2=BC=FE=C8=CB: Ian Campbell [mailto:Ian.Campbell@XenSource.com]=20 =B7=A2=CB=CD=CA=B1=BC=E4: 2007=C4=EA8=D4=C27=C8=D5 14:53 =CA=D5=BC=FE=C8=CB: =C0=EE=D1=C7=C7=ED =B3=AD=CB=CD: 'Li, Xin B';=20 =D6=F7=CC=E2: Re: =B4=F0=B8=B4: [Xen-devel] About TSSinitialization when = Xen booting. On Tue, 2007-08-07 at 09:27 +0800, =C0=EE=D1=C7=C7=ED wrote: > Thanks, Xin! >=20 > But __context_switch will be invoked only when system is scheduled. > During the initialization, Xen invokes percpu_traps_init and cpu_init > to initialize a physical cpu. In this two functions, tss will be > assigned with a value from guest_cpu_user_regs. But till this time, > __context_switch has never been invoked. In other words, = idle_domain=A1=AFs > tss is assigned with a trivial value. After all, when Xen is in the > idle domain, a stack switch will occur when a interrupt occurs. Is it > correct? get_cpu_info returns a pointer into the stack. guest_cpu_user_regs is a member of the structure this pointer points to (but not a pointer itself). It has been arranged so that guest_cpu_user_regs overlaps the part of the stack where entry.S will save the guests registers (mainly in the SAVE_ALL macro). This should make sense because the TSS is being initialised with exactly the value you wish the stack to have when transitioning to ring0. > The question is about the variables, =A1=B0stack=A1=B1 and = =A1=B0stack_bottom=A1=B1. At > this moment, if guest_cpu_user_regs has not been initialized, > =A1=B0stack_bottom=A1=B1 will be zero when the cpu is the first = physical cpu > ( its stack is initialized with zero in file boot.S). And then = =A1=B0stack=A1=B1 > will be zero, too. Is it correct? Remember that guest_cpu_user_regs isn't a pointer, it's just a member of a struct so it's address will currently be the address of that struct plus an offset. Ian.