]> xenbits.xensource.com Git - xen.git/commitdiff
bitkeeper revision 1.1159.121.1 (4177beeaW8q0uSb63tuGsNIZ6Knm0g)
authorkaf24@freefall.cl.cam.ac.uk <kaf24@freefall.cl.cam.ac.uk>
Thu, 21 Oct 2004 13:51:38 +0000 (13:51 +0000)
committerkaf24@freefall.cl.cam.ac.uk <kaf24@freefall.cl.cam.ac.uk>
Thu, 21 Oct 2004 13:51:38 +0000 (13:51 +0000)
Relocate execution context out of shared_info area (no sense in it
being guest-accessible unless/until we do scheduler activations).

xen/arch/x86/dom0_ops.c
xen/arch/x86/domain.c
xen/include/asm-x86/processor.h
xen/include/hypervisor-ifs/dom0_ops.h
xen/include/hypervisor-ifs/hypervisor-if.h

index 6472a932525d63a6b96b45112bb5783caeff22ac..ce677b1165640beb6b4eb739649993adba83830f 100644 (file)
@@ -107,8 +107,8 @@ void arch_getdomaininfo_ctxt(struct domain *d, full_execution_context_t *c)
 
     c->flags = 0;
     memcpy(&c->cpu_ctxt, 
-           &d->shared_info->execution_context,
-           sizeof(d->shared_info->execution_context));
+           &d->thread.user_ctxt,
+           sizeof(d->thread.user_ctxt));
     if ( test_bit(DF_DONEFPUINIT, &d->flags) )
         c->flags |= ECF_I387_VALID;
     memcpy(&c->fpu_ctxt,
index ef77bb728b07e561bedbc853edc730d99fffdc71..f54b0c1fad93653e35f153cef4b1ca49457decc6 100644 (file)
@@ -240,9 +240,18 @@ int arch_final_setup_guestos(struct domain *d, full_execution_context_t *c)
     if ( c->flags & ECF_I387_VALID )
         set_bit(DF_DONEFPUINIT, &d->flags);
 
-    memcpy(&d->shared_info->execution_context,
+    memcpy(&d->thread.user_ctxt,
            &c->cpu_ctxt,
-           sizeof(d->shared_info->execution_context));
+           sizeof(d->thread.user_ctxt));
+
+    /*
+     * This is sufficient! If the descriptor DPL differs from CS RPL then we'll
+     * #GP. If DS, ES, FS, GS are DPL 0 then they'll be cleared automatically.
+     * If SS RPL or DPL differs from CS RPL then we'll #GP.
+     */
+    if ( ((d->thread.user_ctxt.cs & 3) == 0) ||
+         ((d->thread.user_ctxt.ss & 3) == 0) )
+        return -EINVAL;
 
     memcpy(&d->thread.i387,
            &c->fpu_ctxt,
@@ -295,12 +304,12 @@ int arch_final_setup_guestos(struct domain *d, full_execution_context_t *c)
 
 #if defined(__i386__)
 
-void new_thread(struct domain *p,
+void new_thread(struct domain *d,
                 unsigned long start_pc,
                 unsigned long start_stack,
                 unsigned long start_info)
 {
-    execution_context_t *ec = &p->shared_info->execution_context;
+    execution_context_t *ec = &d->thread.user_ctxt;
 
     /*
      * Initial register values:
@@ -320,7 +329,7 @@ void new_thread(struct domain *p,
     ec->eflags |= X86_EFLAGS_IF;
 
     /* No fast trap at start of day. */
-    SET_DEFAULT_FAST_TRAP(&p->thread);
+    SET_DEFAULT_FAST_TRAP(&d->thread);
 }
 
 
@@ -345,7 +354,7 @@ void switch_to(struct domain *prev_p, struct domain *next_p)
     /* Switch guest general-register state. */
     if ( !is_idle_task(prev_p) )
     {
-        memcpy(&prev_p->shared_info->execution_context, 
+        memcpy(&prev_p->thread.user_ctxt,
                stack_ec, 
                sizeof(*stack_ec));
         unlazy_fpu(prev_p);
@@ -355,19 +364,9 @@ void switch_to(struct domain *prev_p, struct domain *next_p)
     if ( !is_idle_task(next_p) )
     {
         memcpy(stack_ec,
-               &next_p->shared_info->execution_context,
+               &next_p->thread.user_ctxt,
                sizeof(*stack_ec));
 
-        /*
-         * This is sufficient! If the descriptor DPL differs from CS RPL then 
-         * we'll #GP. If DS, ES, FS, GS are DPL 0 then they'll be cleared 
-         * automatically. If SS RPL or DPL differs from CS RPL then we'll #GP.
-         */
-        if ( (stack_ec->cs & 3) == 0 )
-            stack_ec->cs = FLAT_RING1_CS;
-        if ( (stack_ec->ss & 3) == 0 )
-            stack_ec->ss = FLAT_RING1_DS;
-
         SET_FAST_TRAP(&next_p->thread);
 
         /* Switch the guest OS ring-1 stack. */
index 739ed7005bcc6a236a254f34934d6eda46ee6a99..770d7cf30110723f438efb6817042c606d490c96 100644 (file)
@@ -291,6 +291,8 @@ struct thread_struct {
     unsigned long      debugreg[8];  /* %%db0-7 debug registers */
 /* floating point info */
     struct i387_state  i387;
+/* general user-visible register state */
+    execution_context_t user_ctxt;
 /* Trap info. */
 #ifdef __i386__
     int                fast_trap_idx;
@@ -331,6 +333,7 @@ long set_fast_trap(struct domain *p, int idx);
        0, 0,                                                   \
        { [0 ... 7] = 0 },      /* debugging registers */       \
        { { 0, }, },            /* 387 state */                 \
+       { 0 },                                                  \
        0x20, { 0, 0 },         /* DEFAULT_FAST_TRAP */         \
        { {0} }                 /* io permissions */            \
 }
index 56f4014dbd29b927d7ac7bce6d23b59cdd0bad0d..11bec43e95b7bec9b432f505a931899d0bd27d83 100644 (file)
@@ -19,7 +19,7 @@
  * This makes sure that old versions of dom0 tools will stop working in a
  * well-defined way (rather than crashing the machine, for instance).
  */
-#define DOM0_INTERFACE_VERSION   0xAAAA0016
+#define DOM0_INTERFACE_VERSION   0xAAAA0017
 
 #define MAX_DOMAIN_NAME    16
 
index c7874bd708793e0051401ec9ea42dc8ac92dcfd0..1038d3c88d5f4069498744591bd8971b46a07b33 100644 (file)
@@ -358,8 +358,6 @@ typedef struct shared_info_st
     u64                wall_timeout;    /* 312 */
     u64                domain_timeout;  /* 320 */
 
-    execution_context_t execution_context; /* 328 */
-
     arch_shared_info_t arch;
 
 } PACKED shared_info_t;