]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - lib/libc/i386/sys/i386_vm86.2
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / lib / libc / i386 / sys / i386_vm86.2
1 .\" Copyright (c) 1998 Jonathan Lemon
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\"
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 .\" SUCH DAMAGE.
24 .\"
25 .\" $FreeBSD$
26 .\"
27 .Dd July 27, 1998
28 .Dt I386_VM86 2
29 .Os
30 .Sh NAME
31 .Nm i386_vm86
32 .Nd control vm86-related functions
33 .Sh LIBRARY
34 .Lb libc
35 .Sh SYNOPSIS
36 .In sys/types.h
37 .In machine/sysarch.h
38 .In machine/vm86.h
39 .Ft int
40 .Fn i386_vm86 "int function" "void *data"
41 .Sh DESCRIPTION
42 The
43 .Fn i386_vm86
44 system call
45 is used to call various vm86 related functions.
46 The
47 .Fa function
48 argument
49 can be one of the following values:
50 .Bl -tag -offset indent -width VM86_SET_VME
51 .It Dv VM86_INIT
52 This will initialize the kernel's vm86 parameter area for the
53 process, and permit the process to make vm86 calls.
54 The
55 .Fa data
56 argument
57 points to the following structure:
58 .Bd -literal
59 struct vm86_init_args {
60         int     debug;
61         int     cpu_type;
62         u_char  int_map[32];
63 };
64 .Ed
65 .Pp
66 The
67 .Fa debug
68 argument
69 is used to turn on debugging code.
70 The
71 .Fa cpu_type
72 argument
73 controls the type of CPU being emulated, and is currently unimplemented.
74 The
75 .Fa int_map
76 argument
77 is a bitmap which determines whether vm86 interrupts should be handled
78 in vm86 mode, or reflected back to the process.
79 If the
80 .Em Nth
81 bit is set, the interrupt will be reflected to the process, otherwise
82 it will be dispatched by the vm86 interrupt table.
83 .It Dv VM86_INTCALL
84 This allows calls to be made to vm86 interrupt handlers by the process.
85 It effectively simulates an INT instruction.
86 .Fa data
87 should point to the following structure:
88 .Bd -literal
89 struct vm86_intcall_args {
90         int     intnum;
91         struct  vm86frame vmf;
92 };
93 .Ed
94 .Pp
95 .Fa intnum
96 specifies the operand of INT for the simulated call.
97 A value of 0x10, for example, would often be used to call into the VGA BIOS.
98 .Fa vmf
99 is used to initialize CPU registers according to the calling convention for
100 the interrupt handler.
101 .It Dv VM86_GET_VME
102 This is used to retrieve the current state of the Pentium(r) processor's
103 VME (Virtual-8086 Mode Extensions) flag, which is bit 0 of CR4.
104 .Fa data
105 should be initialized to point to the following:
106 .Bd -literal
107 struct vm86_vme_args {
108         int     state;                  /* status */
109 };
110 .Ed
111 .Pp
112 .Fa state
113 will contain the state of the VME flag on return.
114 .\" .It Dv VM86_SET_VME
115 .El
116 .Pp
117 vm86 mode is entered by calling
118 .Xr sigreturn 2
119 with the correct machine context for vm86, and with the
120 .Dv PSL_VM
121 bit set.
122 Control returns to the process upon delivery of a signal.
123 .Sh RETURN VALUES
124 .Rv -std i386_vm86
125 .Sh ERRORS
126 The
127 .Fn i386_vm86
128 system call
129 will fail if:
130 .Bl -tag -width Er
131 .It Bq Er EINVAL
132 The kernel does not have vm86 support, or an invalid function was specified.
133 .It Bq Er ENOMEM
134 There is not enough memory to initialize the kernel data structures.
135 .El
136 .Sh AUTHORS
137 .An -nosplit
138 This man page was written by
139 .An Jonathan Lemon ,
140 and updated by
141 .An Bruce M Simpson .