Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Jan 2008 11:03:23 -0500
From:      Ed Maste <emaste@freebsd.org>
To:        Mike Silbersack <silby@silby.com>
Cc:        Robert Watson <rwatson@FreeBSD.org>, "Bruce M. Simpson" <bms@FreeBSD.org>, current@freebsd.org
Subject:   Re: [patch] Auto-setting hz to 100 inside QEMU/VMWare
Message-ID:  <20080102160322.GA83957@sandvine.com>
In-Reply-To: <20080101222654.A8764@odysseus.silby.com>
References:  <20071228015651.X1565@odysseus.silby.com> <20071228095539.F45653@fledge.watson.org> <20071229180004.O6052@odysseus.silby.com> <477A627A.8010601@FreeBSD.org> <20080101222654.A8764@odysseus.silby.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--t0UkRYy7tHLRMCai
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Tue, Jan 01, 2008 at 10:27:28PM -0600, Mike Silbersack wrote:

> It looks like we're going to go with an alternate implementation that 
> resides in the loader instead.  The effect will be the same, and it should 
> be committed within a few days.

I've attached a proof of concept patch that does this in forth in the
loader.  I've been using something similar for a while; this patch isi
cleaned up somewhat and I've added the kenv strings from Mike's patch.

I've only tried it out with qemu so far.  I'd appreciate reports of any
testing with other emulators, and comments from loader/forth gurus.

-Ed

--t0UkRYy7tHLRMCai
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="loader_vm.diff"

Index: sys/boot/forth/vm.4th
===================================================================
RCS file: sys/boot/forth/vm.4th
diff -N sys/boot/forth/vm.4th
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ sys/boot/forth/vm.4th	2 Jan 2008 15:38:41 -0000
@@ -0,0 +1,35 @@
+: check-env? ( addr len addr len -- flag )
+	getenv
+	dup -1 <> if
+		compare 0= if
+			true exit
+		then
+	else
+		drop
+		2drop
+	then
+	false
+;
+
+: is-vm? ( -- flag )
+	s" QEMU  " s" hint.acpi.0.oem" check-env? if
+		true exit
+	then
+	s" VBOX  " s" hint.acpi.0.oem" check-env? if
+		true exit
+	then
+	s" VMware, Inc." s" smbios.system.maker" check-env? if
+		true exit
+	then
+	s" Parallels Software International Inc." s" smbios.bios.vendor"
+	    check-env? if
+		true exit
+	then
+	false
+;
+
+: setup-vm
+	is-vm? if
+		s" 100" s" hz" setenv
+	then
+;
Index: sys/boot/i386/loader/Makefile
===================================================================
RCS file: /usr/cvs/src/sys/boot/i386/loader/Makefile,v
retrieving revision 1.85
diff -u -r1.85 Makefile
--- sys/boot/i386/loader/Makefile	29 May 2007 14:35:57 -0000	1.85
+++ sys/boot/i386/loader/Makefile	2 Jan 2008 15:48:06 -0000
@@ -84,7 +84,7 @@
 
 .PATH: ${.CURDIR}/../../forth 
 FILES=	loader loader.help loader.4th support.4th loader.conf
-FILES+= screen.4th frames.4th beastie.4th
+FILES+= screen.4th frames.4th beastie.4th vm.4th
 # XXX INSTALLFLAGS_loader= -b
 FILESMODE_loader= ${BINMODE} -b
 FILESDIR_loader.conf=	/boot/defaults
Index: sys/boot/i386/loader/loader.rc
===================================================================
RCS file: /usr/cvs/src/sys/boot/i386/loader/loader.rc,v
retrieving revision 1.4
diff -u -r1.4 loader.rc
--- sys/boot/i386/loader/loader.rc	30 Oct 2005 05:41:42 -0000	1.4
+++ sys/boot/i386/loader/loader.rc	2 Jan 2008 15:38:52 -0000
@@ -4,6 +4,10 @@
 \ Includes additional commands
 include /boot/loader.4th
 
+\ Virtual machine detection
+include /boot/vm.4th
+setup-vm
+
 \ Reads and processes loader.conf variables
 start
 

--t0UkRYy7tHLRMCai--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080102160322.GA83957>