PIT on VMWare

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
AlfaOmega08
Member
Member
Posts: 226
Joined: Wed Nov 07, 2007 12:15 pm
Location: Italy

PIT on VMWare

Post 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?
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post 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
User avatar
AlfaOmega08
Member
Member
Posts: 226
Joined: Wed Nov 07, 2007 12:15 pm
Location: Italy

Post 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 :)
User avatar
naiksidd_85
Member
Member
Posts: 76
Joined: Thu Jan 17, 2008 1:15 am

Post 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
Learning a lot these days THANKS to OSdev users
iammisc
Member
Member
Posts: 269
Joined: Thu Nov 09, 2006 6:23 pm

Post 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.
User avatar
AlfaOmega08
Member
Member
Posts: 226
Joined: Wed Nov 07, 2007 12:15 pm
Location: Italy

Post by AlfaOmega08 »

It doesn't works :evil: :evil: :evil:

EDIT: Virtual PC doesn't send any message, it works like bochs :(
kscguru
Member
Member
Posts: 27
Joined: Sat Jan 19, 2008 12:29 pm

Post 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.
Post Reply