home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v5.zip / DDKX86 / SRC / DEV / TOUCHDD / DIDD / SEGDEF.ASM < prev    next >
Assembly Source File  |  1995-04-14  |  5KB  |  226 lines

  1. ;*DDK*************************************************************************/
  2. ;
  3. ; COPYRIGHT    Copyright (C) 1995 IBM Corporation
  4. ;
  5. ;    The following IBM OS/2 WARP source code is provided to you solely for
  6. ;    the purpose of assisting you in your development of OS/2 WARP device
  7. ;    drivers. You may use this code in accordance with the IBM License
  8. ;    Agreement provided in the IBM Device Driver Source Kit for OS/2. This
  9. ;    Copyright statement may not be removed.;
  10. ;*****************************************************************************/
  11. ;/*****************************************************************************
  12. ;*
  13. ;* SOURCE FILE NAME = SEGDEF.ASM
  14. ;*
  15. ;* DESCRIPTIVE NAME = Define segments, groups & their order
  16. ;*
  17. ;*
  18. ;* VERSION      V2.0
  19. ;*
  20. ;* DATE         09/23/91
  21. ;*
  22. ;* DESCRIPTION
  23. ;*
  24. ;* FUNCTIONS
  25. ;*
  26. ;*
  27. ;* NOTES        NONE
  28. ;*
  29. ;* STRUCTURES   NONE
  30. ;*
  31. ;* EXTERNAL REFERENCES
  32. ;*
  33. ;*              NONE
  34. ;*
  35. ;* EXTERNAL FUNCTIONS
  36. ;*
  37. ;*              NONE
  38. ;*
  39. ;* CHANGE ACTIVITY =
  40. ;*   DATE      FLAG        APAR   CHANGE DESCRIPTION
  41. ;*   --------  ----------  -----  --------------------------------------
  42. ;*   mm/dd/yy  @Vr.mpppxx  xxxxx  xxxxxxx
  43. ;*****************************************************************************/
  44.  
  45.         .286p
  46.  
  47.         .seq                            ; define segments in the order they
  48.                                         ;   are required
  49.  
  50.  
  51.         public  _last_data
  52.         public  _last_code
  53.  
  54. ;*
  55. ;* ***EP Segment & Group Definitions
  56. ;*
  57. ;* The order the segments are defined here determines the order the segments
  58. ;* appear in the executable.
  59. ;*
  60. ;* These segment definitions must be matched by a corresponding entry in the
  61. ;* linker definition file. They must also match the 'C' compilers segments.
  62. ;*
  63.  
  64. ;*
  65. ;* Main data segments.
  66. ;* These logical segments are grouped together to form a physical segment.
  67. ;* They must be first segment in device driver
  68. ;*
  69.  
  70.  
  71. ;*
  72. ;* Initialised global data.
  73. ;*
  74. _DATA           SEGMENT         WORD PUBLIC 'DATA'
  75. _DATA           ENDS
  76.  
  77. ;*
  78. ;* ?
  79. ;*
  80. CONST           SEGMENT         WORD PUBLIC 'CONST'
  81. CONST           ENDS
  82.  
  83. ;*
  84. ;* Un-initialised global data. The linker moves this to c_common or far_bss
  85. ;*
  86. _BSS            SEGMENT         WORD PUBLIC 'BSS'
  87. _BSS            ENDS
  88.  
  89. ;*
  90. ;* Un-initialised near global data.
  91. ;*
  92. c_common        SEGMENT         WORD PUBLIC 'BSS'
  93. c_common        ENDS
  94.  
  95. ;*
  96. ;* Only get far_bss if use far un-initialised global data or
  97. ;* the linker decides(?) to put near un-init global data there.
  98. ;*
  99. FAR_BSS         SEGMENT         WORD PUBLIC 'FAR_BSS'
  100. FAR_BSS         ENDS
  101.  
  102. ;*
  103. ;* dummy segment to mark end of first data segment, used in req_init
  104. ;*
  105. LAST_DATA       SEGMENT         WORD PUBLIC 'LAST_DATA'
  106. _last_data      equ     $               ; mark end of data segment
  107. LAST_DATA       ENDS
  108.  
  109.  
  110. ;*
  111. ;* main code segments
  112. ;*
  113. ;* Default code segments
  114. ;*
  115. _TEXT           SEGMENT         WORD PUBLIC 'CODE'
  116. _TEXT           ENDS
  117.  
  118. ;*
  119. ;* named code segment for fixed code
  120. ;*
  121. FIXED_TEXT      SEGMENT         WORD PUBLIC 'CODE'
  122. FIXED_TEXT      ENDS
  123.  
  124. ;*
  125. ;* device helper routines
  126. ;* DEVHLP_TEXT    SEGMENT       WORD PUBLIC 'CODE'
  127. ;* DEVHLP_TEXT    ENDS
  128.  
  129.  
  130. ;*
  131. ;* dummy segment to mark end of first code segment, used in req_init
  132. ;*
  133. LAST_CODE       SEGMENT         WORD PUBLIC 'CODE'
  134. _last_code      equ     $               ; mark end of code segment
  135. LAST_CODE       ENDS
  136.  
  137.  
  138. ;*
  139. ;* moveable code segments
  140. ;*
  141. ;* named code segment for moveable code
  142. ;*
  143. MOVE1_TEXT      SEGMENT         WORD PUBLIC 'CODE'
  144. MOVE1_TEXT      ENDS
  145.  
  146.  
  147. ;*
  148. ;* define segment groupings
  149. ;*
  150. DGROUP          GROUP   _DATA, CONST, _BSS, c_common, FAR_BSS, LAST_DATA
  151. CGROUP          GROUP   _TEXT, FIXED_TEXT, LAST_CODE
  152. M1GROUP         GROUP   MOVE1_TEXT
  153.  
  154.  
  155. if 0
  156.  
  157. _TEXT   SEGMENT
  158.         ASSUME  cs:_TEXT
  159.  
  160. ;*
  161. ;* This is a replacement for the 'C' compiler's stack checking routines.
  162. ;* It allocates space for local variables without generating any errors.
  163. ;* It is here to resolve __a?chkstk in library routines which may have
  164. ;* explicitly enabled stack checking & prevents the 'C' runtime being included.
  165. ;*
  166. ;* Entry:        AX - size of local stack frame required
  167. ;* Exit:         SP - new stack frame
  168. ;* Uses:         BX, CX, DX
  169. ;*
  170.  
  171.  
  172. public          __aNchkstk
  173. public          __aFchkstk
  174.  
  175. __aNchkstk      proc      near
  176.  
  177.         pop     cx                      ; get return address
  178.  
  179.         mov     bx, sp                  ; create local frame
  180.         sub     bx, ax
  181.         mov     sp, bx
  182.  
  183.         jmp     cx                      ; near ret to cx
  184.  
  185. __aNchkstk      endp
  186.  
  187.  
  188.  
  189. __aFchkstk      proc      far
  190.  
  191.         pop     cx                      ; get return address
  192.         pop     dx
  193.  
  194.         mov     bx, sp                  ; create local frame
  195.         sub     bx, ax
  196.         mov     sp, bx
  197.  
  198.         push    dx                      ; far ret to dx:cx
  199.         push    cx
  200.         ret
  201.  
  202. __aFchkstk      endp
  203.  
  204.  
  205.         public  __astart
  206.  
  207. __astart                proc    far
  208.         int     3
  209. __astart                endp
  210.  
  211.         public  _main
  212.  
  213. _main           proc    far
  214.         int     3
  215. _main           endp
  216.  
  217. _TEXT           ENDS
  218.  
  219. endif
  220.  
  221.         end
  222.  
  223. ;*
  224. ;* end
  225. ;*
  226.