Commit 89bfc105d00202551fa669c2e2779dc15457a227

Authored by bellard
1 parent f32fc648

added last_io_time field - '-kernel-kqemu' experimental option


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1754 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 44 additions and 0 deletions
@@ -369,6 +369,10 @@ void cpu_outb(CPUState *env, int addr, int val) @@ -369,6 +369,10 @@ void cpu_outb(CPUState *env, int addr, int val)
369 fprintf(logfile, "outb: %04x %02x\n", addr, val); 369 fprintf(logfile, "outb: %04x %02x\n", addr, val);
370 #endif 370 #endif
371 ioport_write_table[0][addr](ioport_opaque[addr], addr, val); 371 ioport_write_table[0][addr](ioport_opaque[addr], addr, val);
  372 +#ifdef USE_KQEMU
  373 + if (env)
  374 + env->last_io_time = cpu_get_time_fast();
  375 +#endif
372 } 376 }
373 377
374 void cpu_outw(CPUState *env, int addr, int val) 378 void cpu_outw(CPUState *env, int addr, int val)
@@ -378,6 +382,10 @@ void cpu_outw(CPUState *env, int addr, int val) @@ -378,6 +382,10 @@ void cpu_outw(CPUState *env, int addr, int val)
378 fprintf(logfile, "outw: %04x %04x\n", addr, val); 382 fprintf(logfile, "outw: %04x %04x\n", addr, val);
379 #endif 383 #endif
380 ioport_write_table[1][addr](ioport_opaque[addr], addr, val); 384 ioport_write_table[1][addr](ioport_opaque[addr], addr, val);
  385 +#ifdef USE_KQEMU
  386 + if (env)
  387 + env->last_io_time = cpu_get_time_fast();
  388 +#endif
381 } 389 }
382 390
383 void cpu_outl(CPUState *env, int addr, int val) 391 void cpu_outl(CPUState *env, int addr, int val)
@@ -387,6 +395,10 @@ void cpu_outl(CPUState *env, int addr, int val) @@ -387,6 +395,10 @@ void cpu_outl(CPUState *env, int addr, int val)
387 fprintf(logfile, "outl: %04x %08x\n", addr, val); 395 fprintf(logfile, "outl: %04x %08x\n", addr, val);
388 #endif 396 #endif
389 ioport_write_table[2][addr](ioport_opaque[addr], addr, val); 397 ioport_write_table[2][addr](ioport_opaque[addr], addr, val);
  398 +#ifdef USE_KQEMU
  399 + if (env)
  400 + env->last_io_time = cpu_get_time_fast();
  401 +#endif
390 } 402 }
391 403
392 int cpu_inb(CPUState *env, int addr) 404 int cpu_inb(CPUState *env, int addr)
@@ -397,6 +409,10 @@ int cpu_inb(CPUState *env, int addr) @@ -397,6 +409,10 @@ int cpu_inb(CPUState *env, int addr)
397 if (loglevel & CPU_LOG_IOPORT) 409 if (loglevel & CPU_LOG_IOPORT)
398 fprintf(logfile, "inb : %04x %02x\n", addr, val); 410 fprintf(logfile, "inb : %04x %02x\n", addr, val);
399 #endif 411 #endif
  412 +#ifdef USE_KQEMU
  413 + if (env)
  414 + env->last_io_time = cpu_get_time_fast();
  415 +#endif
400 return val; 416 return val;
401 } 417 }
402 418
@@ -408,6 +424,10 @@ int cpu_inw(CPUState *env, int addr) @@ -408,6 +424,10 @@ int cpu_inw(CPUState *env, int addr)
408 if (loglevel & CPU_LOG_IOPORT) 424 if (loglevel & CPU_LOG_IOPORT)
409 fprintf(logfile, "inw : %04x %04x\n", addr, val); 425 fprintf(logfile, "inw : %04x %04x\n", addr, val);
410 #endif 426 #endif
  427 +#ifdef USE_KQEMU
  428 + if (env)
  429 + env->last_io_time = cpu_get_time_fast();
  430 +#endif
411 return val; 431 return val;
412 } 432 }
413 433
@@ -419,6 +439,10 @@ int cpu_inl(CPUState *env, int addr) @@ -419,6 +439,10 @@ int cpu_inl(CPUState *env, int addr)
419 if (loglevel & CPU_LOG_IOPORT) 439 if (loglevel & CPU_LOG_IOPORT)
420 fprintf(logfile, "inl : %04x %08x\n", addr, val); 440 fprintf(logfile, "inl : %04x %08x\n", addr, val);
421 #endif 441 #endif
  442 +#ifdef USE_KQEMU
  443 + if (env)
  444 + env->last_io_time = cpu_get_time_fast();
  445 +#endif
