Commit f1c85677fc83b82e737223bfbff11241caa050b4

Authored by bellard
1 parent 5f1ce948

added last_io_time field


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1752 c046a42c-6fe2-441c-8c8c-71466251a162
softmmu_template.h
@@ -68,6 +68,9 @@ static inline DATA_TYPE glue(io_read, SUFFIX)(target_phys_addr_t physaddr, @@ -68,6 +68,9 @@ static inline DATA_TYPE glue(io_read, SUFFIX)(target_phys_addr_t physaddr,
68 res |= (uint64_t)io_mem_read[index][2](io_mem_opaque[index], physaddr + 4) << 32; 68 res |= (uint64_t)io_mem_read[index][2](io_mem_opaque[index], physaddr + 4) << 32;
69 #endif 69 #endif
70 #endif /* SHIFT > 2 */ 70 #endif /* SHIFT > 2 */
  71 +#ifdef USE_KQEMU
  72 + env->last_io_time = cpu_get_time_fast();
  73 +#endif
71 return res; 74 return res;
72 } 75 }
73 76
@@ -201,6 +204,9 @@ static inline void glue(io_write, SUFFIX)(target_phys_addr_t physaddr, @@ -201,6 +204,9 @@ static inline void glue(io_write, SUFFIX)(target_phys_addr_t physaddr,
201 io_mem_write[index][2](io_mem_opaque[index], physaddr + 4, val >> 32); 204 io_mem_write[index][2](io_mem_opaque[index], physaddr + 4, val >> 32);
202 #endif 205 #endif
203 #endif /* SHIFT > 2 */ 206 #endif /* SHIFT > 2 */
  207 +#ifdef USE_KQEMU
  208 + env->last_io_time = cpu_get_time_fast();
  209 +#endif
204 } 210 }
205 211
206 void REGPARM(2) glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr, 212 void REGPARM(2) glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr,
target-i386/cpu.h
@@ -522,6 +522,7 @@ typedef struct CPUX86State { @@ -522,6 +522,7 @@ typedef struct CPUX86State {
522 522
523 #ifdef USE_KQEMU 523 #ifdef USE_KQEMU
524 int kqemu_enabled; 524 int kqemu_enabled;
  525 + int last_io_time;
525 #endif 526 #endif
526 /* in order to simplify APIC support, we leave this pointer to the 527 /* in order to simplify APIC support, we leave this pointer to the
527 user */ 528 user */
@@ -637,6 +638,15 @@ void cpu_x86_update_cr0(CPUX86State *env, uint32_t new_cr0); @@ -637,6 +638,15 @@ void cpu_x86_update_cr0(CPUX86State *env, uint32_t new_cr0);
637 #define X86_DUMP_FPU 0x0001 /* dump FPU state too */ 638 #define X86_DUMP_FPU 0x0001 /* dump FPU state too */
638 #define X86_DUMP_CCOP 0x0002 /* dump qemu flag cache */ 639 #define X86_DUMP_CCOP 0x0002 /* dump qemu flag cache */
639 640
  641 +#ifdef USE_KQEMU
  642 +static inline int cpu_get_time_fast(void)
  643 +{
  644 + int low, high;
  645 + asm volatile("rdtsc" : "=a" (low), "=d" (high));
  646 + return low;
  647 +}
  648 +#endif
  649 +
640 #define TARGET_PAGE_BITS 12 650 #define TARGET_PAGE_BITS 12
641 #include "cpu-all.h" 651 #include "cpu-all.h"
642 652