aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_dom_x86.c
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@xensource.com>2007-03-08 15:35:28 +0000
committerIan Campbell <ian.campbell@xensource.com>2007-03-08 15:35:28 +0000
commit75c73974d7d41d0d28c743ce3cb551c856c6d190 (patch)
tree65751c558482813c8207171c381333b36898ddab /tools/libxc/xc_dom_x86.c
parente653a8058e7b9db57ca0af167580a108fc2622bd (diff)
downloadxen-75c73974d7d41d0d28c743ce3cb551c856c6d190.tar.gz
xen-75c73974d7d41d0d28c743ce3cb551c856c6d190.tar.bz2
xen-75c73974d7d41d0d28c743ce3cb551c856c6d190.zip
[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>
Diffstat (limited to 'tools/libxc/xc_dom_x86.c')
-rw-r--r--tools/libxc/xc_dom_x86.c30
1 files changed, 4 insertions, 26 deletions
diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c
index 695e5a168d..19296daf10 100644
--- a/tools/libxc/xc_dom_x86.c
+++ b/tools/libxc/xc_dom_x86.c
@@ -433,24 +433,12 @@ static int vcpu_x86_32(struct xc_dom_image *dom, void *ptr)
{
vcpu_guest_context_x86_32_t *ctxt = ptr;
xen_pfn_t cr3_pfn;
- int i;
xc_dom_printf("%s: called\n", __FUNCTION__);
/* clear everything */
memset(ctxt, 0, sizeof(*ctxt));
- /* Virtual IDT is empty at start-of-day. */
- for ( i = 0; i < 256; i++ )
- {
- ctxt->trap_ctxt[i].vector = i;
- ctxt->trap_ctxt[i].cs = FLAT_KERNEL_CS_X86_32;
- }
-
- /* No callback handlers. */
- ctxt->event_callback_cs = FLAT_KERNEL_CS_X86_32;
- ctxt->failsafe_callback_cs = FLAT_KERNEL_CS_X86_32;
-
ctxt->user_regs.ds = FLAT_KERNEL_DS_X86_32;
ctxt->user_regs.es = FLAT_KERNEL_DS_X86_32;
ctxt->user_regs.fs = FLAT_KERNEL_DS_X86_32;
@@ -464,9 +452,8 @@ static int vcpu_x86_32(struct xc_dom_image *dom, void *ptr)
dom->parms.virt_base + (dom->start_info_pfn) * PAGE_SIZE_X86;
ctxt->user_regs.eflags = 1 << 9; /* Interrupt Enable */
- ctxt->kernel_ss = FLAT_KERNEL_SS_X86_32;
- ctxt->kernel_sp =
- dom->parms.virt_base + (dom->bootstack_pfn + 1) * PAGE_SIZE_X86;
+ ctxt->kernel_ss = ctxt->user_regs.ss;
+ ctxt->kernel_sp = ctxt->user_regs.esp;
ctxt->flags = VGCF_in_kernel_X86_32;
if ( dom->parms.pae == 2 /* extended_cr3 */ ||
@@ -485,20 +472,12 @@ static int vcpu_x86_64(struct xc_dom_image *dom, void *ptr)
{
vcpu_guest_context_x86_64_t *ctxt = ptr;
xen_pfn_t cr3_pfn;
- int i;
xc_dom_printf("%s: called\n", __FUNCTION__);
/* clear everything */
memset(ctxt, 0, sizeof(*ctxt));
- /* Virtual IDT is empty at start-of-day. */
- for ( i = 0; i < 256; i++ )
- {
- ctxt->trap_ctxt[i].vector = i;
- ctxt->trap_ctxt[i].cs = FLAT_KERNEL_CS_X86_64;
- }
-
ctxt->user_regs.ds = FLAT_KERNEL_DS_X86_64;
ctxt->user_regs.es = FLAT_KERNEL_DS_X86_64;
ctxt->user_regs.fs = FLAT_KERNEL_DS_X86_64;
@@ -512,9 +491,8 @@ static int vcpu_x86_64(struct xc_dom_image *dom, void *ptr)
dom->parms.virt_base + (dom->start_info_pfn) * PAGE_SIZE_X86;
ctxt->user_regs.rflags = 1 << 9; /* Interrupt Enable */
- ctxt->kernel_ss = FLAT_KERNEL_SS_X86_64;
- ctxt->kernel_sp =
- dom->parms.virt_base + (dom->bootstack_pfn + 1) * PAGE_SIZE_X86;
+ ctxt->kernel_ss = ctxt->user_regs.ss;
+ ctxt->kernel_sp = ctxt->user_regs.esp;
ctxt->flags = VGCF_in_kernel_X86_64;
cr3_pfn = xc_dom_p2m_guest(dom, dom->pgtables_seg.pfn);