1998-07-28 03:39:04 +00:00
|
|
|
.\" Copyright (c) 1998 Jonathan Lemon
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
1999-08-28 00:22:10 +00:00
|
|
|
.\" $FreeBSD$
|
1998-07-28 03:39:04 +00:00
|
|
|
.\"
|
|
|
|
.Dd July 27, 1998
|
|
|
|
.Os
|
|
|
|
.Dt I386_VM86 2
|
|
|
|
.Sh NAME
|
|
|
|
.Nm i386_vm86
|
|
|
|
.Nd control vm86-related functions
|
2000-04-21 09:42:15 +00:00
|
|
|
.Sh LIBRARY
|
|
|
|
.Lb libc
|
1998-07-28 03:39:04 +00:00
|
|
|
.Sh SYNOPSIS
|
2001-10-01 16:09:29 +00:00
|
|
|
.In sys/types.h
|
|
|
|
.In machine/sysarch.h
|
|
|
|
.In machine/vm86.h
|
1998-07-28 03:39:04 +00:00
|
|
|
.Ft int
|
|
|
|
.Fn i386_vm86 "int function" "void *data"
|
|
|
|
.Sh DESCRIPTION
|
2002-12-18 12:39:25 +00:00
|
|
|
The
|
1998-07-28 03:39:04 +00:00
|
|
|
.Fn i386_vm86
|
2002-12-18 12:39:25 +00:00
|
|
|
system call
|
1998-07-28 03:39:04 +00:00
|
|
|
is used to call various vm86 related functions.
|
2002-12-19 09:40:28 +00:00
|
|
|
The
|
1998-07-28 03:39:04 +00:00
|
|
|
.Fa function
|
2002-12-19 09:40:28 +00:00
|
|
|
argument
|
1998-07-28 03:39:04 +00:00
|
|
|
can be one of the following values:
|
|
|
|
.Bl -tag -offset indent -width VM86_SET_VME
|
|
|
|
.It Dv VM86_INIT
|
|
|
|
This will initialize the kernel's vm86 parameter area for the
|
|
|
|
process, and permit the process to make vm86 calls.
|
2002-12-19 09:40:28 +00:00
|
|
|
The
|
1998-07-28 03:39:04 +00:00
|
|
|
.Fa data
|
2002-12-19 09:40:28 +00:00
|
|
|
argument
|
1998-07-28 03:39:04 +00:00
|
|
|
points to the following structure:
|
|
|
|
.Bd -literal
|
|
|
|
struct vm86_init_args {
|
|
|
|
int debug;
|
|
|
|
int cpu_type;
|
|
|
|
u_char int_map[32];
|
|
|
|
};
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2002-12-19 09:40:28 +00:00
|
|
|
The
|
1998-07-28 03:39:04 +00:00
|
|
|
.Fa debug
|
2002-12-19 09:40:28 +00:00
|
|
|
argument
|
1998-07-28 03:39:04 +00:00
|
|
|
is used to turn on debugging code.
|
2002-12-19 09:40:28 +00:00
|
|
|
The
|
1998-07-28 03:39:04 +00:00
|
|
|
.Fa cpu_type
|
2002-12-19 09:40:28 +00:00
|
|
|
argument
|
1998-07-28 03:39:04 +00:00
|
|
|
controls the type of CPU being emulated, and is currently unimplemented.
|
2002-12-19 09:40:28 +00:00
|
|
|
The
|
1998-07-28 03:39:04 +00:00
|
|
|
.Fa int_map
|
2002-12-19 09:40:28 +00:00
|
|
|
argument
|
1998-07-28 03:39:04 +00:00
|
|
|
is a bitmap which determines whether vm86 interrupts should be handled
|
2003-05-22 13:02:28 +00:00
|
|
|
in vm86 mode, or reflected back to the process.
|
|
|
|
If the
|
1998-07-28 03:39:04 +00:00
|
|
|
.Em Nth
|
|
|
|
bit is set, the interrupt will be reflected to the process, otherwise
|
|
|
|
it will be dispatched by the vm86 interrupt table.
|
2003-04-29 08:35:28 +00:00
|
|
|
.It Dv VM86_INTCALL
|
2003-05-22 13:02:28 +00:00
|
|
|
This allows calls to be made to vm86 interrupt handlers by the process.
|
|
|
|
It effectively simulates an INT instruction.
|
2003-04-29 08:35:28 +00:00
|
|
|
.Fa data
|
|
|
|
should point to the following structure:
|
|
|
|
.Bd -literal
|
|
|
|
struct vm86_intcall_args {
|
|
|
|
int intnum;
|
|
|
|
struct vm86frame vmf;
|
|
|
|
};
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
.Fa intnum
|
2003-05-22 13:02:28 +00:00
|
|
|
specifies the operand of INT for the simulated call.
|
|
|
|
A value of 0x10, for example, would often be used to call into the VGA BIOS.
|
2003-04-29 08:35:28 +00:00
|
|
|
.Fa vmf
|
|
|
|
is used to initialize CPU registers according to the calling convention for
|
|
|
|
the interrupt handler.
|
|
|
|
.It Dv VM86_GET_VME
|
|
|
|
This is used to retrieve the current state of the Pentium(r) processor's
|
|
|
|
VME (Virtual-8086 Mode Extensions) flag, which is bit 0 of CR4.
|
|
|
|
.Fa data
|
|
|
|
should be initialized to point to the following:
|
|
|
|
.Bd -literal
|
|
|
|
struct vm86_vme_args {
|
|
|
|
int state; /* status */
|
|
|
|
};
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
.Fa state
|
|
|
|
will contain the state of the VME flag on return.
|
2003-05-18 21:05:22 +00:00
|
|
|
.\" .It Dv VM86_SET_VME
|
1998-07-28 03:39:04 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
2001-07-15 07:53:42 +00:00
|
|
|
vm86 mode is entered by calling
|
1998-07-28 03:39:04 +00:00
|
|
|
.Xr sigreturn 2
|
|
|
|
with the correct machine context for vm86, and with the
|
2002-12-18 13:33:04 +00:00
|
|
|
.Dv PSL_VM
|
2003-05-22 13:02:28 +00:00
|
|
|
bit set.
|
|
|
|
Control returns to the process upon delivery of a signal.
|
1998-07-28 03:39:04 +00:00
|
|
|
.Sh RETURN VALUES
|
2001-08-09 13:32:13 +00:00
|
|
|
.Rv -std i386_vm86
|
1998-07-28 03:39:04 +00:00
|
|
|
.Sh ERRORS
|
2002-12-18 12:39:25 +00:00
|
|
|
The
|
1998-07-28 03:39:04 +00:00
|
|
|
.Fn i386_vm86
|
2002-12-18 12:39:25 +00:00
|
|
|
system call
|
1998-07-28 03:39:04 +00:00
|
|
|
will fail if:
|
2000-05-06 12:07:59 +00:00
|
|
|
.Bl -tag -width Er
|
1998-07-28 03:39:04 +00:00
|
|
|
.It Bq Er EINVAL
|
|
|
|
The kernel does not have vm86 support, or an invalid function was specified.
|
|
|
|
.It Bq Er ENOMEM
|
|
|
|
There is not enough memory to initialize the kernel data structures.
|
2000-12-29 14:08:20 +00:00
|
|
|
.El
|
1998-07-28 03:39:04 +00:00
|
|
|
.Sh AUTHORS
|
2003-05-22 13:02:28 +00:00
|
|
|
.An -nosplit
|
1998-07-28 03:39:04 +00:00
|
|
|
This man page was written by
|
2003-04-29 08:35:28 +00:00
|
|
|
.An Jonathan Lemon ,
|
|
|
|
and updated by
|
|
|
|
.An Bruce M Simpson .
|