• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef _UAPI_ASM_X86_VM86_H
3 #define _UAPI_ASM_X86_VM86_H
4 
5 /*
6  * I'm guessing at the VIF/VIP flag usage, but hope that this is how
7  * the Pentium uses them. Linux will return from vm86 mode when both
8  * VIF and VIP is set.
9  *
10  * On a Pentium, we could probably optimize the virtual flags directly
11  * in the eflags register instead of doing it "by hand" in vflags...
12  *
13  * Linus
14  */
15 
16 #include <asm/processor-flags.h>
17 
18 #define BIOSSEG		0x0f000
19 
20 #define CPU_086		0
21 #define CPU_186		1
22 #define CPU_286		2
23 #define CPU_386		3
24 #define CPU_486		4
25 #define CPU_586		5
26 
27 /*
28  * Return values for the 'vm86()' system call
29  */
30 #define VM86_TYPE(retval)	((retval) & 0xff)
31 #define VM86_ARG(retval)	((retval) >> 8)
32 
33 #define VM86_SIGNAL	0	/* return due to signal */
34 #define VM86_UNKNOWN	1	/* unhandled GP fault
35 				   - IO-instruction or similar */
36 #define VM86_INTx	2	/* int3/int x instruction (ARG = x) */
37 #define VM86_STI	3	/* sti/popf/iret instruction enabled
38 				   virtual interrupts */
39 
40 /*
41  * Additional return values when invoking new vm86()
42  */
43 #define VM86_PICRETURN	4	/* return due to pending PIC request */
44 #define VM86_TRAP	6	/* return due to DOS-debugger request */
45 
46 /*
47  * function codes when invoking new vm86()
48  */
49 #define VM86_PLUS_INSTALL_CHECK	0
50 #define VM86_ENTER		1
51 #define VM86_ENTER_NO_BYPASS	2
52 #define	VM86_REQUEST_IRQ	3
53 #define VM86_FREE_IRQ		4
54 #define VM86_GET_IRQ_BITS	5
55 #define VM86_GET_AND_RESET_IRQ	6
56 
57 /*
58  * This is the stack-layout seen by the user space program when we have
59  * done a translation of "SAVE_ALL" from vm86 mode. The real kernel layout
60  * is 'kernel_vm86_regs' (see below).
61  */
62 
63 struct vm86_regs {
64 /*
65  * normal regs, with special meaning for the segment descriptors..
66  */
67 	long ebx;
68 	long ecx;
69 	long edx;
70 	long esi;
71 	long edi;
72 	long ebp;
73 	long eax;
74 	long __null_ds;
75 	long __null_es;
76 	long __null_fs;
77 	long __null_gs;
78 	long orig_eax;
79 	long eip;
80 	unsigned short cs, __csh;
81 	long eflags;
82 	long esp;
83 	unsigned short ss, __ssh;
84 /*
85  * these are specific to v86 mode:
86  */
87 	unsigned short es, __esh;
88 	unsigned short ds, __dsh;
89 	unsigned short fs, __fsh;
90 	unsigned short gs, __gsh;
91 };
92 
93 struct revectored_struct {
94 	unsigned long __map[8];			/* 256 bits */
95 };
96 
97 struct vm86_struct {
98 	struct vm86_regs regs;
99 	unsigned long flags;
100 	unsigned long screen_bitmap;		/* unused, preserved by vm86() */
101 	unsigned long cpu_type;
102 	struct revectored_struct int_revectored;
103 	struct revectored_struct int21_revectored;
104 };
105 
106 /*
107  * flags masks
108  */
109 #define VM86_SCREEN_BITMAP	0x0001        /* no longer supported */
110 
111 struct vm86plus_info_struct {
112 	unsigned long force_return_for_pic:1;
113 	unsigned long vm86dbg_active:1;       /* for debugger */
114 	unsigned long vm86dbg_TFpendig:1;     /* for debugger */
115 	unsigned long unused:28;
116 	unsigned long is_vm86pus:1;	      /* for vm86 internal use */
117 	unsigned char vm86dbg_intxxtab[32];   /* for debugger */
118 };
119 struct vm86plus_struct {
120 	struct vm86_regs regs;
121 	unsigned long flags;
122 	unsigned long screen_bitmap;
123 	unsigned long cpu_type;
124 	struct revectored_struct int_revectored;
125 	struct revectored_struct int21_revectored;
126 	struct vm86plus_info_struct vm86plus;
127 };
128 
129 
130 #endif /* _UAPI_ASM_X86_VM86_H */
131