Commit f658b4db792285d0ddc044d7532451b8ec3c4a08

Authored by bellard
1 parent 0c4ad8dc

isa bridge endianness fixes


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@761 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 12 additions and 4 deletions
hw/ppc_prep.c
... ... @@ -137,7 +137,6 @@ static uint32_t PPC_io_readb (target_phys_addr_t addr)
137 137 {
138 138 PPC_IO_DPRINTF("0x%08x <= 0x%02x\n", addr - PPC_IO_BASE, ret);
139 139 }
140   -
141 140 return ret;
142 141 }
143 142  
... ... @@ -147,24 +146,31 @@ static void PPC_io_writew (target_phys_addr_t addr, uint32_t value)
147 146 (addr < 0x80000170 || addr > 0x80000177)) {
148 147 PPC_IO_DPRINTF("0x%08x => 0x%04x\n", addr - PPC_IO_BASE, value);
149 148 }
  149 +#ifdef TARGET_WORDS_BIGENDIAN
  150 + value = bswap16(value);
  151 +#endif
150 152 cpu_outw(NULL, addr - PPC_IO_BASE, value);
151 153 }
152 154  
153 155 static uint32_t PPC_io_readw (target_phys_addr_t addr)
154 156 {
155 157 uint32_t ret = cpu_inw(NULL, addr - PPC_IO_BASE);
156   -
  158 +#ifdef TARGET_WORDS_BIGENDIAN
  159 + ret = bswap16(ret);
  160 +#endif
157 161 if ((addr < 0x800001f0 || addr > 0x800001f7) &&
158 162 (addr < 0x80000170 || addr > 0x80000177)) {
159 163 PPC_IO_DPRINTF("0x%08x <= 0x%04x\n", addr - PPC_IO_BASE, ret);
160 164 }
161   -
162 165 return ret;
163 166 }
164 167  
165 168 static void PPC_io_writel (target_phys_addr_t addr, uint32_t value)
166 169 {
167 170 PPC_IO_DPRINTF("0x%08x => 0x%08x\n", addr - PPC_IO_BASE, value);
  171 +#ifdef TARGET_WORDS_BIGENDIAN
  172 + value = bswap32(value);
  173 +#endif
168 174 cpu_outl(NULL, addr - PPC_IO_BASE, value);
169 175 }
170 176  
... ... @@ -172,8 +178,10 @@ static uint32_t PPC_io_readl (target_phys_addr_t addr)
172 178 {
173 179 uint32_t ret = cpu_inl(NULL, addr - PPC_IO_BASE);
174 180  
  181 +#ifdef TARGET_WORDS_BIGENDIAN
  182 + ret = bswap32(ret);
  183 +#endif
175 184 PPC_IO_DPRINTF("0x%08x <= 0x%08x\n", addr - PPC_IO_BASE, ret);
176   -
177 185 return ret;
178 186 }
179 187  
... ...