422 return val; 446 return val;
423 } 447 }
424 448
@@ -4018,6 +4042,9 @@ static CPUState *cur_cpu; @@ -4018,6 +4042,9 @@ static CPUState *cur_cpu;
4018 int main_loop(void) 4042 int main_loop(void)
4019 { 4043 {
4020 int ret, timeout; 4044 int ret, timeout;
  4045 +#ifdef CONFIG_PROFILER
  4046 + int64_t ti;
  4047 +#endif
4021 CPUState *env; 4048 CPUState *env;
4022 4049
4023 cur_cpu = first_cpu; 4050 cur_cpu = first_cpu;
@@ -4030,7 +4057,13 @@ int main_loop(void) @@ -4030,7 +4057,13 @@ int main_loop(void)
4030 env = env->next_cpu; 4057 env = env->next_cpu;
4031 if (!env) 4058 if (!env)
4032 env = first_cpu; 4059 env = first_cpu;
  4060 +#ifdef CONFIG_PROFILER
  4061 + ti = profile_getclock();
  4062 +#endif
4033 ret = cpu_exec(env); 4063 ret = cpu_exec(env);
  4064 +#ifdef CONFIG_PROFILER
  4065 + qemu_time += profile_getclock() - ti;
  4066 +#endif
4034 if (ret != EXCP_HALTED) 4067 if (ret != EXCP_HALTED)
4035 break; 4068 break;
4036 /* all CPUs are halted ? */ 4069 /* all CPUs are halted ? */
@@ -4067,7 +4100,13 @@ int main_loop(void) @@ -4067,7 +4100,13 @@ int main_loop(void)
4067 } else { 4100 } else {
4068 timeout = 10; 4101 timeout = 10;
4069 } 4102 }
  4103 +#ifdef CONFIG_PROFILER
  4104 + ti = profile_getclock();
  4105 +#endif
4070 main_loop_wait(timeout); 4106 main_loop_wait(timeout);
  4107 +#ifdef CONFIG_PROFILER
  4108 + dev_time += profile_getclock() - ti;
  4109 +#endif
4071 } 4110 }
4072 cpu_disable_ticks(); 4111 cpu_disable_ticks();
4073 return ret; 4112 return ret;
@@ -4250,6 +4289,7 @@ enum { @@ -4250,6 +4289,7 @@ enum {
4250 QEMU_OPTION_full_screen, 4289 QEMU_OPTION_full_screen,
4251 QEMU_OPTION_pidfile, 4290 QEMU_OPTION_pidfile,
4252 QEMU_OPTION_no_kqemu, 4291 QEMU_OPTION_no_kqemu,
  4292 + QEMU_OPTION_kernel_kqemu,
4253 QEMU_OPTION_win2k_hack, 4293 QEMU_OPTION_win2k_hack,
4254 QEMU_OPTION_usb, 4294 QEMU_OPTION_usb,
4255 QEMU_OPTION_usbdevice, 4295 QEMU_OPTION_usbdevice,
@@ -4305,6 +4345,7 @@ const QEMUOption qemu_options[] = { @@ -4305,6 +4345,7 @@ const QEMUOption qemu_options[] = {
4305 { "no-code-copy", 0, QEMU_OPTION_no_code_copy }, 4345 { "no-code-copy", 0, QEMU_OPTION_no_code_copy },
4306 #ifdef USE_KQEMU 4346 #ifdef USE_KQEMU
4307 { "no-kqemu", 0, QEMU_OPTION_no_kqemu }, 4347 { "no-kqemu", 0, QEMU_OPTION_no_kqemu },
  4348 + { "kernel-kqemu", 0, QEMU_OPTION_kernel_kqemu },
4308 #endif 4349 #endif
4309 #if defined(TARGET_PPC) || defined(TARGET_SPARC) 4350 #if defined(TARGET_PPC) || defined(TARGET_SPARC)
4310 { "g", 1, QEMU_OPTION_g }, 4351 { "g", 1, QEMU_OPTION_g },
@@ -4879,6 +4920,9 @@ int main(int argc, char **argv) @@ -4879,6 +4920,9 @@ int main(int argc, char **argv)
4879 case QEMU_OPTION_no_kqemu: 4920 case QEMU_OPTION_no_kqemu:
4880 kqemu_allowed = 0; 4921 kqemu_allowed = 0;
4881 break; 4922 break;
  4923 + case QEMU_OPTION_kernel_kqemu:
  4924 + kqemu_allowed = 2;
  4925 + break;
4882 #endif 4926 #endif
4883 case QEMU_OPTION_usb: 4927 case QEMU_OPTION_usb:
4884 usb_enabled = 1; 4928 usb_enabled = 1;