direct-io.hg

changeset 3568:002034af24e6

bitkeeper revision 1.1159.231.11 (41f97e1amKuDHSrW5ZWKsTy4ZIfNRA)

Fix the direction flag for string I/O instructions.

Signed-off-by: Jun Nakajima <jun.nakajima@intel.com>
Signed-off-by: Chengyuan Li <chengyuan.li@intel.com>
Signed-off-by: ian.pratt@cl.cam.ac.uk
author iap10@labyrinth.cl.cam.ac.uk
date Thu Jan 27 23:49:46 2005 +0000 (2005-01-27)
parents 3fef449b1078
children cd26f113b1b1
files xen/arch/x86/vmx.c xen/arch/x86/vmx_io.c xen/include/public/io/ioreq.h
line diff
     1.1 --- a/xen/arch/x86/vmx.c	Thu Jan 27 23:45:32 2005 +0000
     1.2 +++ b/xen/arch/x86/vmx.c	Thu Jan 27 23:49:46 2005 +0000
     1.3 @@ -352,6 +352,10 @@ static void vmx_io_instruction(struct xe
     1.4      p->size = (exit_qualification & 7) + 1;
     1.5  
     1.6      if (test_bit(4, &exit_qualification)) {
     1.7 +        unsigned long eflags;
     1.8 +
     1.9 +        __vmread(GUEST_EFLAGS, &eflags);
    1.10 +        p->df = (eflags & X86_EFLAGS_DF) ? 1 : 0;
    1.11          p->pdata_valid = 1;
    1.12          p->u.pdata = (void *) ((p->dir == IOREQ_WRITE) ?
    1.13              regs->esi
     2.1 --- a/xen/arch/x86/vmx_io.c	Thu Jan 27 23:45:32 2005 +0000
     2.2 +++ b/xen/arch/x86/vmx_io.c	Thu Jan 27 23:49:46 2005 +0000
     2.3 @@ -39,8 +39,7 @@ void vmx_io_assist(struct exec_domain *e
     2.4      struct domain *d = ed->domain;
     2.5      execution_context_t *ec = get_execution_context();
     2.6      unsigned long old_eax;
     2.7 -    unsigned long eflags;
     2.8 -    int dir;
     2.9 +    int sign;
    2.10  
    2.11      /* clear the pending event */
    2.12      ed->vcpu_info->evtchn_upcall_pending = 0;
    2.13 @@ -68,24 +67,27 @@ void vmx_io_assist(struct exec_domain *e
    2.14          return;
    2.15      }
    2.16  
    2.17 -    __vmread(GUEST_EFLAGS, &eflags);
    2.18 -    dir = (eflags & X86_EFLAGS_DF);
    2.19 +    sign = (p->df) ? -1 : 1;
    2.20 +    if (p->port_mm) {
    2.21 +        if (p->pdata_valid) {
    2.22 +            ec->esi += sign * p->count * p->size;
    2.23 +            ec->edi += sign * p->count * p->size;
    2.24 +        } else {
    2.25 +            if (p->dir == IOREQ_WRITE) {
    2.26 +                return;
    2.27 +            }
    2.28 +        }
    2.29 +    }
    2.30  
    2.31      if (p->dir == IOREQ_WRITE) {
    2.32          if (p->pdata_valid) {
    2.33 -            if (!dir)
    2.34 -                ec->esi += p->count * p->size;
    2.35 -            else
    2.36 -                ec->esi -= p->count * p->size;
    2.37 +            ec->esi += sign * p->count * p->size;
    2.38              ec->ecx -= p->count;
    2.39          }
    2.40          return;
    2.41      } else {
    2.42          if (p->pdata_valid) {
    2.43 -            if (!dir)
    2.44 -                ec->edi += p->count * p->size;
    2.45 -            else
    2.46 -                ec->edi -= p->count * p->size;
    2.47 +            ec->edi += sign * p->count * p->size;
    2.48              ec->ecx -= p->count;
    2.49              return;
    2.50          }
     3.1 --- a/xen/include/public/io/ioreq.h	Thu Jan 27 23:45:32 2005 +0000
     3.2 +++ b/xen/include/public/io/ioreq.h	Thu Jan 27 23:49:46 2005 +0000
     3.3 @@ -41,10 +41,11 @@ typedef struct {
     3.4          u64     data;           /*  data                        */
     3.5          void    *pdata;         /*  pointer to data             */
     3.6      } u;
     3.7 -    u8      state:5;
     3.8 +    u8      state:4;
     3.9      u8      pdata_valid:1;	/* if 1, use pdata above        */
    3.10      u8      dir:1;		/*  1=read, 0=write             */
    3.11      u8      port_mm:1;		/*  0=portio, 1=mmio            */
    3.12 +    u8      df:1;
    3.13  } ioreq_t;
    3.14  
    3.15  #define MAX_VECTOR    256