Page 1 of 1

PIT on VMWare

Posted: Mon Feb 18, 2008 8:56 am
by AlfaOmega08
I'm programming the PIT following the JamesM tutorial.

On bochs it works fine (apart the bochs bug, time is 1000000000 time faster).
As I send the divisor split in two parts tho the port 0x40, VMWare sends me a warning:

Code: Select all

The host high-resolution timer device (/dev/rtc) cannot be opened (Device or resource busy).  It appears that some other application is using the device.  Without this device, the guest operating system can fail to keep time correctly. To avoid this problem, stop the conflicting application.  If that is not possible, see http://www.vmware.com/info?id=34.
Then the time runs like on bochs.
Can anyone help me?

Posted: Mon Feb 18, 2008 9:26 am
by AJ
Hi,

Looks like another app on your system is trying to use the RTC - you haven't got two instances of VMWare running at the same time, have you?

Cheers,
Adam

Posted: Mon Feb 18, 2008 12:30 pm
by AlfaOmega08
No, I've also tried to reboot my pc.

This is my code:

Code: Select all

	Bit32u divisor = 1193180 / freq;

	outportb(0x43, 0x36);

	Bit8u low = (Bit8u) (divisor & 0xFF);
	Bit8u high = (Bit8u) ((divisor >> 8) & 0xFF);

	outportb(0x40, low);
	outportb(0x40, high);

	irq::enable(irq::PIT);

where irq::PIT is equal to 0
EDIT: if I leave just the last line, without set a new frequency, it woks!
Maybe it works with the frequency leaved by grub

EDIT2: the Bran's tutorial gives the same error (ehm, the code is equal :)

Posted: Mon Feb 18, 2008 9:39 pm
by naiksidd_85
try checking in the edit setting tab for the VM
as if there is any other VM using the same device you will need to keep explicite setting so that it can be shared

Posted: Mon Feb 18, 2008 11:09 pm
by iammisc
see if any other app is using the rtc. Its not your os's fault. I think if you run lsof as root and see what program has /dev/rtc opened, you can end that program and it should work.

Posted: Tue Feb 19, 2008 2:52 am
by AlfaOmega08
It doesn't works :evil: :evil: :evil:

EDIT: Virtual PC doesn't send any message, it works like bochs :(

Posted: Sat Mar 08, 2008 1:29 pm
by kscguru
VMware uses two different time sources - normal host ticks (Linux HZ, which could be 100hz or 1000hz depending on your kernel) and /dev/rtc for higher-resolution time. It doesn't set up the higher-resolution mode unless the PIT is programmed to be faster than the host kernel tick rate (HZ + HZ/16 actually).

So, either program the PIT for something less frequent, or arrange for VMware's kernel module to get exclusive access to the PIT so that it can go that fast.

If you are feeling like Linux kernel internals, all the code is in hostif.c, which is shipped as source code for the vmmon driver when you download VMware.