direct-io.hg

changeset 12454:a9d2106313fa

[BUILDER] Simplify vcpu context initialisation by pre-zeroing
the context structure.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
author kfraser@localhost.localdomain
date Wed Nov 15 16:53:43 2006 +0000 (2006-11-15)
parents bda05853cf21
children 3fa6635d04b9
files tools/libxc/xc_linux_build.c
line diff
     1.1 --- a/tools/libxc/xc_linux_build.c	Wed Nov 15 16:44:35 2006 +0000
     1.2 +++ b/tools/libxc/xc_linux_build.c	Wed Nov 15 16:53:43 2006 +0000
     1.3 @@ -1120,11 +1120,9 @@ static int xc_linux_build_internal(int x
     1.4          }
     1.5      }
     1.6  
     1.7 -#ifdef VALGRIND
     1.8 -    memset(&st_ctxt, 0, sizeof(st_ctxt));
     1.9 -#endif
    1.10 +    memset(ctxt, 0, sizeof(*ctxt));
    1.11  
    1.12 -    if ( lock_pages(&st_ctxt, sizeof(st_ctxt) ) )
    1.13 +    if ( lock_pages(ctxt, sizeof(*ctxt) ) )
    1.14      {
    1.15          PERROR("%s: ctxt lock failed", __func__);
    1.16          return 1;
    1.17 @@ -1139,8 +1137,6 @@ static int xc_linux_build_internal(int x
    1.18          goto error_out;
    1.19      }
    1.20  
    1.21 -    memset(ctxt, 0, sizeof(*ctxt));
    1.22 -
    1.23      if ( setup_guest(xc_handle, domid, image, image_size,
    1.24                       initrd,
    1.25                       mem_mb << (20 - PAGE_SHIFT),
    1.26 @@ -1157,8 +1153,6 @@ static int xc_linux_build_internal(int x
    1.27  
    1.28  #ifdef __ia64__
    1.29      /* based on new_thread in xen/arch/ia64/domain.c */
    1.30 -    ctxt->flags = 0;
    1.31 -    ctxt->user_regs.cr_ipsr = 0; /* all necessary bits filled by hypervisor */
    1.32      ctxt->user_regs.cr_iip = vkern_entry;
    1.33      ctxt->user_regs.cr_ifs = 1UL << 63;
    1.34      ctxt->user_regs.ar_fpsr = xc_ia64_fpsr_default();
    1.35 @@ -1186,9 +1180,6 @@ static int xc_linux_build_internal(int x
    1.36  
    1.37      ctxt->flags = VGCF_IN_KERNEL;
    1.38  
    1.39 -    /* FPU is set up to default initial state. */
    1.40 -    memset(&ctxt->fpu_ctxt, 0, sizeof(ctxt->fpu_ctxt));
    1.41 -
    1.42      /* Virtual IDT is empty at start-of-day. */
    1.43      for ( i = 0; i < 256; i++ )
    1.44      {
    1.45 @@ -1196,33 +1187,17 @@ static int xc_linux_build_internal(int x
    1.46          ctxt->trap_ctxt[i].cs     = FLAT_KERNEL_CS;
    1.47      }
    1.48  
    1.49 -    /* No LDT. */
    1.50 -    ctxt->ldt_ents = 0;
    1.51 -
    1.52 -    /* Use the default Xen-provided GDT. */
    1.53 -    ctxt->gdt_ents = 0;
    1.54 -
    1.55      /* Ring 1 stack is the initial stack. */
    1.56      ctxt->kernel_ss = FLAT_KERNEL_SS;
    1.57      ctxt->kernel_sp = vstack_start + PAGE_SIZE;
    1.58  
    1.59 -    /* No debugging. */
    1.60 -    memset(ctxt->debugreg, 0, sizeof(ctxt->debugreg));
    1.61 -
    1.62 -    /* No callback handlers. */
    1.63  #if defined(__i386__)
    1.64      ctxt->event_callback_cs     = FLAT_KERNEL_CS;
    1.65 -    ctxt->event_callback_eip    = 0;
    1.66      ctxt->failsafe_callback_cs  = FLAT_KERNEL_CS;
    1.67 -    ctxt->failsafe_callback_eip = 0;
    1.68 -#elif defined(__x86_64__)
    1.69 -    ctxt->event_callback_eip    = 0;
    1.70 -    ctxt->failsafe_callback_eip = 0;
    1.71 -    ctxt->syscall_callback_eip  = 0;
    1.72  #endif
    1.73  #endif /* x86 */
    1.74  
    1.75 -    memset( &launch_domctl, 0, sizeof(launch_domctl) );
    1.76 +    memset(&launch_domctl, 0, sizeof(launch_domctl));
    1.77  
    1.78      launch_domctl.domain = (domid_t)domid;
    1.79      launch_domctl.u.vcpucontext.vcpu   = 0;