Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

144 lines
3.4 KiB

  1. ;/* *************************************************************************
  2. ;** INTEL Corporation Proprietary Information
  3. ;**
  4. ;** This listing is supplied under the terms of a license
  5. ;** agreement with INTEL Corporation and may not be copied
  6. ;** nor disclosed except in accordance with the terms of
  7. ;** that agreement.
  8. ;**
  9. ;** Copyright (c) 1995 Intel Corporation.
  10. ;** All Rights Reserved.
  11. ;**
  12. ;** *************************************************************************
  13. ;*/
  14. ;////////////////////////////////////////////////////////////////////////////
  15. ;//
  16. ;// $Header: S:\h26x\src\common\cmemmod.inv 1.1 27 Dec 1995 14:12:08 RMCKENZX $
  17. ;// $Log: S:\h26x\src\common\cmemmod.inv $
  18. ;//
  19. ;// Rev 1.1 27 Dec 1995 14:12:08 RMCKENZX
  20. ;//
  21. ;// Added copyright notice
  22. ;//
  23. ;////////////////////////////////////////////////////////////////////////////
  24. IFDEF memmodel_inc
  25. ELSE
  26. IFDEF WIN32
  27. .486
  28. .MODEL FLAT, STDCALL
  29. Zd EQU <>
  30. Ze EQU <>
  31. Zf EQU <>
  32. Zg EQU <>
  33. Zs EQU <>
  34. Zc EQU <>
  35. BPTR equ ebp
  36. SPTR equ esp
  37. NAT_WORD TEXTEQU <DWORD>
  38. ELSE
  39. .MODEL MEDIUM
  40. .486
  41. Zd EQU <ds:>
  42. Ze EQU <es:>
  43. Zf EQU <fs:>
  44. Zg EQU <gs:>
  45. Zs EQU <ss:>
  46. Zc EQU <cs:>
  47. BPTR equ bp
  48. SPTR equ sp
  49. NAT_WORD TEXTEQU <WORD>
  50. ENDIF
  51. PD EQU <DWORD PTR>
  52. PW EQU <WORD PTR>
  53. PB EQU <BYTE PTR>
  54. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  55. ;;
  56. ;; this provides a normal return when under WIN32 and
  57. ;; a 16 bit mode instruction override when under not WIN32
  58. ;;
  59. ;; This is needed as the segment this code runs in is
  60. ;; in 32 bit mode but the caller is in 16 bit mode.
  61. ;;
  62. ;; under WIN32, we must relieve the stack of passed
  63. ;; args, and with proper setup of the PROC directive,
  64. ;; the assembler will calculate the correct value
  65. ;; to relieve every time it sees the ret.
  66. ;;
  67. ;; this also sets the language to 'C' when not under WIN32 and
  68. ;; stdcall when under WIN32
  69. ;;
  70. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  71. ifdef WIN32
  72. LANG TEXTEQU <stdcall>
  73. DIST TEXTEQU <>
  74. rturn MACRO
  75. ret
  76. ENDM
  77. else
  78. LANG TEXTEQU <C>
  79. DIST TEXTEQU <FAR>
  80. rturn MACRO
  81. db 66h
  82. retf
  83. ENDM
  84. endif
  85. memmodel_inc=1
  86. ; this is intended to emulate a disabled epilouge with the single
  87. ; exception of relieving the stack of passed parameters if
  88. ; the calling type is STDCALL.
  89. ;
  90. ; only stdcall and c calling conventions are directly supported.
  91. ; VARARGS is not supported.
  92. ; NONE of the standard prologue or epilogue switches
  93. ; are used.
  94. ; Like the standard epilogue, the use of retf, retn or ret n
  95. ; where n is the number of bytes to relieve, this macro
  96. ; is effectively disabled.
  97. ReturnAndRelieveEpilogueMacro MACRO procname, \
  98. flag, \
  99. parmbytes, \
  100. localbytes, \
  101. reglist, \
  102. macroargs
  103. LOCAL RET_DIST
  104. if (flag AND 020h)
  105. ; We are in a FAR procedure
  106. RET_DIST TEXTEQU <retf>
  107. else
  108. ; We are in a local procedure
  109. RET_DIST TEXTEQU <ret>
  110. endif
  111. if (flag AND 010h)
  112. ; user restoring the stack: ret n, retf or retn was used
  113. RET_DIST
  114. else
  115. ; user expects us to restore the stack: ret was used
  116. if (flag AND 007h) EQ 3
  117. ; stdcall calling convention
  118. if parmbytes EQ 0
  119. RET_DIST
  120. else
  121. RET_DIST parmbytes
  122. endif
  123. else
  124. ; assume 'C' calling convention
  125. RET_DIST
  126. endif
  127. endif
  128. ENDM
  129. ENDIF