home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / UNIX3862.ZIP / U386-06.ZIP / U386-6.TD0 / usr / include / sys / v86.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-06-26  |  11.2 KB  |  225 lines

  1. /*    Copyright (c) 1984, 1986, 1987, 1988 AT&T    */
  2. /*      All Rights Reserved      */
  3.  
  4. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T    */
  5. /*    The copyright notice above does not evidence any       */
  6. /*    actual or intended publication of such source code.    */
  7.  
  8. /*    Copyright (c) 1987, 1988 Microsoft Corporation    */
  9. /*      All Rights Reserved    */
  10.  
  11. /*    This Module contains Proprietary Information of Microsoft  */
  12. /*    Corporation and should be treated as Confidential.       */
  13.  
  14. #ident    "@(#)head.sys:v86.h    1.4"
  15.  
  16. /*
  17. **  Move the following definition to proc.h stat code definitions
  18. */
  19.  
  20. #define NV86TASKS       20              /* Maximum number of V86 tasks  */
  21.  
  22. #define V86VIRTSIZE     0x0100  /* Size of virtual 8086 in pages ( 1M bytes)*/
  23. #define V86WRAPSIZE     0x0010  /* Size of copy/wrap in pages    (64K bytes)*/
  24. #define V86XTSSSIZE     0x0010  /* Size of Xtss in pages         (64K bytes)*/
  25. #define V86SIZE         0x0400  /* Size of v86 region            ( 4M bytes)*/
  26.  
  27. /* Definitions for Lotus/Intel/Microsoft Expanded Memory Emulation
  28. */
  29.  
  30. #define V86EMM_PGSIZE       0x4000  /* Size of Expanded memory page         */
  31. #define V86EMM_LBASE    0x00200000  /* Expected lowest EMM logical page addr*/
  32. #define V86EMM_LENGTH   0x00200000  /* Expected size EMM logical pages      */
  33. #define V86EMM_PBASE    0x000D0000  /* EMM physical page address            */
  34. #define V86EMM_PBASE0   0x000D0000  /* EMM physical page address            */
  35. #define V86EMM_PBASE1   0x000D4000  /* EMM physical page address            */
  36. #define V86EMM_PBASE2   0x000D8000  /* EMM physical page address            */
  37. #define V86EMM_PBASE3   0x000DC000  /* EMM physical page address            */
  38. #define V86EMM_NUMPGS            4  /* Number of EMM physical pages         */
  39.  
  40.  
  41. /*  General definitions for a dual mode process
  42. */
  43.  
  44. #define XTSSADDR        ((caddr_t)0x110000L)    /* XTSS addr in user mem*/
  45. #define ARPL            0x63            /* ARPL inst, V86 invalid opcode*/
  46. #define V86_RCS         0xF000          /* Reset CS for V86 mode        */
  47. #define V86_RIP         0xFFF0          /* Reset IP for V86 mode        */
  48. #define V86_DELTA_NICE  10              /* Preferential nice for v86    */
  49. #define V86_TIMER_BOUND 10              /* Pending ticks limit for ECT  */
  50.  
  51. #define V86_SLICE       25              /* Default timeslice, >1 v86proc*/
  52. #define V86_SLICE_SHIFT 3               /* Max shift for time slice     */
  53.  
  54. #define    V86_PRI_NORM    0        /* Normal priority state    */
  55. #define    V86_PRI_LO    1        /* Low priority state, busywait    */
  56. #define    V86_PRI_HI    2        /* Hi priority state, pseudorupt*/
  57. #define V86_PRI_XHI     3               /* Extra high, urgent pseudorupt*/
  58. #define    V86_SHIFT_NORM    0        /* Timeslice shift for norm pri    */
  59. #define    V86_SHIFT_LO    V86_SLICE_SHIFT    /* Timeslice shift for lo   pri */
  60. #define    V86_SHIFT_HI    V86_SLICE_SHIFT    /* Timeslice shift for hi   pri */
  61.  
  62. /*  The maximum number of arguments that can be used for v86() system
  63. **  call is dependent on the maximum number of arguments allowed for
  64. **  the sysi86 call in sysent.c. Since the v86() system call is a sub-
  65. **  function (SI86V86) of the sysi86 call and v86() itself has sub-
  66. **  functions, the maximum arguments for each sub-function of the v86()
  67. **  system call is two less than the maximum allowed for the sysi86
  68. **  system call. The value defined here is assumed in the library.
  69. */
  70.  
  71. #define V86SC_MAXARGS   3               /* Includes sub-func # of v86() */
  72.  
  73. /*  SI86V86 is a sub system call of the system call "sysi86". The following
  74. **  definitions are sub system calls for SI86V86 and are processed in v86.c
  75. */
  76.  
  77. #define V86SC_INIT      1               /* v86init() system call        */
  78. #define V86SC_SLEEP     2               /* v86sleep() system call       */
  79. #define V86SC_MEMFUNC   3               /* v86memfunc() system call     */
  80. #define V86SC_IOPL      4               /* v86iopriv () system call     */
  81. /*
  82. **  The V86 timer has a frequency of 18.2 times a second. The Unix
  83. **  timer has a frequency of 100 times a second. So the following
  84. **  value ensures that the ECT gets an interrupt at least as often
  85. **  as it needs one.
  86. */
  87.  
  88. #define V86TIMER        5               /* Every 50 ms (20 times a second) */
  89.  
  90. /*  Software Interrupt mask bit array definitions
  91. */
  92.  
  93. #define V86_IMASKSIZE   256             /* Max number of software INTs  */
  94. #define V86_IMASKBITS   ((V86_IMASKSIZE + 31) / 32)
  95.                     /* # of bits for software INTs  */
  96.  
  97. /*  The offsets of members "xt_viflag", "xt_signo" and "xt_hdlr" are
  98. **  hard coded in the file "v86enter.s". So any changes to the struc-
  99. **  that changes these offsets have to be reflected in this file.
  100. **  This file is part of the ECT.
  101. **
  102. **  NOTE: The value of "xt_intr_pin" should be 0xFF or 0.
  103. */
  104.  
  105. typedef struct v86xtss
  106. {   struct tss386 xt_tss;               /* Normal TSS structure         */
  107.     unsigned int *xt_vflptr;        /* Ptr to 8086 virtual flags    */
  108.     unsigned char xt_magictrap;         /* Saved byte of virt intr      */
  109.     unsigned char xt_magicstat;         /* Status of magic byte         */
  110.     unsigned char xt_tslice_shft;       /* Time slice shift requested   */
  111.     unsigned char xt_intr_pin;          /* Interrupt to virtual machine */
  112.     time_t xt_lbolt;                    /* Lightning bolt value         */
  113.     unsigned int xt_viflag;             /* Virtual interrupt flag       */
  114.     unsigned int xt_vimask;             /* Mask for virtual interrupts  */
  115.     unsigned int xt_signo;              /* Sig number on V86VI_SIGHDL   */
  116.     int (* xt_hdlr)();                  /* Sig handler for V86VI_SIGHDL */
  117.     unsigned int xt_timer_count;        /* Number of pending timer ticks*/
  118.     unsigned int xt_timer_bound;        /* Ticks before forcing ECT in  */
  119.     uint xt_imaskbits[V86_IMASKBITS];   /* Bit map for software INTs    */
  120.     unsigned int xt_oldbitmap[32];      /* For I/O bitmap on old ECTs   */
  121.     unsigned char xt_magic[4];          /* XTSS version indicator       */
  122.     unsigned int xt_viurgent;           /* Mask for urgent interrupts   */
  123.     unsigned int xt_vitoect;            /* Mask for interrupts to ECT   */
  124.     unsigned int xt_reserved[10];       /* Reserved for future expansion*/
  125. }   xtss_t;
  126.  
  127.  
  128.  
  129. /*  Definitions for the field "xt_magicstat". The location "xt_magictrap"
  130. **  is valid only when "xt_magicstat" field is set to XT_MSTAT_OPSAVED.
  131. */
  132.  
  133. #define XT_MSTAT_NOPROCESS      0       /* Do not process virtual intr  */
  134. #define XT_MSTAT_PROCESS        1       /* Process virtual intr         */
  135. #define XT_MSTAT_OPSAVED        2       /* v86 program opcode saved     */
  136. #define XT_MSTAT_POSTING        3       /* Phoenix defined              */
  137.  
  138. struct v86parm
  139. {   xtss_t   *xtssp;                    /* Ptr to XTSS in user data     */
  140.     unsigned long szxtss;               /* Length in bytes of XTSS      */
  141.     unsigned char magic[4];             /* XTSS version indicator       */
  142.     unsigned long szbitmap;             /* Length in bytes of I/O bitmap*/
  143. };
  144.  
  145. typedef struct v86memory
  146. {   int      vmem_cmd;                  /* Sub command for screen func  */
  147.     paddr_t  vmem_physaddr;             /* Physical memory base for map */
  148.     caddr_t  vmem_membase;              /* Screen memory base           */
  149.     int      vmem_memlen;               /* Length of screen memory      */
  150. } v86memory_t;
  151.  
  152. /*  Definitions for the field "vmem_cmd".
  153. */
  154.  
  155. #define V86MEM_MAP      1               /* Map virt addr to physical    */
  156. #define V86MEM_TRACK    2               /* Track memory modifications   */
  157. #define V86MEM_UNTRACK  3               /* Untrack memory modifications */
  158. #define V86MEM_UNMAP    4               /* Unmap virt addr              */
  159. #define V86MEM_EMM      5               /* LIM expanded memory emulation*/
  160. #define V86MEM_GROW     6               /* Grow Lim expanded memory     */
  161.  
  162. typedef struct v86dat
  163. {   proc_t  *vp_procp;                  /* Ptr to process's proc struc  */
  164.     sel_t    vp_oldtr;                  /* Old task register            */
  165.     unsigned short vp_szxtss;           /* Size of XTSS in user space   */
  166.     xtss_t  *vp_xtss;                   /* Address of nailed XTSS       */
  167.     v86memory_t vp_mem;                 /* Memory map/track definitions */
  168.     long     vp_emm[V86EMM_NUMPGS];     /* Current EMM regs emulation   */
  169.     char     vp_wakeup;                 /* Wakeup process on virt intr  */
  170.     char     vp_slice_shft;             /* Last slice shift from xtss   */
  171.     char     vp_nice;                   /* Requested nice from sys call */
  172.     char     vp_hpnice;                 /* Nice value for high priority */
  173.     char     vp_pri_state;        /* Priority state = hi,norm,lo    */
  174. }   v86_t;
  175.  
  176.  
  177. /*  Virtual interrupt bit definitions for the field "vp_viflag".
  178. **  The low order 16 bits reflect the setting of the AT hardware
  179. **  interrupts. The high order 16 bits are used for other inter-
  180. **  rupts.
  181. **
  182. **  NOTE: The value of V86VI_SIGHDL is hard coded in the file
  183. **  "v86enter.s". Any change to this value has to reflected in
  184. **  this file. This file is part of the ECT.
  185. */
  186.  
  187. #define V86VI_NONE      0x00000000      /* No interrupts                */
  188. #define V86VI_TIMER     0x00000001      /* Virtual timer interrupt      */
  189. #define V86VI_KBD       0x00000002      /* Scancode rcvd when buf empty */
  190. #define V86VI_SLAVE     0x00000004      /* Can be reused when needed    */
  191. #define V86VI_SERIAL1   0x00000008      /* Serial port 1 state change   */
  192. #define V86VI_SERIAL0   0x00000010      /* Serial port 0 state change   */
  193. #define V86VI_PRL1      0x00000020      /* Parallel port 1 state change */
  194. #define V86VI_MOUSE     0x00000020      /* Microsoft mouse              */
  195. #define V86VI_DISK      0x00000040      /* Fixed and floppy disk        */
  196. #define V86VI_PRL0      0x00000080      /* Parallel port 0 state change */
  197.  
  198. #define V86VI_RCLOCK    0x00000100      /* Realtime Clock interrupt     */
  199. #define V86VI_NET       0x00000200      /* Network interrupts           */
  200. #define V86VI_RSVD_1    0x00000400      /* Reserved 1                   */
  201. #define V86VI_RSVD_2    0x00000800      /* Reserved 2                   */
  202. #define V86VI_RSVD_3    0x00001000      /* Reserved 3                   */
  203. #define V86VI_COPROC    0x00002000      /* Coprocessor interrupt        */
  204. #define V86VI_FDISK     0x00004000      /* Fixed disk controller        */
  205. #define V86VI_RSVD_4    0x00008000      /* Reserved 4                   */
  206.  
  207. #define V86VI_DIV0      0x00010000      /* Divide by 0 (vector 0)       */
  208. #define V86VI_SGLSTP    0x00020000      /* Single step intr (vector 1)  */
  209. #define V86VI_BRKPT     0x00040000      /* Break point intr (vector 3)  */
  210. #define V86VI_OVERFLOW  0x00080000      /* Overflow fault (vector 4)    */
  211. #define V86VI_BOUND     0x00100000      /* Bound exception (vector 5)   */
  212. #define V86VI_INVOP     0x00200000      /* Invalid opcode (vector 6)    */
  213. #define V86VI_SIGHDL    0x00400000      /* Virtual signal hdlr interrupt*/
  214. #define V86VI_MEMORY    0x00800000      /* Tracking memory has changed  */
  215. #define V86VI_LBOLT     0x01000000      /* Lbolt value has changed      */
  216.  
  217. /* Virtual interrupt subcodes for V86VI_SERIAL[01] interrupts.  These values
  218. ** appear in  the fields "xt_s[01]flag".
  219. */
  220. #define V86SI_DATA      0x00000001      /* New data available from kbd  */
  221. #define V86SI_MODEM     0x00000002      /* Modem status line[s] changed */
  222.  
  223. #define V86_MAGIC0      'X'             /* Byte for XTSS magic[0]       */
  224. #define V86_MAGIC1      'T'             /* Byte for XTSS magic[1]       */
  225.