aboutsummaryrefslogtreecommitdiff
path: root/hw/rtl8139.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2012-05-07 15:00:45 +0300
committerMichael S. Tsirkin <mst@redhat.com>2012-05-08 17:09:53 +0300
commitbdc62e62ead1a6c2a113934bf28cb5abef48618d (patch)
tree879fc26ba0fb234b1a33c85ad2e433eabbb581fc /hw/rtl8139.c
parent847c25d01cbe8e4fe457a7426f82daaaf3287aae (diff)
downloadqemu-bdc62e62ead1a6c2a113934bf28cb5abef48618d.zip
qemu-bdc62e62ead1a6c2a113934bf28cb5abef48618d.tar.gz
qemu-bdc62e62ead1a6c2a113934bf28cb5abef48618d.tar.bz2
rtl8139: fix regression in TxStatus/TxAddr read
Commit afe0a595356192 added byte reads for TxStatus/TxAddr, but broke 32-bit reads; the mask generation (1 << (8 * size)) - 1 is unspecified in C for size >= sizeof(int), and in fact returns 0 on x86. Fix by using a larger type. Fixes (at least) Fedora 9 i386 with -machine kernel_irqchip=on. I didn't see it with the qemu APIC implementation; may be due to timing or (more likely) a tester error. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/rtl8139.c')
-rw-r--r--hw/rtl8139.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/rtl8139.c b/hw/rtl8139.c
index 4d0f5ba..eb22d04 100644
--- a/hw/rtl8139.c
+++ b/hw/rtl8139.c
@@ -2500,7 +2500,7 @@ static uint32_t rtl8139_TxStatus_TxAddr_read(RTL8139State *s, uint32_t regs[],
case 1: /* fall through */
case 2: /* fall through */
case 4:
- ret = (regs[reg] >> offset * 8) & ((1 << (size * 8)) - 1);
+ ret = (regs[reg] >> offset * 8) & (((uint64_t)1 << (size * 8)) - 1);
DPRINTF("TxStatus/TxAddr[%d] read addr=0x%x size=0x%x val=0x%08x\n",
reg, addr, size, ret);
break;