vm86.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. #if !__AS386_16__
  2. #ifndef _SYS_VM86_H
  3. #define _SYS_VM86_H
  4. #include <features.h>
  5. #ifndef _LINUX_VM86_H
  6. #define _LINUX_VM86_H
  7. /*
  8. * I'm guessing at the VIF/VIP flag usage, but hope that this is how
  9. * the Pentium uses them. Linux will return from vm86 mode when both
  10. * VIF and VIP is set.
  11. *
  12. * On a Pentium, we could probably optimize the virtual flags directly
  13. * in the eflags register instead of doing it "by hand" in vflags...
  14. *
  15. * Linus
  16. */
  17. #define TF_MASK 0x00000100
  18. #define IF_MASK 0x00000200
  19. #define IOPL_MASK 0x00003000
  20. #define NT_MASK 0x00004000
  21. #define VM_MASK 0x00020000
  22. #define AC_MASK 0x00040000
  23. #define VIF_MASK 0x00080000 /* virtual interrupt flag */
  24. #define VIP_MASK 0x00100000 /* virtual interrupt pending */
  25. #define ID_MASK 0x00200000
  26. #define BIOSSEG 0x0f000
  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. * Return values for the 'vm86()' system call
  35. */
  36. #define VM86_TYPE(retval) ((retval) & 0xff)
  37. #define VM86_ARG(retval) ((retval) >> 8)
  38. #define VM86_SIGNAL 0 /* return due to signal */
  39. #define VM86_UNKNOWN 1 /* unhandled GP fault - IO-instruction or similar */
  40. #define VM86_INTx 2 /* int3/int x instruction (ARG = x) */
  41. #define VM86_STI 3 /* sti/popf/iret instruction enabled virtual interrupts */
  42. /*
  43. * This is the stack-layout when we have done a "SAVE_ALL" from vm86
  44. * mode - the main change is that the old segment descriptors aren't
  45. * useful any more and are forced to be zero by the kernel (and the
  46. * hardware when a trap occurs), and the real segment descriptors are
  47. * at the end of the structure. Look at ptrace.h to see the "normal"
  48. * setup.
  49. */
  50. struct vm86_regs {
  51. /*
  52. * normal regs, with special meaning for the segment descriptors..
  53. */
  54. long ebx;
  55. long ecx;
  56. long edx;
  57. long esi;
  58. long edi;
  59. long ebp;
  60. long eax;
  61. long __null_ds;
  62. long __null_es;
  63. long __null_fs;
  64. long __null_gs;
  65. long orig_eax;
  66. long eip;
  67. unsigned short cs, __csh;
  68. long eflags;
  69. long esp;
  70. unsigned short ss, __ssh;
  71. /*
  72. * these are specific to v86 mode:
  73. */
  74. unsigned short es, __esh;
  75. unsigned short ds, __dsh;
  76. unsigned short fs, __fsh;
  77. unsigned short gs, __gsh;
  78. };
  79. struct revectored_struct {
  80. unsigned long __map[8]; /* 256 bits */
  81. };
  82. struct vm86_struct {
  83. struct vm86_regs regs;
  84. unsigned long flags;
  85. unsigned long screen_bitmap;
  86. unsigned long cpu_type;
  87. struct revectored_struct int_revectored;
  88. struct revectored_struct int21_revectored;
  89. };
  90. /*
  91. * flags masks
  92. */
  93. #define VM86_SCREEN_BITMAP 0x0001
  94. #ifdef __KERNEL__
  95. void handle_vm86_fault(struct vm86_regs *, long);
  96. void handle_vm86_debug(struct vm86_regs *, long);
  97. #endif
  98. #endif
  99. __BEGIN_DECLS
  100. extern vm86(struct vm86_struct * __info);
  101. __END_DECLS
  102. #endif /*_SYS_VM86_H */
  103. #endif