debuggers.hg
changeset 3741:5f2499c315cd
bitkeeper revision 1.1159.212.116 (4208079bssB3TTrruGComoEvhNrq9Q)
Fix some of the time virtualization issues.
- Compute the elapsed time correctly in the cpu loop
- Try to inject interrupts in the vmexit handler
Signed-off-by: Edwin Zhai <edwin.zhai@intel.com>
Signed-off-by: Arun Sharma <arun.sharma@intel.com>
Signed-off-by: ian@xensource.com
Fix some of the time virtualization issues.
- Compute the elapsed time correctly in the cpu loop
- Try to inject interrupts in the vmexit handler
Signed-off-by: Edwin Zhai <edwin.zhai@intel.com>
Signed-off-by: Arun Sharma <arun.sharma@intel.com>
Signed-off-by: ian@xensource.com
author | iap10@labyrinth.cl.cam.ac.uk |
---|---|
date | Tue Feb 08 00:28:11 2005 +0000 (2005-02-08) |
parents | d3e70af90f15 |
children | 9bf9541713e7 |
files | tools/ioemu/iodev/cpu.cc xen/arch/x86/vmx.c |
line diff
1.1 --- a/tools/ioemu/iodev/cpu.cc Mon Feb 07 19:45:56 2005 +0000 1.2 +++ b/tools/ioemu/iodev/cpu.cc Tue Feb 08 00:28:11 2005 +0000 1.3 @@ -167,6 +167,9 @@ bx_cpu_c::timer_handler(void) 1.4 #define rdtscl(low) \ 1.5 __asm__ __volatile__("rdtsc" : "=a" (low) : : "edx") 1.6 1.7 +#define rdtscll(val) \ 1.8 + __asm__ __volatile__("rdtsc" : "=A" (val)) 1.9 + 1.10 void 1.11 bx_cpu_c::cpu_loop(int max_instr_count) 1.12 { 1.13 @@ -180,7 +183,8 @@ bx_cpu_c::cpu_loop(int max_instr_count) 1.14 FD_ZERO(&rfds); 1.15 1.16 while (1) { 1.17 - unsigned long t1, t2; 1.18 + static unsigned long long t1 = 0; 1.19 + unsigned long long t2; 1.20 1.21 /* Wait up to one seconds. */ 1.22 tv.tv_sec = 0; 1.23 @@ -188,18 +192,30 @@ bx_cpu_c::cpu_loop(int max_instr_count) 1.24 FD_SET(evtchn_fd, &rfds); 1.25 1.26 send_event = 0; 1.27 - rdtscl(t1); 1.28 + 1.29 + if (t1 == 0) // the first time 1.30 + rdtscll(t1); 1.31 + 1.32 retval = select(evtchn_fd+1, &rfds, NULL, NULL, &tv); 1.33 - rdtscl(t2); 1.34 if (retval == -1) { 1.35 perror("select"); 1.36 return; 1.37 } 1.38 - //stime_usec = 1000000 * (1 - tv.tv_sec) - tv.tv_usec; 1.39 - if (t2 > t1) 1.40 - BX_TICKN((t2 - t1) / 2000); // should match ips in bochsrc 1.41 + 1.42 + rdtscll(t2); 1.43 + 1.44 +#if __WORDSIZE == 32 1.45 +#define ULONGLONG_MAX 0xffffffffffffffffULL 1.46 +#else 1.47 +#define ULONGLONG_MAX ULONG_MAX 1.48 +#endif 1.49 + 1.50 + if (t2 <= t1) 1.51 + BX_TICKN((t2 + ULONGLONG_MAX - t1)); 1.52 else 1.53 - BX_TICKN((MAXINT - t1 + t2) / 2000); // should match ips in bochsrc 1.54 + BX_TICKN((t2 - t1)); 1.55 + t1 = t2; 1.56 + 1.57 timer_handler(); 1.58 if (BX_CPU_INTR) { 1.59 #if BX_SUPPORT_APIC 1.60 @@ -248,7 +264,7 @@ bx_cpu_c::interrupt(Bit8u vector) 1.61 // page. 1.62 1.63 rdtscl(tscl); 1.64 - BX_INFO(("%lx: injecting vector: %x\n", tscl, vector)); 1.65 + BX_DEBUG(("%lx: injecting vector: %x\n", tscl, vector)); 1.66 intr = &(((vcpu_iodata_t *) shared_page)->vp_intr[0]); 1.67 set_bit(vector, intr); 1.68
2.1 --- a/xen/arch/x86/vmx.c Mon Feb 07 19:45:56 2005 +0000 2.2 +++ b/xen/arch/x86/vmx.c Tue Feb 08 00:28:11 2005 +0000 2.3 @@ -927,6 +927,8 @@ asmlinkage void vmx_vmexit_handler(struc 2.4 default: 2.5 __vmx_bug(®s); /* should not happen */ 2.6 } 2.7 + 2.8 + vmx_intr_assist(d); 2.9 return; 2.10 } 2.11