Why is PCE not set in CR4?

Bruce M Simpson bms at spc.org
Thu Oct 2 21:43:44 PDT 2003

On Thu, Oct 02, 2003 at 02:57:03PM +0200, Grumble wrote:
> Is vm86 related to virtual-8086 mode? Probably not... What does vm86 
> stand for? Virtual machine?

vm86 is something of a catchall for vm86-related functions. One of the
things it implements is a means of getting in and out of Virtual 8086
mode from a userland process. doscmd(1) uses this, as does my s3switch
port for getting into an S3 card's video BIOS to execute the functions
required to enable the video-out port.

A few other knobs exist in there for dealing with i386-specific things,
such as permitting access to an IO port range for a user process (by
changing the appropriate state in the TSS).

> I am tempted to remove perfmon from the kernel, and write a kernel 
> module for Athlon and another one for NetBurst.

I would ask you to please consider patching perfmon to do what you
need it to do.

> Can a kernel module catch #UD (Invalid Opcode) and #GP (General 
> Protection) exceptions generated from within the kernel module 
> itself? Can I use sigaction(2)?
> Can a kernel module catch a specific #GP exception generated from 
> user land? Can I register a signal handler with sigaction(2)?

What'll happen is that DDB will most likely catch the exception, unless
you specifically patch trap.c to catch those exceptions. You should also
look at the special exception handlers in identcpu.c.

> BTW, are performance-monitoring counters saved and restored on a 
> context switch?

Look at i386's definition of cpu_switch(). You'll need to find some
unused space in the TSS and do it yourself.


More information about the freebsd-hackers mailing list