From 680e4150eeae0ae3f0ba3301a6232b7d69f5263e Mon Sep 17 00:00:00 2001 From: "kaf24@freefall.cl.cam.ac.uk" Date: Thu, 21 Oct 2004 13:51:38 +0000 Subject: [PATCH] bitkeeper revision 1.1159.121.1 (4177beeaW8q0uSb63tuGsNIZ6Knm0g) 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 | 4 +-- xen/arch/x86/domain.c | 33 +++++++++++----------- xen/include/asm-x86/processor.h | 3 ++ xen/include/hypervisor-ifs/dom0_ops.h | 2 +- xen/include/hypervisor-ifs/hypervisor-if.h | 2 -- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/xen/arch/x86/dom0_ops.c b/xen/arch/x86/dom0_ops.c index 6472a93252..ce677b1165 100644 --- a/xen/arch/x86/dom0_ops.c +++ b/xen/arch/x86/dom0_ops.c @@ -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, diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index ef77bb728b..f54b0c1fad 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -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. */ diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h index 739ed7005b..770d7cf301 100644 --- a/xen/include/asm-x86/processor.h +++ b/xen/include/asm-x86/processor.h @@ -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 */ \ } diff --git a/xen/include/hypervisor-ifs/dom0_ops.h b/xen/include/hypervisor-ifs/dom0_ops.h index 56f4014dbd..11bec43e95 100644 --- a/xen/include/hypervisor-ifs/dom0_ops.h +++ b/xen/include/hypervisor-ifs/dom0_ops.h @@ -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 diff --git a/xen/include/hypervisor-ifs/hypervisor-if.h b/xen/include/hypervisor-ifs/hypervisor-if.h index c7874bd708..1038d3c88d 100644 --- a/xen/include/hypervisor-ifs/hypervisor-if.h +++ b/xen/include/hypervisor-ifs/hypervisor-if.h @@ -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; -- 2.39.5