• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files

vm86_struct.h

Go to the documentation of this file.
00001 #ifndef _LINUX_VM86_H
00002 #define _LINUX_VM86_H
00003 
00004 /*
00005  * I'm guessing at the VIF/VIP flag usage, but hope that this is how
00006  * the Pentium uses them. Linux will return from vm86 mode when both
00007  * VIF and VIP is set.
00008  *
00009  * On a Pentium, we could probably optimize the virtual flags directly
00010  * in the eflags register instead of doing it "by hand" in vflags...
00011  *
00012  * Linus
00013  */
00014 
00015 #define TF_MASK         0x00000100
00016 #define IF_MASK         0x00000200
00017 #define IOPL_MASK       0x00003000
00018 #define NT_MASK         0x00004000
00019 #define VM_MASK         0x00020000
00020 #define AC_MASK         0x00040000
00021 #define VIF_MASK        0x00080000      /* virtual interrupt flag */
00022 #define VIP_MASK        0x00100000      /* virtual interrupt pending */
00023 #define ID_MASK         0x00200000
00024 
00025 #define BIOSSEG         0x0f000
00026 
00027 #define CPU_086         0
00028 #define CPU_186         1
00029 #define CPU_286         2
00030 #define CPU_386         3
00031 #define CPU_486         4
00032 #define CPU_586         5
00033 
00034 /*
00035  * Return values for the 'vm86()' system call
00036  */
00037 #define VM86_TYPE(retval)       ((retval) & 0xff)
00038 #define VM86_ARG(retval)        ((retval) >> 8)
00039 
00040 #define VM86_SIGNAL     0       /* return due to signal */
00041 #define VM86_UNKNOWN    1       /* unhandled GP fault - IO-instruction or similar */
00042 #define VM86_INTx       2       /* int3/int x instruction (ARG = x) */
00043 #define VM86_STI        3       /* sti/popf/iret instruction enabled virtual interrupts */
00044 
00045 /*
00046  * Additional return values when invoking new vm86()
00047  */
00048 #define VM86_PICRETURN  4       /* return due to pending PIC request */
00049 #define VM86_TRAP       6       /* return due to DOS-debugger request */
00050 
00051 /*
00052  * function codes when invoking new vm86()
00053  */
00054 #define VM86_PLUS_INSTALL_CHECK 0
00055 #define VM86_ENTER              1
00056 #define VM86_ENTER_NO_BYPASS    2
00057 #define VM86_REQUEST_IRQ        3
00058 #define VM86_FREE_IRQ           4
00059 #define VM86_GET_IRQ_BITS       5
00060 #define VM86_GET_AND_RESET_IRQ  6
00061 
00062 /*
00063  * This is the stack-layout seen by the user space program when we have
00064  * done a translation of "SAVE_ALL" from vm86 mode. The real kernel layout
00065  * is 'kernel_vm86_regs' (see below).
00066  */
00067 
00068 struct vm86_regs {
00069 /*
00070  * normal regs, with special meaning for the segment descriptors..
00071  */
00072         long ebx;
00073         long ecx;
00074         long edx;
00075         long esi;
00076         long edi;
00077         long ebp;
00078         long eax;
00079         long __null_ds;
00080         long __null_es;
00081         long __null_fs;
00082         long __null_gs;
00083         long orig_eax;
00084         long eip;
00085         unsigned short cs, __csh;
00086         long eflags;
00087         long esp;
00088         unsigned short ss, __ssh;
00089 /*
00090  * these are specific to v86 mode:
00091  */
00092         unsigned short es, __esh;
00093         unsigned short ds, __dsh;
00094         unsigned short fs, __fsh;
00095         unsigned short gs, __gsh;
00096 };
00097 
00098 struct revectored_struct {
00099         unsigned long __map[8];                 /* 256 bits */
00100 };
00101 
00102 struct vm86_struct {
00103         struct vm86_regs regs;
00104         unsigned long flags;
00105         unsigned long screen_bitmap;
00106         unsigned long cpu_type;
00107         struct revectored_struct int_revectored;
00108         struct revectored_struct int21_revectored;
00109 };
00110 
00111 /*
00112  * flags masks
00113  */
00114 #define VM86_SCREEN_BITMAP      0x0001
00115 
00116 struct vm86plus_info_struct {
00117         unsigned long force_return_for_pic:1;
00118         unsigned long vm86dbg_active:1;       /* for debugger */
00119         unsigned long vm86dbg_TFpendig:1;     /* for debugger */
00120         unsigned long unused:28;
00121         unsigned long is_vm86pus:1;           /* for vm86 internal use */
00122         unsigned char vm86dbg_intxxtab[32];   /* for debugger */
00123 };
00124 
00125 struct vm86plus_struct {
00126         struct vm86_regs regs;
00127         unsigned long flags;
00128         unsigned long screen_bitmap;
00129         unsigned long cpu_type;
00130         struct revectored_struct int_revectored;
00131         struct revectored_struct int21_revectored;
00132         struct vm86plus_info_struct vm86plus;
00133 };
00134 
00135 #endif