1 .\" $NetBSD: i386_vm86.2,v 1.12 2003/09/11 19:19:31 christos Exp $
3 .\" Copyright (c) 1996 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
30 .\" from: @(#)fork.2 6.5 (Berkeley) 3/10/91
37 .Nd set virtual 8086 processor registers and mode
43 .In machine/mcontext.h
44 .In machine/segments.h
48 .Fn i386_vm86 "struct vm86_struct *vmcp"
51 will set the process into virtual 8086 mode using the registers and
52 selectors specified by the context pointed to by
54 The processor registers are set from
55 .Ar vmcp-\*[Gt]substr.regs ,
56 and the emulated processor type from
57 .Ar vmcp-\*[Gt]substr.ss_cpu_type .
59 The kernel keeps a pointer to the context, and uses the tables stored at
60 .Ar vmcp-\*[Gt]int_byuser
62 .Ar vmcp-\*[Gt]int21_byuser
63 for fast virtual interrupt handling.
66 bit is clear in the first of these arrays,
67 then the kernel may directly emulate the real-mode x86 INT
72 th bit is set, then the process is
73 delivered a signal when an INT instruction is executed.
75 Since MS-DOS puts many DOS functions onto interrupt 21, it is handled
79 .Ar vmcp-\*[Gt]int21_byuser
80 array is checked when INT
87 This routine does not normally return: 32-bit mode will be restored by
88 the delivery of a signal to the process.
89 In case of an error in setting
90 the VM86 mode, a value of \-1 is returned and the global variable
92 is set to indicate the error.
96 .Bl -tag -width [EINVAL]
100 was not readable to the user process.
103 i386 Microprocessor Programmer's Reference Manual, Intel