ia64/xen-unstable

changeset 3584:5e111ac8c357

bitkeeper revision 1.1159.212.53 (41fabd0652DGdYKsgWToGTyAOUlZKg)

Fix the direction flag for string I/O instructions -- missing hunk from earlier patch

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 Fri Jan 28 22:30:30 2005 +0000 (2005-01-28)
parents 6d98eb831816
children c3c66a2762cb
files tools/ioemu/iodev/cpu.cc
line diff
     1.1 --- a/tools/ioemu/iodev/cpu.cc	Fri Jan 28 16:34:08 2005 +0000
     1.2 +++ b/tools/ioemu/iodev/cpu.cc	Fri Jan 28 22:30:30 2005 +0000
     1.3 @@ -83,6 +83,9 @@ ioreq_t* bx_cpu_c::get_ioreq(void)
     1.4  void bx_cpu_c::dispatch_ioreq(ioreq_t *req)
     1.5  {
     1.6  	int ret, i;
     1.7 +    int sign;
     1.8 +
     1.9 +    sign = (req->df) ? -1 : 1;
    1.10  
    1.11  	if ((!req->pdata_valid) && (req->dir == IOREQ_WRITE)) {
    1.12  		if (req->size != 4) {
    1.13 @@ -99,7 +102,7 @@ void bx_cpu_c::dispatch_ioreq(ioreq_t *r
    1.14  
    1.15  				for (i = 0; i < req->count; i++) {
    1.16  					tmp = BX_INP(req->addr, req->size);
    1.17 -					BX_MEM_WRITE_PHYSICAL((Bit32u) req->u.pdata + (i * req->size), 
    1.18 +					BX_MEM_WRITE_PHYSICAL((Bit32u) req->u.pdata + (sign * i * req->size), 
    1.19  							       req->size, &tmp);
    1.20  				}
    1.21  			}
    1.22 @@ -110,7 +113,7 @@ void bx_cpu_c::dispatch_ioreq(ioreq_t *r
    1.23  				for (i = 0; i < req->count; i++) {
    1.24  					unsigned long tmp;
    1.25  
    1.26 -					BX_MEM_READ_PHYSICAL((Bit32u) req->u.pdata + (i * req->size), req->size, 
    1.27 +					BX_MEM_READ_PHYSICAL((Bit32u) req->u.pdata + (sign * i * req->size), req->size, 
    1.28  							 &tmp);
    1.29  					BX_OUTP(req->addr, (Bit32u) tmp, req->size);
    1.30  				}
    1.31 @@ -129,14 +132,14 @@ void bx_cpu_c::dispatch_ioreq(ioreq_t *r
    1.32  			if (req->dir == IOREQ_READ) {
    1.33  				//BX_INFO(("<READ>addr:%llx, pdata:%llx, size: %x, count: %x\n", req->addr, req->u.pdata, req->size, req->count));
    1.34  				for (i = 0; i < req->count; i++) {
    1.35 -					BX_MEM_READ_PHYSICAL(req->addr + (i * req->size), req->size, &tmp);
    1.36 -					BX_MEM_WRITE_PHYSICAL((Bit32u) req->u.pdata + (i * req->size), req->size, &tmp);
    1.37 +					BX_MEM_READ_PHYSICAL(req->addr + (sign * i * req->size), req->size, &tmp);
    1.38 +					BX_MEM_WRITE_PHYSICAL((Bit32u) req->u.pdata + (sign * i * req->size), req->size, &tmp);
    1.39  				}
    1.40  			} else if (req->dir == IOREQ_WRITE) {
    1.41  				//BX_INFO(("<WRITE>addr:%llx, pdata:%llx, size: %x, count: %x\n", req->addr, req->u.pdata, req->size, req->count));
    1.42  				for (i = 0; i < req->count; i++) {
    1.43 -					BX_MEM_READ_PHYSICAL((Bit32u)req->u.pdata + (i * req->size), req->size, &tmp);
    1.44 -					BX_MEM_WRITE_PHYSICAL(req->addr + (i * req->size), req->size, &tmp);
    1.45 +					BX_MEM_READ_PHYSICAL((Bit32u)req->u.pdata + (sign * i * req->size), req->size, &tmp);
    1.46 +					BX_MEM_WRITE_PHYSICAL(req->addr + (sign * i * req->size), req->size, &tmp);
    1.47  				}
    1.48  			}
    1.49  		}