--- trunk/src/memory.c 2007/10/08 16:19:11 18 +++ trunk/src/memory.c 2007/10/08 16:19:23 20 @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * - * $Id: memory.c,v 1.180 2005/10/25 15:51:02 debug Exp $ + * $Id: memory.c,v 1.182 2005/11/22 16:26:36 debug Exp $ * * Functions for handling the memory of an emulated machine. */ @@ -59,11 +59,16 @@ */ uint64_t memory_readmax64(struct cpu *cpu, unsigned char *buf, int len) { - int i; + int i, byte_order = cpu->byte_order; uint64_t x = 0; + if (len & MEM_PCI_LITTLE_ENDIAN) { + len &= ~MEM_PCI_LITTLE_ENDIAN; + byte_order = EMUL_LITTLE_ENDIAN; + } + /* Switch byte order for incoming data, if necessary: */ - if (cpu->byte_order == EMUL_BIG_ENDIAN) + if (byte_order == EMUL_BIG_ENDIAN) for (i=0; ibyte_order; + + if (len & MEM_PCI_LITTLE_ENDIAN) { + len &= ~MEM_PCI_LITTLE_ENDIAN; + byte_order = EMUL_LITTLE_ENDIAN; + } - if (cpu->byte_order == EMUL_LITTLE_ENDIAN) + if (byte_order == EMUL_LITTLE_ENDIAN) for (i=0; i>= 8; @@ -388,15 +398,15 @@ debug("device %2i at 0x%010llx: %s", mem->n_mmapped_devices, (long long)baseaddr, device_name); - if (flags & (MEM_DYNTRANS_OK | MEM_DYNTRANS_WRITE_OK) + if (flags & (DM_DYNTRANS_OK | DM_DYNTRANS_WRITE_OK) && (baseaddr & mem->dev_dyntrans_alignment) != 0) { fatal("\nWARNING: Device dyntrans access, but unaligned" " baseaddr 0x%llx.\n", (long long)baseaddr); } - if (flags & (MEM_DYNTRANS_OK | MEM_DYNTRANS_WRITE_OK)) { + if (flags & (DM_DYNTRANS_OK | DM_DYNTRANS_WRITE_OK)) { debug(" (dyntrans %s)", - (flags & MEM_DYNTRANS_WRITE_OK)? "R/W" : "R"); + (flags & DM_DYNTRANS_WRITE_OK)? "R/W" : "R"); } debug("\n"); @@ -412,8 +422,8 @@ exit(1); } - if (flags & (MEM_DYNTRANS_OK | MEM_DYNTRANS_WRITE_OK) - && !(flags & MEM_EMULATED_RAM) && dyntrans_data == NULL) { + if (flags & (DM_DYNTRANS_OK | DM_DYNTRANS_WRITE_OK) + && !(flags & DM_EMULATED_RAM) && dyntrans_data == NULL) { fatal("\nERROR: Device dyntrans access, but dyntrans_data" " = NULL!\n"); exit(1);