Commit db45c29a651ee955a5aad87af4c6676bc33ef6f8
1 parent
7d3505c5
faster I/Os - default 16 bit I/O fix
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@801 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
6 additions
and
10 deletions
vl.c
| ... | ... | @@ -147,15 +147,17 @@ void default_ioport_writeb(void *opaque, uint32_t address, uint32_t data) |
| 147 | 147 | uint32_t default_ioport_readw(void *opaque, uint32_t address) |
| 148 | 148 | { |
| 149 | 149 | uint32_t data; |
| 150 | - data = ioport_read_table[0][address & (MAX_IOPORTS - 1)](opaque, address); | |
| 151 | - data |= ioport_read_table[0][(address + 1) & (MAX_IOPORTS - 1)](opaque, address + 1) << 8; | |
| 150 | + data = ioport_read_table[0][address](ioport_opaque[address], address); | |
| 151 | + address = (address + 1) & (MAX_IOPORTS - 1); | |
| 152 | + data |= ioport_read_table[0][address](ioport_opaque[address], address) << 8; | |
| 152 | 153 | return data; |
| 153 | 154 | } |
| 154 | 155 | |
| 155 | 156 | void default_ioport_writew(void *opaque, uint32_t address, uint32_t data) |
| 156 | 157 | { |
| 157 | - ioport_write_table[0][address & (MAX_IOPORTS - 1)](opaque, address, data & 0xff); | |
| 158 | - ioport_write_table[0][(address + 1) & (MAX_IOPORTS - 1)](opaque, address + 1, (data >> 8) & 0xff); | |
| 158 | + ioport_write_table[0][address](ioport_opaque[address], address, data & 0xff); | |
| 159 | + address = (address + 1) & (MAX_IOPORTS - 1); | |
| 160 | + ioport_write_table[0][address](ioport_opaque[address], address, (data >> 8) & 0xff); | |
| 159 | 161 | } |
| 160 | 162 | |
| 161 | 163 | uint32_t default_ioport_readl(void *opaque, uint32_t address) |
| ... | ... | @@ -283,7 +285,6 @@ int load_image(const char *filename, uint8_t *addr) |
| 283 | 285 | |
| 284 | 286 | void cpu_outb(CPUState *env, int addr, int val) |
| 285 | 287 | { |
| 286 | - addr &= (MAX_IOPORTS - 1); | |
| 287 | 288 | #ifdef DEBUG_IOPORT |
| 288 | 289 | if (loglevel & CPU_LOG_IOPORT) |
| 289 | 290 | fprintf(logfile, "outb: %04x %02x\n", addr, val); |
| ... | ... | @@ -293,7 +294,6 @@ void cpu_outb(CPUState *env, int addr, int val) |
| 293 | 294 | |
| 294 | 295 | void cpu_outw(CPUState *env, int addr, int val) |
| 295 | 296 | { |
| 296 | - addr &= (MAX_IOPORTS - 1); | |
| 297 | 297 | #ifdef DEBUG_IOPORT |
| 298 | 298 | if (loglevel & CPU_LOG_IOPORT) |
| 299 | 299 | fprintf(logfile, "outw: %04x %04x\n", addr, val); |
| ... | ... | @@ -303,7 +303,6 @@ void cpu_outw(CPUState *env, int addr, int val) |
| 303 | 303 | |
| 304 | 304 | void cpu_outl(CPUState *env, int addr, int val) |
| 305 | 305 | { |
| 306 | - addr &= (MAX_IOPORTS - 1); | |
| 307 | 306 | #ifdef DEBUG_IOPORT |
| 308 | 307 | if (loglevel & CPU_LOG_IOPORT) |
| 309 | 308 | fprintf(logfile, "outl: %04x %08x\n", addr, val); |
| ... | ... | @@ -314,7 +313,6 @@ void cpu_outl(CPUState *env, int addr, int val) |
| 314 | 313 | int cpu_inb(CPUState *env, int addr) |
| 315 | 314 | { |
| 316 | 315 | int val; |
| 317 | - addr &= (MAX_IOPORTS - 1); | |
| 318 | 316 | val = ioport_read_table[0][addr](ioport_opaque[addr], addr); |
| 319 | 317 | #ifdef DEBUG_IOPORT |
| 320 | 318 | if (loglevel & CPU_LOG_IOPORT) |
| ... | ... | @@ -326,7 +324,6 @@ int cpu_inb(CPUState *env, int addr) |
| 326 | 324 | int cpu_inw(CPUState *env, int addr) |
| 327 | 325 | { |
| 328 | 326 | int val; |
| 329 | - addr &= (MAX_IOPORTS - 1); | |
| 330 | 327 | val = ioport_read_table[1][addr](ioport_opaque[addr], addr); |
| 331 | 328 | #ifdef DEBUG_IOPORT |
| 332 | 329 | if (loglevel & CPU_LOG_IOPORT) |
| ... | ... | @@ -338,7 +335,6 @@ int cpu_inw(CPUState *env, int addr) |
| 338 | 335 | int cpu_inl(CPUState *env, int addr) |
| 339 | 336 | { |
| 340 | 337 | int val; |
| 341 | - addr &= (MAX_IOPORTS - 1); | |
| 342 | 338 | val = ioport_read_table[2][addr](ioport_opaque[addr], addr); |
| 343 | 339 | #ifdef DEBUG_IOPORT |
| 344 | 340 | if (loglevel & CPU_LOG_IOPORT) | ... | ... |