i386_vm86(2) [netbsd man page]
I386_VM86(2) BSD/i386 System Calls Manual I386_VM86(2) NAME
i386_vm86 -- set virtual 8086 processor registers and mode LIBRARY
i386 Architecture Library (libi386, -li386) SYNOPSIS
#include <sys/types.h> #include <signal.h> #include <machine/mcontext.h> #include <machine/segments.h> #include <machine/sysarch.h> #include <machine/vm86.h> int i386_vm86(struct vm86_struct *vmcp); DESCRIPTION
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->substr.regs, and the emulated processor type from vmcp->substr.ss_cpu_type. The kernel keeps a pointer to the context, and uses the tables stored at vmcp->int_byuser and vmcp->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->int21_byuser array is checked when INT 21 is requested and the ah register is k. RETURN VALUES
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 set- ting the VM86 mode, a value of -1 is returned and the global variable errno is set to indicate the error. ERRORS
i386_vm86() will fail if: [EFAULT] The state at vmcp was not readable to the user process. REFERENCES
i386 Microprocessor Programmer's Reference Manual, Intel BSD
February 20, 1996 BSD
Check Out this Related Man Page
I386_VM86(2) BSD System Calls Manual I386_VM86(2) NAME
i386_vm86 -- control vm86-related functions LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <sys/types.h> #include <machine/sysarch.h> #include <machine/vm86.h> int i386_vm86(int function, void *data); DESCRIPTION
The i386_vm86() system call is used to call various vm86 related functions. The function argument can be one of the following values: VM86_INIT This will initialize the kernel's vm86 parameter area for the process, and permit the process to make vm86 calls. The data argument points to the following structure: struct vm86_init_args { int debug; int cpu_type; u_char int_map[32]; }; The debug argument is used to turn on debugging code. The cpu_type argument controls the type of CPU being emulated, and is currently unimplemented. The int_map argument is a bitmap which determines whether vm86 interrupts should be handled in vm86 mode, or reflected back to the process. If the Nth bit is set, the interrupt will be reflected to the process, otherwise it will be dispatched by the vm86 interrupt table. VM86_INTCALL This allows calls to be made to vm86 interrupt handlers by the process. It effectively simulates an INT instruction. data should point to the following structure: struct vm86_intcall_args { int intnum; struct vm86frame vmf; }; intnum 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. vmf is used to initialize CPU registers according to the calling convention for the interrupt han- dler. 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. data should be initialized to point to the following: struct vm86_vme_args { int state; /* status */ }; state will contain the state of the VME flag on return. vm86 mode is entered by calling sigreturn(2) with the correct machine context for vm86, and with the PSL_VM bit set. Control returns to the process upon delivery of a signal. RETURN VALUES
The i386_vm86() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indi- cate the error. ERRORS
The i386_vm86() system call will fail if: [EINVAL] The kernel does not have vm86 support, or an invalid function was specified. [ENOMEM] There is not enough memory to initialize the kernel data structures. AUTHORS
This man page was written by Jonathan Lemon, and updated by Bruce M Simpson. BSD
July 27, 1998 BSD