i386_vm86 (2)
Leading comments
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 oth...
NAME
i386_vm86 - control vm86-related functionsLIBRARY
Lb libcSYNOPSIS
In sys/types.h In machine/sysarch.h In machine/vm86.h Ft int Fn i386_vm86 int function void *dataDESCRIPTION
The Fn i386_vm86 system call is used to call various vm86 related functions. The Fa 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
Fa data
argument
points to the following structure:
struct vm86_init_args { int debug; int cpu_type; u_char int_map[32]; };
The Fa debug argument is used to turn on debugging code. The Fa cpu_type argument controls the type of CPU being emulated, and is currently unimplemented. The Fa 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.
Fa data
should point to the following structure:
struct vm86_intcall_args { int intnum; struct vm86frame vmf; };
Fa 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. Fa vmf is used to initialize CPU registers according to the calling convention for the interrupt handler.
- 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:
struct vm86_vme_args { int state; /* status */ };
Fa 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
Rv -std i386_vm86ERRORS
The Fn i386_vm86 system call will fail if:- Bq Er EINVAL
- The kernel does not have vm86 support, or an invalid function was specified.
- Bq Er ENOMEM
- There is not enough memory to initialize the kernel data structures.