syscall.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /* default linux values for the selectors */
  2. #define __USER_CS (0x23)
  3. #define __USER_DS (0x2B)
  4. struct target_pt_regs {
  5. long ebx;
  6. long ecx;
  7. long edx;
  8. long esi;
  9. long edi;
  10. long ebp;
  11. long eax;
  12. int xds;
  13. int xes;
  14. long orig_eax;
  15. long eip;
  16. int xcs;
  17. long eflags;
  18. long esp;
  19. int xss;
  20. };
  21. /* ioctls */
  22. #define TARGET_LDT_ENTRIES 8192
  23. #define TARGET_LDT_ENTRY_SIZE 8
  24. #define TARGET_GDT_ENTRIES 9
  25. #define TARGET_GDT_ENTRY_TLS_ENTRIES 3
  26. #define TARGET_GDT_ENTRY_TLS_MIN 6
  27. #define TARGET_GDT_ENTRY_TLS_MAX (TARGET_GDT_ENTRY_TLS_MIN + TARGET_GDT_ENTRY_TLS_ENTRIES - 1)
  28. struct target_modify_ldt_ldt_s {
  29. unsigned int entry_number;
  30. abi_ulong base_addr;
  31. unsigned int limit;
  32. unsigned int flags;
  33. };
  34. /* vm86 defines */
  35. #define TARGET_BIOSSEG 0x0f000
  36. #define TARGET_CPU_086 0
  37. #define TARGET_CPU_186 1
  38. #define TARGET_CPU_286 2
  39. #define TARGET_CPU_386 3
  40. #define TARGET_CPU_486 4
  41. #define TARGET_CPU_586 5
  42. #define TARGET_VM86_SIGNAL 0 /* return due to signal */
  43. #define TARGET_VM86_UNKNOWN 1 /* unhandled GP fault - IO-instruction or similar */
  44. #define TARGET_VM86_INTx 2 /* int3/int x instruction (ARG = x) */
  45. #define TARGET_VM86_STI 3 /* sti/popf/iret instruction enabled virtual interrupts */
  46. /*
  47. * Additional return values when invoking new vm86()
  48. */
  49. #define TARGET_VM86_PICRETURN 4 /* return due to pending PIC request */
  50. #define TARGET_VM86_TRAP 6 /* return due to DOS-debugger request */
  51. /*
  52. * function codes when invoking new vm86()
  53. */
  54. #define TARGET_VM86_PLUS_INSTALL_CHECK 0
  55. #define TARGET_VM86_ENTER 1
  56. #define TARGET_VM86_ENTER_NO_BYPASS 2
  57. #define TARGET_VM86_REQUEST_IRQ 3
  58. #define TARGET_VM86_FREE_IRQ 4
  59. #define TARGET_VM86_GET_IRQ_BITS 5
  60. #define TARGET_VM86_GET_AND_RESET_IRQ 6
  61. /*
  62. * This is the stack-layout seen by the user space program when we have
  63. * done a translation of "SAVE_ALL" from vm86 mode. The real kernel layout
  64. * is 'kernel_vm86_regs' (see below).
  65. */
  66. struct target_vm86_regs {
  67. /*
  68. * normal regs, with special meaning for the segment descriptors..
  69. */
  70. abi_long ebx;
  71. abi_long ecx;
  72. abi_long edx;
  73. abi_long esi;
  74. abi_long edi;
  75. abi_long ebp;
  76. abi_long eax;
  77. abi_long __null_ds;
  78. abi_long __null_es;
  79. abi_long __null_fs;
  80. abi_long __null_gs;
  81. abi_long orig_eax;
  82. abi_long eip;
  83. unsigned short cs, __csh;
  84. abi_long eflags;
  85. abi_long esp;
  86. unsigned short ss, __ssh;
  87. /*
  88. * these are specific to v86 mode:
  89. */
  90. unsigned short es, __esh;
  91. unsigned short ds, __dsh;
  92. unsigned short fs, __fsh;
  93. unsigned short gs, __gsh;
  94. };
  95. struct target_revectored_struct {
  96. abi_ulong __map[8]; /* 256 bits */
  97. };
  98. struct target_vm86_struct {
  99. struct target_vm86_regs regs;
  100. abi_ulong flags;
  101. abi_ulong screen_bitmap;
  102. abi_ulong cpu_type;
  103. struct target_revectored_struct int_revectored;
  104. struct target_revectored_struct int21_revectored;
  105. };
  106. /*
  107. * flags masks
  108. */
  109. #define TARGET_VM86_SCREEN_BITMAP 0x0001
  110. struct target_vm86plus_info_struct {
  111. abi_ulong flags;
  112. #define TARGET_force_return_for_pic (1 << 0)
  113. #define TARGET_vm86dbg_active (1 << 1) /* for debugger */
  114. #define TARGET_vm86dbg_TFpendig (1 << 2) /* for debugger */
  115. #define TARGET_is_vm86pus (1 << 31) /* for vm86 internal use */
  116. unsigned char vm86dbg_intxxtab[32]; /* for debugger */
  117. };
  118. struct target_vm86plus_struct {
  119. struct target_vm86_regs regs;
  120. abi_ulong flags;
  121. abi_ulong screen_bitmap;
  122. abi_ulong cpu_type;
  123. struct target_revectored_struct int_revectored;
  124. struct target_revectored_struct int21_revectored;
  125. struct target_vm86plus_info_struct vm86plus;
  126. };
  127. /* FreeBSD sysarch(2) */
  128. #define TARGET_FREEBSD_I386_GET_LDT 0
  129. #define TARGET_FREEBSD_I386_SET_LDT 1
  130. /* I386_IOPL */
  131. #define TARGET_FREEBSD_I386_GET_IOPERM 3
  132. #define TARGET_FREEBSD_I386_SET_IOPERM 4
  133. /* xxxxx */
  134. #define TARGET_FREEBSD_I386_VM86 6
  135. #define TARGET_FREEBSD_I386_GET_FSBASE 7
  136. #define TARGET_FREEBSD_I386_SET_FSBASE 8
  137. #define TARGET_FREEBSD_I386_GET_GSBASE 9
  138. #define TARGET_FREEBSD_I386_SET_GSBASE 10
  139. #define UNAME_MACHINE "i386"