Index: sys/boot/i386/libi386/i386_module.c =================================================================== --- sys/boot/i386/libi386/i386_module.c +++ sys/boot/i386/libi386/i386_module.c @@ -32,12 +32,35 @@ * */ +#include +#include +#include + +/* See the kernel's function identify_hypervisor(). */ +static int +running_on_hypervisor(void) +{ + unsigned int regs[4]; + + do_cpuid(1, regs); + return (regs[2] & 0x80000000); +} + /* * Use voodoo to load modules required by current hardware. */ int i386_autoload(void) { + if (running_on_hypervisor()) { + /* + * vt(4)'s graphics mode is slow when FreeBSD guest runs on + * hypervisors, especially on Hyper-V (e.g., 1 line of boot message + * per second), but luckily vt(4) is fast enough in text mode. + */ + if (getenv("hw.vga.textmode") == NULL) + setenv("hw.vga.textmode", "1", 1); + } /* XXX use PnP to locate stuff here */ return(0);