« Previous | Next » 

Revision 366c9332

ID366c9332450caace5843c17806ba4879bf2d005c

Added by Michael Brown almost 10 years ago

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)->csr29" is a uint16_t, but "(S)->csr29 << 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)->csr29 has the high bit set, we end up with
crda=0xffffffffxxxxxxxx.

From: Michael Brown <>
Signed-off-by: Alex Williamson <>
Reviewed-by: Stefan Hajnoczi <>
Signed-off-by: Aurelien Jarno <>

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences