|
|
1.1 ! root 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: #define TF_MASK 0x00000100 ! 16: #define IF_MASK 0x00000200 ! 17: #define IOPL_MASK 0x00003000 ! 18: #define NT_MASK 0x00004000 ! 19: #define VM_MASK 0x00020000 ! 20: #define AC_MASK 0x00040000 ! 21: #define VIF_MASK 0x00080000 /* virtual interrupt flag */ ! 22: #define VIP_MASK 0x00100000 /* virtual interrupt pending */ ! 23: #define ID_MASK 0x00200000 ! 24: ! 25: #define BIOSSEG 0x0f000 ! 26: ! 27: #define CPU_086 0 ! 28: #define CPU_186 1 ! 29: #define CPU_286 2 ! 30: #define CPU_386 3 ! 31: #define CPU_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: #define VM86_UNKNOWN 1 /* unhandled GP fault - IO-instruction or similar */ ! 42: #define VM86_INTx 2 /* int3/int x instruction (ARG = x) */ ! 43: #define VM86_STI 3 /* sti/popf/iret instruction enabled virtual interrupts */ ! 44: ! 45: /* ! 46: * Additional return values when invoking new vm86() ! 47: */ ! 48: #define VM86_PICRETURN 4 /* return due to pending PIC request */ ! 49: #define VM86_TRAP 6 /* return due to DOS-debugger request */ ! 50: ! 51: /* ! 52: * function codes when invoking new vm86() ! 53: */ ! 54: #define VM86_PLUS_INSTALL_CHECK 0 ! 55: #define VM86_ENTER 1 ! 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 ! 61: ! 62: /* ! 63: * This is the stack-layout when we have done a "SAVE_ALL" from vm86 ! 64: * mode - the main change is that the old segment descriptors aren't ! 65: * useful any more and are forced to be zero by the kernel (and the ! 66: * hardware when a trap occurs), and the real segment descriptors are ! 67: * at the end of the structure. Look at ptrace.h to see the "normal" ! 68: * setup. ! 69: */ ! 70: ! 71: struct vm86_regs { ! 72: /* ! 73: * normal regs, with special meaning for the segment descriptors.. ! 74: */ ! 75: long ebx; ! 76: long ecx; ! 77: long edx; ! 78: long esi; ! 79: long edi; ! 80: long ebp; ! 81: long eax; ! 82: long __null_ds; ! 83: long __null_es; ! 84: long __null_fs; ! 85: long __null_gs; ! 86: long orig_eax; ! 87: long eip; ! 88: unsigned short cs, __csh; ! 89: long eflags; ! 90: long esp; ! 91: unsigned short ss, __ssh; ! 92: /* ! 93: * these are specific to v86 mode: ! 94: */ ! 95: unsigned short es, __esh; ! 96: unsigned short ds, __dsh; ! 97: unsigned short fs, __fsh; ! 98: unsigned short gs, __gsh; ! 99: }; ! 100: ! 101: struct revectored_struct { ! 102: unsigned long __map[8]; /* 256 bits */ ! 103: }; ! 104: ! 105: struct vm86_struct { ! 106: struct vm86_regs regs; ! 107: unsigned long flags; ! 108: unsigned long screen_bitmap; ! 109: unsigned long cpu_type; ! 110: struct revectored_struct int_revectored; ! 111: struct revectored_struct int21_revectored; ! 112: }; ! 113: ! 114: /* ! 115: * flags masks ! 116: */ ! 117: #define VM86_SCREEN_BITMAP 0x0001 ! 118: ! 119: struct vm86plus_info_struct { ! 120: unsigned long force_return_for_pic:1; ! 121: unsigned long vm86dbg_active:1; /* for debugger */ ! 122: unsigned long vm86dbg_TFpendig:1; /* for debugger */ ! 123: unsigned long unused:28; ! 124: unsigned long is_vm86pus:1; /* for vm86 internal use */ ! 125: unsigned char vm86dbg_intxxtab[32]; /* for debugger */ ! 126: }; ! 127: ! 128: struct vm86plus_struct { ! 129: struct vm86_regs regs; ! 130: unsigned long flags; ! 131: unsigned long screen_bitmap; ! 132: unsigned long cpu_type; ! 133: struct revectored_struct int_revectored; ! 134: struct revectored_struct int21_revectored; ! 135: struct vm86plus_info_struct vm86plus; ! 136: }; ! 137: ! 138: #ifdef __KERNEL__ ! 139: ! 140: struct kernel_vm86_struct { ! 141: struct vm86_regs regs; ! 142: /* ! 143: * the below part remains on the kernel stack while we are in VM86 mode. ! 144: * 'tss.esp0' then contains the address of VM86_TSS_ESP0 below, and when we ! 145: * get forced back from VM86, the CPU and "SAVE_ALL" will restore the above ! 146: * 'struct kernel_vm86_regs' with the then actual values. ! 147: * Therefore, pt_regs in fact points to a complete 'kernel_vm86_struct' ! 148: * in kernelspace, hence we need not reget the data from userspace. ! 149: */ ! 150: #define VM86_TSS_ESP0 flags ! 151: unsigned long flags; ! 152: unsigned long screen_bitmap; ! 153: unsigned long cpu_type; ! 154: struct revectored_struct int_revectored; ! 155: struct revectored_struct int21_revectored; ! 156: struct vm86plus_info_struct vm86plus; ! 157: struct pt_regs *regs32; /* here we save the pointer to the old regs */ ! 158: /* ! 159: * The below is not part of the structure, but the stack layout continues ! 160: * this way. In front of 'return-eip' may be some data, depending on ! 161: * compilation, so we don't rely on this and save the pointer to 'oldregs' ! 162: * in 'regs32' above. ! 163: * However, with GCC-2.7.2 and the current CFLAGS you see exactly this: ! 164: ! 165: long return-eip; from call to vm86() ! 166: struct pt_regs oldregs; user space registers as saved by syscall ! 167: */ ! 168: }; ! 169: ! 170: void handle_vm86_fault(struct vm86_regs *, long); ! 171: int handle_vm86_trap(struct vm86_regs *, long, int); ! 172: ! 173: #endif /* __KERNEL__ */ ! 174: ! 175: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.