Commit 57ccbabecb4101200a48bfd748a6aa33ff3c27b0
1 parent
eb26db16
allow 32 but unaligned access (aka Win PCI network bug - initial patch by Renzo Davoli)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@909 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
4 additions
and
4 deletions
hw/ne2000.c
| @@ -401,10 +401,10 @@ static inline void ne2000_mem_writew(NE2000State *s, uint32_t addr, | @@ -401,10 +401,10 @@ static inline void ne2000_mem_writew(NE2000State *s, uint32_t addr, | ||
| 401 | static inline void ne2000_mem_writel(NE2000State *s, uint32_t addr, | 401 | static inline void ne2000_mem_writel(NE2000State *s, uint32_t addr, |
| 402 | uint32_t val) | 402 | uint32_t val) |
| 403 | { | 403 | { |
| 404 | - addr &= ~3; /* XXX: check exact behaviour if not even */ | 404 | + addr &= ~1; /* XXX: check exact behaviour if not even */ |
| 405 | if (addr < 32 || | 405 | if (addr < 32 || |
| 406 | (addr >= NE2000_PMEM_START && addr < NE2000_MEM_SIZE)) { | 406 | (addr >= NE2000_PMEM_START && addr < NE2000_MEM_SIZE)) { |
| 407 | - *(uint32_t *)(s->mem + addr) = cpu_to_le32(val); | 407 | + cpu_to_le32wu((uint32_t *)(s->mem + addr), val); |
| 408 | } | 408 | } |
| 409 | } | 409 | } |
| 410 | 410 | ||
| @@ -431,10 +431,10 @@ static inline uint32_t ne2000_mem_readw(NE2000State *s, uint32_t addr) | @@ -431,10 +431,10 @@ static inline uint32_t ne2000_mem_readw(NE2000State *s, uint32_t addr) | ||
| 431 | 431 | ||
| 432 | static inline uint32_t ne2000_mem_readl(NE2000State *s, uint32_t addr) | 432 | static inline uint32_t ne2000_mem_readl(NE2000State *s, uint32_t addr) |
| 433 | { | 433 | { |
| 434 | - addr &= ~3; /* XXX: check exact behaviour if not even */ | 434 | + addr &= ~1; /* XXX: check exact behaviour if not even */ |
| 435 | if (addr < 32 || | 435 | if (addr < 32 || |
| 436 | (addr >= NE2000_PMEM_START && addr < NE2000_MEM_SIZE)) { | 436 | (addr >= NE2000_PMEM_START && addr < NE2000_MEM_SIZE)) { |
| 437 | - return le32_to_cpu(*(uint32_t *)(s->mem + addr)); | 437 | + return le32_to_cpupu((uint32_t *)(s->mem + addr)); |
| 438 | } else { | 438 | } else { |
| 439 | return 0xffffffff; | 439 | return 0xffffffff; |
| 440 | } | 440 | } |