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.

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