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.

149 lines
4.4 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. codeseqp.h
  5. Abstract:
  6. This header file contains the non-processor-specific includes and
  7. declarations used by mips, ppc, and alpha codeseq.c files.
  8. Author:
  9. Barry Bond (barrybo) creation-date 23-Sept-1996
  10. Revision History:
  11. 24-Aug-1999 [askhalid] copied from 32-bit wx86 directory and make work for 64bit.
  12. 20-Sept-1999[barrybo] added FRAG2REF(LockCmpXchg8bFrag32, ULONGLONG)
  13. --*/
  14. #include <nt.h>
  15. #include <ntrtl.h>
  16. #include <nturtl.h>
  17. #include <windows.h>
  18. #define _WX86CPUAPI_
  19. #define _codegen_
  20. #include <wx86.h>
  21. #include <wx86nt.h>
  22. #include <wx86cpu.h>
  23. #include <cpuassrt.h>
  24. #include <instr.h>
  25. #include <config.h>
  26. #include <threadst.h>
  27. #include <frag.h>
  28. #include <fragp.h>
  29. #include <ptchstrc.h>
  30. #include <codeseq.h>
  31. #include <compiler.h>
  32. #include <codegen.h>
  33. #include <codesize.h>
  34. #include <opt.h>
  35. #if _ALPHA_
  36. #include <soalpha.h>
  37. #elif _MIPS_
  38. #include <somips.h>
  39. #elif _PPC_
  40. #include <soppc.h>
  41. #endif
  42. #include <process.h>
  43. extern int JumpToNextCompilationUnitHelper();
  44. extern int CallJxxHelper();
  45. extern int CallJxxSlowHelper();
  46. extern int CallJxxFwdHelper();
  47. extern int CallJmpDirectHelper();
  48. extern int CallJmpDirectSlowHelper();
  49. extern int CallJmpFwdDirectHelper();
  50. extern int CallJmpfDirectHelper();
  51. extern int CallJmpfDirect2Helper();
  52. extern int CallDirectHelper();
  53. extern int CallfDirectHelper();
  54. extern int CallDirectHelper2();
  55. extern int CallfDirectHelper2();
  56. extern int CallIndirectHelper();
  57. extern int CallfIndirectHelper();
  58. extern int IndirectControlTransferHelper();
  59. extern int IndirectControlTransferFarHelper();
  60. extern int RegisterOffset[];
  61. #define START_FRAGMENT \
  62. PULONG d = CodeLocation;
  63. //
  64. // fragment generation function beginnings and endings
  65. //
  66. #if _ALPHA_
  67. #define FRAGMENT(name) \
  68. ULONG \
  69. Gen##name ( \
  70. IN PULONG CodeLocation, \
  71. IN ULONG CurrentECU, \
  72. IN PINSTRUCTION Instruction \
  73. ) \
  74. { \
  75. const ULONG fCompiling = TRUE; \
  76. START_FRAGMENT
  77. #else
  78. #define FRAGMENT(name) \
  79. ULONG \
  80. Gen##name ( \
  81. IN PULONG CodeLocation, \
  82. IN PINSTRUCTION Instruction \
  83. ) \
  84. { \
  85. const ULONG fCompiling = TRUE; \
  86. START_FRAGMENT
  87. #endif
  88. #define END_FRAGMENT \
  89. return (ULONG)(ULONGLONG)(d - CodeLocation) * sizeof(ULONG); \
  90. }
  91. #define OP_FRAGMENT(name) \
  92. ULONG \
  93. Gen##name ( \
  94. IN PULONG CodeLocation, \
  95. IN POPERAND Operand, \
  96. IN ULONG OperandNumber \
  97. ) \
  98. { \
  99. START_FRAGMENT
  100. //
  101. // These functions have a private interface. The caller and callee have to
  102. // agree how many of the parameters are valid. This lets us use the same
  103. // basic form for all of the code that goes into the translation cache
  104. //
  105. #if _ALPHA_
  106. #define PATCH_FRAGMENT(name) \
  107. ULONG \
  108. Gen##name ( \
  109. IN PULONG CodeLocation, \
  110. IN ULONG fCompiling, \
  111. IN ULONG CurrentECU, \
  112. IN ULONG Param1, \
  113. IN ULONG Param2 \
  114. ) \
  115. { \
  116. START_FRAGMENT
  117. #else
  118. #define PATCH_FRAGMENT(name) \
  119. ULONG \
  120. Gen##name ( \
  121. IN PULONG CodeLocation, \
  122. IN ULONG fCompiling, \
  123. IN ULONG Param1, \
  124. IN ULONG Param2 \
  125. ) \
  126. { \
  127. START_FRAGMENT
  128. #endif