diff options
author | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2006-11-15 16:53:43 +0000 |
---|---|---|
committer | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2006-11-15 16:53:43 +0000 |
commit | ede52a632efac804908377f9b270fb1d432b8142 (patch) | |
tree | 63c88b77ee5821206277666f9a3c40916f5476c4 /tools/libxc | |
parent | c4db5246aa43757c0bdfd7d7e46f5e11e176dab6 (diff) | |
download | xen-ede52a632efac804908377f9b270fb1d432b8142.tar.gz xen-ede52a632efac804908377f9b270fb1d432b8142.tar.bz2 xen-ede52a632efac804908377f9b270fb1d432b8142.zip |
[BUILDER] Simplify vcpu context initialisation by pre-zeroing
the context structure.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Diffstat (limited to 'tools/libxc')
-rw-r--r-- | tools/libxc/xc_linux_build.c | 31 |
1 files changed, 3 insertions, 28 deletions
diff --git a/tools/libxc/xc_linux_build.c b/tools/libxc/xc_linux_build.c index fb616ca706..6b550d390b 100644 --- a/tools/libxc/xc_linux_build.c +++ b/tools/libxc/xc_linux_build.c @@ -1120,11 +1120,9 @@ static int xc_linux_build_internal(int xc_handle, } } -#ifdef VALGRIND - memset(&st_ctxt, 0, sizeof(st_ctxt)); -#endif + memset(ctxt, 0, sizeof(*ctxt)); - if ( lock_pages(&st_ctxt, sizeof(st_ctxt) ) ) + if ( lock_pages(ctxt, sizeof(*ctxt) ) ) { PERROR("%s: ctxt lock failed", __func__); return 1; @@ -1139,8 +1137,6 @@ static int xc_linux_build_internal(int xc_handle, goto error_out; } - memset(ctxt, 0, sizeof(*ctxt)); - if ( setup_guest(xc_handle, domid, image, image_size, initrd, mem_mb << (20 - PAGE_SHIFT), @@ -1157,8 +1153,6 @@ static int xc_linux_build_internal(int xc_handle, #ifdef __ia64__ /* based on new_thread in xen/arch/ia64/domain.c */ - ctxt->flags = 0; - ctxt->user_regs.cr_ipsr = 0; /* all necessary bits filled by hypervisor */ ctxt->user_regs.cr_iip = vkern_entry; ctxt->user_regs.cr_ifs = 1UL << 63; ctxt->user_regs.ar_fpsr = xc_ia64_fpsr_default(); @@ -1186,9 +1180,6 @@ static int xc_linux_build_internal(int xc_handle, ctxt->flags = VGCF_IN_KERNEL; - /* FPU is set up to default initial state. */ - memset(&ctxt->fpu_ctxt, 0, sizeof(ctxt->fpu_ctxt)); - /* Virtual IDT is empty at start-of-day. */ for ( i = 0; i < 256; i++ ) { @@ -1196,33 +1187,17 @@ static int xc_linux_build_internal(int xc_handle, ctxt->trap_ctxt[i].cs = FLAT_KERNEL_CS; } - /* No LDT. */ - ctxt->ldt_ents = 0; - - /* Use the default Xen-provided GDT. */ - ctxt->gdt_ents = 0; - /* Ring 1 stack is the initial stack. */ ctxt->kernel_ss = FLAT_KERNEL_SS; ctxt->kernel_sp = vstack_start + PAGE_SIZE; - /* No debugging. */ - memset(ctxt->debugreg, 0, sizeof(ctxt->debugreg)); - - /* No callback handlers. */ #if defined(__i386__) ctxt->event_callback_cs = FLAT_KERNEL_CS; - ctxt->event_callback_eip = 0; ctxt->failsafe_callback_cs = FLAT_KERNEL_CS; - ctxt->failsafe_callback_eip = 0; -#elif defined(__x86_64__) - ctxt->event_callback_eip = 0; - ctxt->failsafe_callback_eip = 0; - ctxt->syscall_callback_eip = 0; #endif #endif /* x86 */ - memset( &launch_domctl, 0, sizeof(launch_domctl) ); + memset(&launch_domctl, 0, sizeof(launch_domctl)); launch_domctl.domain = (domid_t)domid; launch_domctl.u.vcpucontext.vcpu = 0; |