vm86.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. * 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. #include <asm/processor-flags.h>
  15. #define BIOSSEG 0x0f000
  16. #define CPU_086 0
  17. #define CPU_186 1
  18. #define CPU_286 2
  19. #define CPU_386 3
  20. #define CPU_486 4
  21. #define CPU_586 5
  22. /*
  23. * Return values for the 'vm86()' system call
  24. */
  25. #define VM86_TYPE(retval) ((retval) & 0xff)
  26. #define VM86_ARG(retval) ((retval) >> 8)
  27. #define VM86_SIGNAL 0 /* return due to signal */
  28. #define VM86_UNKNOWN 1 /* unhandled GP fault
  29. - IO-instruction or similar */
  30. #define VM86_INTx 2 /* int3/int x instruction (ARG = x) */
  31. #define VM86_STI 3 /* sti/popf/iret instruction enabled
  32. virtual interrupts */
  33. /*
  34. * Additional return values when invoking new vm86()
  35. */
  36. #define VM86_PICRETURN 4 /* return due to pending PIC request */
  37. #define VM86_TRAP 6 /* return due to DOS-debugger request */
  38. /*
  39. * function codes when invoking new vm86()
  40. */
  41. #define VM86_PLUS_INSTALL_CHECK 0
  42. #define VM86_ENTER 1
  43. #define VM86_ENTER_NO_BYPASS 2
  44. #define VM86_REQUEST_IRQ 3
  45. #define VM86_FREE_IRQ 4
  46. #define VM86_GET_IRQ_BITS 5
  47. #define VM86_GET_AND_RESET_IRQ 6
  48. /*
  49. * This is the stack-layout seen by the user space program when we have
  50. * done a translation of "SAVE_ALL" from vm86 mode. The real kernel layout
  51. * is 'kernel_vm86_regs' (see below).
  52. */
  53. struct vm86_regs {
  54. /*
  55. * normal regs, with special meaning for the segment descriptors..
  56. */
  57. long ebx;
  58. long ecx;
  59. long edx;
  60. long esi;
  61. long edi;
  62. long ebp;
  63. long eax;
  64. long __null_ds;
  65. long __null_es;
  66. long __null_fs;
  67. long __null_gs;
  68. long orig_eax;
  69. long eip;
  70. unsigned short cs, __csh;
  71. long eflags;
  72. long esp;
  73. unsigned short ss, __ssh;
  74. /*
  75. * these are specific to v86 mode:
  76. */
  77. unsigned short es, __esh;
  78. unsigned short ds, __dsh;
  79. unsigned short fs, __fsh;
  80. unsigned short gs, __gsh;
  81. };
  82. struct revectored_struct {
  83. unsigned long __map[8]; /* 256 bits */
  84. };
  85. struct vm86_struct {
  86. struct vm86_regs regs;
  87. unsigned long flags;
  88. unsigned long screen_bitmap;
  89. unsigned long cpu_type;
  90. struct revectored_struct int_revectored;
  91. struct revectored_struct int21_revectored;
  92. };
  93. /*
  94. * flags masks
  95. */
  96. #define VM86_SCREEN_BITMAP 0x0001
  97. struct vm86plus_info_struct {
  98. unsigned long force_return_for_pic:1;
  99. unsigned long vm86dbg_active:1; /* for debugger */
  100. unsigned long vm86dbg_TFpendig:1; /* for debugger */
  101. unsigned long unused:28;
  102. unsigned long is_vm86pus:1; /* for vm86 internal use */
  103. unsigned char vm86dbg_intxxtab[32]; /* for debugger */
  104. };
  105. struct vm86plus_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. struct vm86plus_info_struct vm86plus;
  113. };
  114. #endif /* _UAPI_ASM_X86_VM86_H */