# HG changeset patch # User Isaku Yamahata # Date 1211356962 -32400 # Node ID 9b9a503239d60b3595c772d9337c4a217960a93e # Parent f04ce41dab843b275ccb6636290e51c591ac2a06 [IA64] fix zero extending for mmio ld1/2/4 emulation This bug was found by Jes Soresen with kvm/ia64 as follows. This patch is xen/ia64 counterpart. > Only copy in the data actually requested by the instruction emulation > and zero pad the destination register first. This avoids the problem > where emulated mmio access got garbled data from ld2.acq instructions > in the vga console driver. Signed-off-by: Isaku Yamahata diff --git a/xen/arch/ia64/vmx/mmio.c b/xen/arch/ia64/vmx/mmio.c --- a/xen/arch/ia64/vmx/mmio.c +++ b/xen/arch/ia64/vmx/mmio.c @@ -170,8 +170,9 @@ } vmx_send_assist_req(v); - if (dir == IOREQ_READ) - *val = p->data; + if (dir == IOREQ_READ) + /* it's necessary to ensure zero extending */ + *val = p->data & (~0UL >> (64 - (s * 8))); return; }