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,15 +147,17 @@ void default_ioport_writeb(void *opaque, uint32_t address, uint32_t data) | ||
147 | uint32_t default_ioport_readw(void *opaque, uint32_t address) | 147 | uint32_t default_ioport_readw(void *opaque, uint32_t address) |
148 | { | 148 | { |
149 | uint32_t data; | 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 | return data; | 153 | return data; |
153 | } | 154 | } |
154 | 155 | ||
155 | void default_ioport_writew(void *opaque, uint32_t address, uint32_t data) | 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 | uint32_t default_ioport_readl(void *opaque, uint32_t address) | 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,7 +285,6 @@ int load_image(const char *filename, uint8_t *addr) | ||
283 | 285 | ||
284 | void cpu_outb(CPUState *env, int addr, int val) | 286 | void cpu_outb(CPUState *env, int addr, int val) |
285 | { | 287 | { |
286 | - addr &= (MAX_IOPORTS - 1); | ||
287 | #ifdef DEBUG_IOPORT | 288 | #ifdef DEBUG_IOPORT |
288 | if (loglevel & CPU_LOG_IOPORT) | 289 | if (loglevel & CPU_LOG_IOPORT) |
289 | fprintf(logfile, "outb: %04x %02x\n", addr, val); | 290 | fprintf(logfile, "outb: %04x %02x\n", addr, val); |
@@ -293,7 +294,6 @@ void cpu_outb(CPUState *env, int addr, int val) | @@ -293,7 +294,6 @@ void cpu_outb(CPUState *env, int addr, int val) | ||
293 | 294 | ||
294 | void cpu_outw(CPUState *env, int addr, int val) | 295 | void cpu_outw(CPUState *env, int addr, int val) |
295 | { | 296 | { |
296 | - addr &= (MAX_IOPORTS - 1); | ||
297 | #ifdef DEBUG_IOPORT | 297 | #ifdef DEBUG_IOPORT |
298 | if (loglevel & CPU_LOG_IOPORT) | 298 | if (loglevel & CPU_LOG_IOPORT) |
299 | fprintf(logfile, "outw: %04x %04x\n", addr, val); | 299 | fprintf(logfile, "outw: %04x %04x\n", addr, val); |
@@ -303,7 +303,6 @@ void cpu_outw(CPUState *env, int addr, int val) | @@ -303,7 +303,6 @@ void cpu_outw(CPUState *env, int addr, int val) | ||
303 | 303 | ||
304 | void cpu_outl(CPUState *env, int addr, int val) | 304 | void cpu_outl(CPUState *env, int addr, int val) |
305 | { | 305 | { |
306 | - addr &= (MAX_IOPORTS - 1); | ||
307 | #ifdef DEBUG_IOPORT | 306 | #ifdef DEBUG_IOPORT |
308 | if (loglevel & CPU_LOG_IOPORT) | 307 | if (loglevel & CPU_LOG_IOPORT) |
309 | fprintf(logfile, "outl: %04x %08x\n", addr, val); | 308 | fprintf(logfile, "outl: %04x %08x\n", addr, val); |
@@ -314,7 +313,6 @@ void cpu_outl(CPUState *env, int addr, int val) | @@ -314,7 +313,6 @@ void cpu_outl(CPUState *env, int addr, int val) | ||
314 | int cpu_inb(CPUState *env, int addr) | 313 | int cpu_inb(CPUState *env, int addr) |
315 | { | 314 | { |
316 | int val; | 315 | int val; |
317 | - addr &= (MAX_IOPORTS - 1); | ||
318 | val = ioport_read_table[0][addr](ioport_opaque[addr], addr); | 316 | val = ioport_read_table[0][addr](ioport_opaque[addr], addr); |
319 | #ifdef DEBUG_IOPORT | 317 | #ifdef DEBUG_IOPORT |
320 | if (loglevel & CPU_LOG_IOPORT) | 318 | if (loglevel & CPU_LOG_IOPORT) |
@@ -326,7 +324,6 @@ int cpu_inb(CPUState *env, int addr) | @@ -326,7 +324,6 @@ int cpu_inb(CPUState *env, int addr) | ||
326 | int cpu_inw(CPUState *env, int addr) | 324 | int cpu_inw(CPUState *env, int addr) |
327 | { | 325 | { |
328 | int val; | 326 | int val; |
329 | - addr &= (MAX_IOPORTS - 1); | ||
330 | val = ioport_read_table[1][addr](ioport_opaque[addr], addr); | 327 | val = ioport_read_table[1][addr](ioport_opaque[addr], addr); |
331 | #ifdef DEBUG_IOPORT | 328 | #ifdef DEBUG_IOPORT |
332 | if (loglevel & CPU_LOG_IOPORT) | 329 | if (loglevel & CPU_LOG_IOPORT) |
@@ -338,7 +335,6 @@ int cpu_inw(CPUState *env, int addr) | @@ -338,7 +335,6 @@ int cpu_inw(CPUState *env, int addr) | ||
338 | int cpu_inl(CPUState *env, int addr) | 335 | int cpu_inl(CPUState *env, int addr) |
339 | { | 336 | { |
340 | int val; | 337 | int val; |
341 | - addr &= (MAX_IOPORTS - 1); | ||
342 | val = ioport_read_table[2][addr](ioport_opaque[addr], addr); | 338 | val = ioport_read_table[2][addr](ioport_opaque[addr], addr); |
343 | #ifdef DEBUG_IOPORT | 339 | #ifdef DEBUG_IOPORT |
344 | if (loglevel & CPU_LOG_IOPORT) | 340 | if (loglevel & CPU_LOG_IOPORT) |