Changeset View
Changeset View
Standalone View
Standalone View
sys/boot/i386/libi386/i386_module.c
Context not available. | |||||
* | * | ||||
*/ | */ | ||||
#include <stand.h> | |||||
#include <string.h> | |||||
#include <machine/cpufunc.h> | |||||
/* 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. | * Use voodoo to load modules required by current hardware. | ||||
*/ | */ | ||||
int | int | ||||
i386_autoload(void) | 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 */ | /* XXX use PnP to locate stuff here */ | ||||
return(0); | return(0); | ||||
Context not available. |