]> Git Repo - qemu.git/commit - hw/pcnet.c
pcnet: Fix sign extension: make ipxe work with >2G RAM
authorMichael Brown <[email protected]>
Tue, 15 Mar 2011 16:47:22 +0000 (10:47 -0600)
committerAurelien Jarno <[email protected]>
Fri, 1 Apr 2011 20:35:25 +0000 (22:35 +0200)
commit366c9332450caace5843c17806ba4879bf2d005c
tree1f852cf550f22eff813c385597299fc1b3903146
parente318a60b94b152c1e80125861a8917ae177d845e
pcnet: Fix sign extension: make ipxe work with >2G RAM

The problem is with definitions in hw/pcnet.c such as:

  #define CSR_CRDA(S)      ((S)->csr[28] | ((S)->csr[29] << 16))

"(S)->csr[29]" is a uint16_t, but "(S)->csr[29] << 16" gets promoted to
int, so the overall CSR_CRDA(s) is a (signed) int rather than a uint32_t.

This then gets assigned to a uint64_t using

  target_phys_addr_t crda = CSR_CRDA(s);

so when (S)->csr[29] has the high bit set, we end up with
crda=0xffffffffxxxxxxxx.

From: Michael Brown <[email protected]>
Signed-off-by: Alex Williamson <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
hw/pcnet.c
This page took 0.031398 seconds and 4 git commands to generate.