This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


答复: [Xen-devel] About TSS initialization when Xen booting.

To: "'Li, Xin B'" <xin.b.li@xxxxxxxxx>
Subject: 答复: [Xen-devel] About TSS initialization when Xen booting.
From: 李亚琼 <liyaq04@xxxxxxxxxx>
Date: Tue, 7 Aug 2007 09:27:06 +0800
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Mon, 06 Aug 2007 18:24:59 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <B30DA1341B0CFA4893EF8A36B40B5C5D017D46EA@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcfYJ7WQMXWtzI5eQACLswZl41y5OgAGZJ/gABKqQWA=

Thanks, Xin!

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’s 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?

Another question is about percpu_traps_init whick code is following:

void __init percpu_traps_init(void)


char *stack_bottom, *stack;




    stack_bottom = (char *)get_stack_bottom();

    stack        = (char *)((unsigned long)stack_bottom & ~(STACK_SIZE - 1));


    /* Double-fault handler has its own per-CPU 2kB stack. */

    init_tss[cpu].ist[0] = (unsigned long)&stack[2048];


    /* NMI handler has its own per-CPU 1kB stack. */

    init_tss[cpu].ist[1] = (unsigned long)&stack[3072];



     * Trampoline for SYSCALL entry from long mode.



    /* Skip the NMI and DF stacks. */

    stack = &stack[3072];

    wrmsr(MSR_LSTAR, (unsigned long)stack, ((unsigned long)stack>>32));


    /* movq %rsp, saversp(%rip) */

    stack[0] = 0x48;

    stack[1] = 0x89;

    stack[2] = 0x25;

*(u32 *)&stack[3] = (stack_bottom - &stack[7]) - 16;





The question is about the variables,  “stack”  and “stack_bottom”. At this moment, if guest_cpu_user_regs has not been initialized, “stack_bottom” will be zero when the cpu is the first physical cpu ( its stack is initialized with zero in file boot.S). And then “stack” will be zero, too. Is it correct?


-Techie, lee


发件人: Li, Xin B [mailto:xin.b.li@xxxxxxxxx]
发送时间: 2007年8月6 23:50
收件人: 李亚琼; xen-devel@xxxxxxxxxxxxxxxxxxx
主题: RE: [Xen-devel] About TSS initialization when Xen booting.


In __context_switch, there is a memcpy to do this job.




From: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx [mailto:xen-devel-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of 李亚琼
Sent: Monday, August 06, 2007 8:46 PM
To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] About TSS initialization when Xen booting.


         I have a doubt on the Tss initialization. In the function cpu_init(),t->rsp0 = get_stack_bottom().

#define get_stack_bottom()                      \

           ((unsigned long)&get_cpu_info()->guest_cpu_user_regs.es)

         But I can’t find where the guest_cpu_user_regs has been initialized. Anybody can help me?





Xen-devel mailing list