ia64/xen-unstable

changeset 14308:7e2f7e8b63d3

[BUILDER]: Initialize code segment selectors in virtual IDT to 0.
These should not be set until the guest kernel kernel configures an
entry point otherwise the null_trap_bounce() check gets confused.

This change was made to the old domain builder in 12455:3fa6635d04b9
but was lost in the transition to the new builder.

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
author Ian Campbell <ian.campbell@xensource.com>
date Thu Mar 08 15:35:28 2007 +0000 (2007-03-08)
parents 38513d22d234
children 345effaf2258
files tools/libxc/xc_dom_x86.c
line diff
     1.1 --- a/tools/libxc/xc_dom_x86.c	Thu Mar 08 15:21:10 2007 +0000
     1.2 +++ b/tools/libxc/xc_dom_x86.c	Thu Mar 08 15:35:28 2007 +0000
     1.3 @@ -433,24 +433,12 @@ static int vcpu_x86_32(struct xc_dom_ima
     1.4  {
     1.5      vcpu_guest_context_x86_32_t *ctxt = ptr;
     1.6      xen_pfn_t cr3_pfn;
     1.7 -    int i;
     1.8  
     1.9      xc_dom_printf("%s: called\n", __FUNCTION__);
    1.10  
    1.11      /* clear everything */
    1.12      memset(ctxt, 0, sizeof(*ctxt));
    1.13  
    1.14 -    /* Virtual IDT is empty at start-of-day. */
    1.15 -    for ( i = 0; i < 256; i++ )
    1.16 -    {
    1.17 -        ctxt->trap_ctxt[i].vector = i;
    1.18 -        ctxt->trap_ctxt[i].cs = FLAT_KERNEL_CS_X86_32;
    1.19 -    }
    1.20 -
    1.21 -    /* No callback handlers. */
    1.22 -    ctxt->event_callback_cs = FLAT_KERNEL_CS_X86_32;
    1.23 -    ctxt->failsafe_callback_cs = FLAT_KERNEL_CS_X86_32;
    1.24 -
    1.25      ctxt->user_regs.ds = FLAT_KERNEL_DS_X86_32;
    1.26      ctxt->user_regs.es = FLAT_KERNEL_DS_X86_32;
    1.27      ctxt->user_regs.fs = FLAT_KERNEL_DS_X86_32;
    1.28 @@ -464,9 +452,8 @@ static int vcpu_x86_32(struct xc_dom_ima
    1.29          dom->parms.virt_base + (dom->start_info_pfn) * PAGE_SIZE_X86;
    1.30      ctxt->user_regs.eflags = 1 << 9; /* Interrupt Enable */
    1.31  
    1.32 -    ctxt->kernel_ss = FLAT_KERNEL_SS_X86_32;
    1.33 -    ctxt->kernel_sp =
    1.34 -        dom->parms.virt_base + (dom->bootstack_pfn + 1) * PAGE_SIZE_X86;
    1.35 +    ctxt->kernel_ss = ctxt->user_regs.ss;
    1.36 +    ctxt->kernel_sp = ctxt->user_regs.esp;
    1.37  
    1.38      ctxt->flags = VGCF_in_kernel_X86_32;
    1.39      if ( dom->parms.pae == 2 /* extended_cr3 */ ||
    1.40 @@ -485,20 +472,12 @@ static int vcpu_x86_64(struct xc_dom_ima
    1.41  {
    1.42      vcpu_guest_context_x86_64_t *ctxt = ptr;
    1.43      xen_pfn_t cr3_pfn;
    1.44 -    int i;
    1.45  
    1.46      xc_dom_printf("%s: called\n", __FUNCTION__);
    1.47  
    1.48      /* clear everything */
    1.49      memset(ctxt, 0, sizeof(*ctxt));
    1.50  
    1.51 -    /* Virtual IDT is empty at start-of-day. */
    1.52 -    for ( i = 0; i < 256; i++ )
    1.53 -    {
    1.54 -        ctxt->trap_ctxt[i].vector = i;
    1.55 -        ctxt->trap_ctxt[i].cs = FLAT_KERNEL_CS_X86_64;
    1.56 -    }
    1.57 -
    1.58      ctxt->user_regs.ds = FLAT_KERNEL_DS_X86_64;
    1.59      ctxt->user_regs.es = FLAT_KERNEL_DS_X86_64;
    1.60      ctxt->user_regs.fs = FLAT_KERNEL_DS_X86_64;
    1.61 @@ -512,9 +491,8 @@ static int vcpu_x86_64(struct xc_dom_ima
    1.62          dom->parms.virt_base + (dom->start_info_pfn) * PAGE_SIZE_X86;
    1.63      ctxt->user_regs.rflags = 1 << 9; /* Interrupt Enable */
    1.64  
    1.65 -    ctxt->kernel_ss = FLAT_KERNEL_SS_X86_64;
    1.66 -    ctxt->kernel_sp =
    1.67 -        dom->parms.virt_base + (dom->bootstack_pfn + 1) * PAGE_SIZE_X86;
    1.68 +    ctxt->kernel_ss = ctxt->user_regs.ss;
    1.69 +    ctxt->kernel_sp = ctxt->user_regs.esp;
    1.70  
    1.71      ctxt->flags = VGCF_in_kernel_X86_64;
    1.72      cr3_pfn = xc_dom_p2m_guest(dom, dom->pgtables_seg.pfn);