Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (NetBSD-6.1.5)
Apropos / Subsearch:
optional field

I386_VM86(2)              System Calls Manual (i386)              I386_VM86(2)

     i386_vm86 -- set virtual 8086 processor registers and mode

     i386 Architecture Library (libi386, -li386)

     #include <&lt;sys/types.h>&gt;
     #include <&lt;signal.h>&gt;
     #include <&lt;machine/mcontext.h>&gt;
     #include <&lt;machine/segments.h>&gt;
     #include <&lt;machine/sysarch.h>&gt;
     #include <&lt;machine/vm86.h>&gt;

     i386_vm86(struct vm86_struct *vmcp);

     i386_vm86() will set the process into virtual 8086 mode using the
     registers and selectors specified by the context pointed to by vmcp.  The
     processor registers are set from vmcp-&gt;substr.regs, and the emulated
     processor type from vmcp-&gt;substr.ss_cpu_type.

     The kernel keeps a pointer to the context, and uses the tables stored at
     vmcp-&gt;int_byuser and vmcp-&gt;int21_byuser for fast virtual interrupt
     handling.  If the n th bit is clear in the first of these arrays, then
     the kernel may directly emulate the real-mode x86 INT n instruction
     handling.  If the n th bit is set, then the process is delivered a signal
     when an INT instruction is executed.

     Since MS-DOS puts many DOS functions onto interrupt 21, it is handled
     specially:  the k th bit in the vmcp-&gt;int21_byuser array is checked when
     INT 21 is requested and the ah register is k.

     This routine does not normally return: 32-bit mode will be restored by
     the delivery of a signal to the process.  In case of an error in setting
     the VM86 mode, a value of -1 is returned and the global variable errno is
     set to indicate the error.

     i386_vm86() will fail if:

     [EFAULT]  The state at vmcp was not readable to the user process.

     i386 Microprocessor Programmer's Reference Manual, Intel

NetBSD 6.1.5                   February 20, 1996                  NetBSD 6.1.5