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
This commit is contained in:
iap10@labyrinth.cl.cam.ac.uk committed 2005-02-08 00:28:11 +00:00
1 parent 8f049f2ce1
commit 7a966c632d
2 files changed
+26 -8

No files matched your search

+24 -8
View File
@@ -167,6 +167,9 @@ bx_cpu_c::timer_handler(void)
#define rdtscl(low) \
__asm__ __volatile__("rdtsc" : "=a" (low) : : "edx")
#define rdtscll(val) \
__asm__ __volatile__("rdtsc" : "=A" (val))
void
bx_cpu_c::cpu_loop(int max_instr_count)
{
@@ -180,7 +183,8 @@ bx_cpu_c::cpu_loop(int max_instr_count)
FD_ZERO(&rfds);
while (1) {
unsigned long t1, t2;
static unsigned long long t1 = 0;
unsigned long long t2;
/* Wait up to one seconds. */
tv.tv_sec = 0;
@@ -188,18 +192,30 @@ bx_cpu_c::cpu_loop(int max_instr_count)
FD_SET(evtchn_fd, &rfds);
send_event = 0;
rdtscl(t1);
if (t1 == 0) // the first time
rdtscll(t1);
retval = select(evtchn_fd+1, &rfds, NULL, NULL, &tv);
rdtscl(t2);
if (retval == -1) {
perror("select");
return;
}
//stime_usec = 1000000 * (1 - tv.tv_sec) - tv.tv_usec;
if (t2 > t1)
BX_TICKN((t2 - t1) / 2000); // should match ips in bochsrc
rdtscll(t2);
#if __WORDSIZE == 32
#define ULONGLONG_MAX 0xffffffffffffffffULL
#else
#define ULONGLONG_MAX ULONG_MAX
#endif
if (t2 <= t1)
BX_TICKN((t2 + ULONGLONG_MAX - t1));
else
BX_TICKN((MAXINT - t1 + t2) / 2000); // should match ips in bochsrc
BX_TICKN((t2 - t1));
t1 = t2;
timer_handler();
if (BX_CPU_INTR) {
#if BX_SUPPORT_APIC
@@ -248,7 +264,7 @@ bx_cpu_c::interrupt(Bit8u vector)
// page.
rdtscl(tscl);
BX_INFO(("%lx: injecting vector: %x\n", tscl, vector));
BX_DEBUG(("%lx: injecting vector: %x\n", tscl, vector));
intr = &(((vcpu_iodata_t *) shared_page)->vp_intr[0]);
set_bit(vector, intr);
+2
View File
@@ -927,6 +927,8 @@ asmlinkage void vmx_vmexit_handler(struct xen_regs regs)
default:
__vmx_bug(&regs); /* should not happen */
}
vmx_intr_assist(d);
return;
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.