Revision aef445bd hw/ppc.c

b/hw/ppc.c
201 201
}
202 202
#endif
203 203

  
204
static void PPC_io_writeb (void *opaque, target_phys_addr_t addr, uint32_t value)
205
{
206
    cpu_outb(NULL, addr & 0xffff, value);
207
}
208

  
209
static uint32_t PPC_io_readb (void *opaque, target_phys_addr_t addr)
210
{
211
    uint32_t ret = cpu_inb(NULL, addr & 0xffff);
212
    return ret;
213
}
214

  
215
static void PPC_io_writew (void *opaque, target_phys_addr_t addr, uint32_t value)
216
{
217
#ifdef TARGET_WORDS_BIGENDIAN
218
    value = bswap16(value);
219
#endif
220
    cpu_outw(NULL, addr & 0xffff, value);
221
}
222

  
223
static uint32_t PPC_io_readw (void *opaque, target_phys_addr_t addr)
224
{
225
    uint32_t ret = cpu_inw(NULL, addr & 0xffff);
226
#ifdef TARGET_WORDS_BIGENDIAN
227
    ret = bswap16(ret);
228
#endif
229
    return ret;
230
}
231

  
232
static void PPC_io_writel (void *opaque, target_phys_addr_t addr, uint32_t value)
233
{
234
#ifdef TARGET_WORDS_BIGENDIAN
235
    value = bswap32(value);
236
#endif
237
    cpu_outl(NULL, addr & 0xffff, value);
238
}
239

  
240
static uint32_t PPC_io_readl (void *opaque, target_phys_addr_t addr)
241
{
242
    uint32_t ret = cpu_inl(NULL, addr & 0xffff);
243

  
244
#ifdef TARGET_WORDS_BIGENDIAN
245
    ret = bswap32(ret);
246
#endif
247
    return ret;
248
}
249

  
250
CPUWriteMemoryFunc *PPC_io_write[] = {
251
    &PPC_io_writeb,
252
    &PPC_io_writew,
253
    &PPC_io_writel,
254
};
255

  
256
CPUReadMemoryFunc *PPC_io_read[] = {
257
    &PPC_io_readb,
258
    &PPC_io_readw,
259
    &PPC_io_readl,
260
};
261

  
262 204
/*****************************************************************************/
263 205
/* Debug port */
264 206
void PPC_debug_write (void *opaque, uint32_t addr, uint32_t val)

Also available in: Unified diff