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