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.

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