« Previous | Next » 

Revision 366c9332


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

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


  • added
  • modified
  • copied
  • renamed
  • deleted

View differences