5 * I'm guessing at the VIF/VIP flag usage, but hope that this is how
6 * the Pentium uses them. Linux will return from vm86 mode when both
9 * On a Pentium, we could probably optimize the virtual flags directly
10 * in the eflags register instead of doing it "by hand" in vflags...
15 #include <asm/processor-flags.h>
18 #define X86_VM_MASK X86_EFLAGS_VM
20 #define X86_VM_MASK 0 /* No VM86 support */
23 #define BIOSSEG 0x0f000
33 * Return values for the 'vm86()' system call
35 #define VM86_TYPE(retval) ((retval) & 0xff)
36 #define VM86_ARG(retval) ((retval) >> 8)
38 #define VM86_SIGNAL 0 /* return due to signal */
39 #define VM86_UNKNOWN 1 /* unhandled GP fault
40 - IO-instruction or similar */
41 #define VM86_INTx 2 /* int3/int x instruction (ARG = x) */
42 #define VM86_STI 3 /* sti/popf/iret instruction enabled
46 * Additional return values when invoking new vm86()
48 #define VM86_PICRETURN 4 /* return due to pending PIC request */
49 #define VM86_TRAP 6 /* return due to DOS-debugger request */
52 * function codes when invoking new vm86()
54 #define VM86_PLUS_INSTALL_CHECK 0
56 #define VM86_ENTER_NO_BYPASS 2
57 #define VM86_REQUEST_IRQ 3
58 #define VM86_FREE_IRQ 4
59 #define VM86_GET_IRQ_BITS 5
60 #define VM86_GET_AND_RESET_IRQ 6
63 * This is the stack-layout seen by the user space program when we have
64 * done a translation of "SAVE_ALL" from vm86 mode. The real kernel layout
65 * is 'kernel_vm86_regs' (see below).
70 * normal regs, with special meaning for the segment descriptors..
85 unsigned short cs, __csh;
88 unsigned short ss, __ssh;
90 * these are specific to v86 mode:
92 unsigned short es, __esh;
93 unsigned short ds, __dsh;
94 unsigned short fs, __fsh;
95 unsigned short gs, __gsh;
98 struct revectored_struct {
99 unsigned long __map[8]; /* 256 bits */
103 struct vm86_regs regs;
105 unsigned long screen_bitmap;
106 unsigned long cpu_type;
107 struct revectored_struct int_revectored;
108 struct revectored_struct int21_revectored;
114 #define VM86_SCREEN_BITMAP 0x0001
116 struct vm86plus_info_struct {
117 unsigned long force_return_for_pic:1;
118 unsigned long vm86dbg_active:1; /* for debugger */
119 unsigned long vm86dbg_TFpendig:1; /* for debugger */
120 unsigned long unused:28;
121 unsigned long is_vm86pus:1; /* for vm86 internal use */
122 unsigned char vm86dbg_intxxtab[32]; /* for debugger */
125 struct vm86plus_struct {
126 struct vm86_regs regs;
128 unsigned long screen_bitmap;
129 unsigned long cpu_type;
130 struct revectored_struct int_revectored;
131 struct revectored_struct int21_revectored;
132 struct vm86plus_info_struct vm86plus;
137 * This is the (kernel) stack-layout when we have done a "SAVE_ALL" from vm86
138 * mode - the main change is that the old segment descriptors aren't
139 * useful any more and are forced to be zero by the kernel (and the
140 * hardware when a trap occurs), and the real segment descriptors are
141 * at the end of the structure. Look at ptrace.h to see the "normal"
142 * setup. For user space layout see 'struct vm86_regs' above.
144 #include <asm/ptrace.h>
146 struct kernel_vm86_regs {
148 * normal regs, with special meaning for the segment descriptors..
152 * these are specific to v86 mode:
154 unsigned short es, __esh;
155 unsigned short ds, __dsh;
156 unsigned short fs, __fsh;
157 unsigned short gs, __gsh;
160 struct kernel_vm86_struct {
161 struct kernel_vm86_regs regs;
163 * the below part remains on the kernel stack while we are in VM86 mode.
164 * 'tss.esp0' then contains the address of VM86_TSS_ESP0 below, and when we
165 * get forced back from VM86, the CPU and "SAVE_ALL" will restore the above
166 * 'struct kernel_vm86_regs' with the then actual values.
167 * Therefore, pt_regs in fact points to a complete 'kernel_vm86_struct'
168 * in kernelspace, hence we need not reget the data from userspace.
170 #define VM86_TSS_ESP0 flags
172 unsigned long screen_bitmap;
173 unsigned long cpu_type;
174 struct revectored_struct int_revectored;
175 struct revectored_struct int21_revectored;
176 struct vm86plus_info_struct vm86plus;
177 struct pt_regs *regs32; /* here we save the pointer to the old regs */
179 * The below is not part of the structure, but the stack layout continues
180 * this way. In front of 'return-eip' may be some data, depending on
181 * compilation, so we don't rely on this and save the pointer to 'oldregs'
183 * However, with GCC-2.7.2 and the current CFLAGS you see exactly this:
185 long return-eip; from call to vm86()
186 struct pt_regs oldregs; user space registers as saved by syscall
192 void handle_vm86_fault(struct kernel_vm86_regs *, long);
193 int handle_vm86_trap(struct kernel_vm86_regs *, long, int);
194 struct pt_regs *save_v86_state(struct kernel_vm86_regs *);
197 void release_vm86_irqs(struct task_struct *);
201 #define handle_vm86_fault(a, b)
202 #define release_vm86_irqs(a)
204 static inline int handle_vm86_trap(struct kernel_vm86_regs *a, long b, int c)
209 #endif /* CONFIG_VM86 */
211 #endif /* __KERNEL__ */