1 #ifndef_LINUX_VM86_H 2 #define_LINUX_VM86_H 3
4 /* 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 7 * VIF and VIP is set. 8 * 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... 11 * 12 * Linus 13 */ 14
15 #defineTF_MASK 0x00000100
16 #defineIF_MASK 0x00000200
17 #defineIOPL_MASK 0x00003000
18 #defineNT_MASK 0x00004000
19 #defineVM_MASK 0x00020000
20 #defineAC_MASK 0x00040000
21 #defineVIF_MASK 0x00080000 /* virtual interrupt flag */ 22 #defineVIP_MASK 0x00100000 /* virtual interrupt pending */ 23 #defineID_MASK 0x00200000
24
25 #defineBIOSSEG 0x0f000
26
27 #define CPU_086 0
28 #define CPU_186 1
29 #defineCPU_286 2
30 #defineCPU_386 3
31 #defineCPU_486 4
32 #define CPU_586 5
33
34 /* 35 * Return values for the 'vm86()' system call 36 */ 37 #define VM86_TYPE(retval) ((retval) & 0xff)
38 #define VM86_ARG(retval) ((retval) >> 8)
39
40 #define VM86_SIGNAL 0 /* return due to signal */ 41 #defineVM86_UNKNOWN 1 /* unhandled GP fault - IO-instruction or similar */ 42 #defineVM86_INTx 2 /* int3/int x instruction (ARG = x) */ 43 #defineVM86_STI 3 /* sti/popf/iret instruction enabled virtual interrupts */ 44
45 /* 46 * This is the stack-layout when we have done a "SAVE_ALL" from vm86 47 * mode - the main change is that the old segment descriptors aren't 48 * useful any more and are forced to be zero by the kernel (and the 49 * hardware when a trap occurs), and the real segment descriptors are 50 * at the end of the structure. Look at ptrace.h to see the "normal" 51 * setup. 52 */ 53
54 structvm86_regs{ 55 /* 56 * normal regs, with special meaning for the segment descriptors.. 57 */ 58 longebx;
59 longecx;
60 longedx;
61 longesi;
62 longedi;
63 longebp;
64 longeax;
65 long__null_ds;
66 long__null_es;
67 long__null_fs;
68 long__null_gs;
69 longorig_eax;
70 longeip;
71 unsignedshortcs, __csh;
72 longeflags;
73 longesp;
74 unsignedshortss, __ssh;
75 /* 76 * these are specific to v86 mode: 77 */ 78 unsignedshortes, __esh;
79 unsignedshortds, __dsh;
80 unsignedshortfs, __fsh;
81 unsignedshortgs, __gsh;
82 };
83
84 structrevectored_struct{ 85 unsignedlong __map[8]; /* 256 bits */ 86 };
87
88 structvm86_struct{ 89 structvm86_regsregs;
90 unsignedlongflags;
91 unsignedlongscreen_bitmap;
92 unsignedlongcpu_type;
93 structrevectored_structint_revectored;
94 structrevectored_structint21_revectored;
95 };
96
97 /* 98 * flags masks 99 */ 100 #defineVM86_SCREEN_BITMAP 0x0001
101
102 #ifdef__KERNEL__ 103
104 voidhandle_vm86_fault(structvm86_regs *, long);
105
106 #endif 107
108 #endif