Source code of Windows XP (NT5)
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.

483 lines
7.5 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. cpumain.c
  5. Abstract:
  6. Main entrypoints for IA64 ia64bt.dll. This code is really a dummy
  7. and a user can put in a real dll at a later date. As long as the
  8. entry points exist, we are fine. It is delay loaded by
  9. wow64cpu depending on whether the binary translation code is
  10. enabled.
  11. Author:
  12. 22-August-2000 v-cspira (Charles Spirakis)
  13. Revision History:
  14. --*/
  15. #define _WOW64BTAPI_
  16. #include <nt.h>
  17. #include <ntrtl.h>
  18. #include <nturtl.h>
  19. #include <ntosp.h>
  20. #include <kxia64.h>
  21. #include "wow64.h"
  22. #include "wow64cpu.h"
  23. #include "ia64cpu.h"
  24. #include "bintrans.h"
  25. ASSERTNAME;
  26. WOW64BTAPI
  27. NTSTATUS
  28. BTCpuProcessInit(
  29. PWSTR pImageName,
  30. PSIZE_T pCpuThreadSize
  31. )
  32. /*++
  33. Routine Description:
  34. Per-process initialization code
  35. Arguments:
  36. pImageName - IN the name of the image. The memory for this
  37. is freed after the call, so if the callee wants
  38. to keep the name around, they need to allocate space
  39. and copy it. DON'T SAVE THE POINTER!
  40. pCpuThreadSize - OUT ptr to number of bytes of memory the CPU
  41. wants allocated for each thread.
  42. Return Value:
  43. NTSTATUS.
  44. --*/
  45. {
  46. return STATUS_NOT_IMPLEMENTED;
  47. }
  48. WOW64BTAPI
  49. NTSTATUS
  50. BTCpuProcessTerm(
  51. HANDLE ProcessHandle
  52. )
  53. /*++
  54. Routine Description:
  55. Per-process termination code. Note that this routine may not be called,
  56. especially if the process is terminated by another process.
  57. Arguments:
  58. None.
  59. Return Value:
  60. NTSTATUS.
  61. --*/
  62. {
  63. return STATUS_NOT_IMPLEMENTED;
  64. }
  65. WOW64BTAPI
  66. NTSTATUS
  67. BTCpuThreadInit(
  68. PVOID pPerThreadData
  69. )
  70. /*++
  71. Routine Description:
  72. Per-thread termination code.
  73. Arguments:
  74. pPerThreadData - Pointer to zero-filled per-thread data with the
  75. size returned from CpuProcessInit.
  76. Return Value:
  77. NTSTATUS.
  78. --*/
  79. {
  80. return STATUS_NOT_IMPLEMENTED;
  81. }
  82. WOW64BTAPI
  83. NTSTATUS
  84. BTCpuThreadTerm(
  85. VOID
  86. )
  87. /*++
  88. Routine Description:
  89. Per-thread termination code. Note that this routine may not be called,
  90. especially if the thread is terminated abnormally.
  91. Arguments:
  92. None.
  93. Return Value:
  94. NTSTATUS.
  95. --*/
  96. {
  97. return STATUS_NOT_IMPLEMENTED;
  98. }
  99. WOW64BTAPI
  100. VOID
  101. BTCpuSimulate(
  102. VOID
  103. )
  104. /*++
  105. Routine Description:
  106. Call 32-bit code. The CONTEXT32 has already been set up to go.
  107. Arguments:
  108. None.
  109. Return Value:
  110. None. Never returns.
  111. --*/
  112. {
  113. }
  114. WOW64BTAPI
  115. VOID
  116. BTCpuResetFloatingPoint(
  117. VOID
  118. )
  119. /*++
  120. Routine Description:
  121. Modifies the floating point state to reset it to a non-error state
  122. Arguments:
  123. None.
  124. Return Value:
  125. None.
  126. --*/
  127. {
  128. }
  129. WOW64BTAPI
  130. VOID
  131. BTCpuResetToConsistentState(
  132. PEXCEPTION_POINTERS pExceptionPointers
  133. )
  134. /*++
  135. Routine Description:
  136. After an exception occurs, WOW64 calls this routine to give the CPU
  137. a chance to clean itself up and recover the CONTEXT32 at the time of
  138. the fault.
  139. CpuResetToConsistantState() needs to:
  140. 0) Check if the exception was from ia32 or ia64
  141. If exception was ia64, do nothing and return
  142. If exception was ia32, needs to:
  143. 1) Needs to copy CONTEXT eip to the TLS (WOW64_TLS_EXCEPTIONADDR)
  144. 2) reset the CONTEXT struction to be a valid ia64 state for unwinding
  145. this includes:
  146. 2a) reset CONTEXT ip to a valid ia64 ip (usually
  147. the destination of the jmpe)
  148. 2b) reset CONTEXT sp to a valid ia64 sp (TLS
  149. entry WOW64_TLS_STACKPTR64)
  150. 2c) reset CONTEXT gp to a valid ia64 gp
  151. 2d) reset CONTEXT teb to a valid ia64 teb
  152. 2e) reset CONTEXT psr.is (so exception handler runs as ia64 code)
  153. Arguments:
  154. pExceptionPointers - 64-bit exception information
  155. Return Value:
  156. None.
  157. --*/
  158. {
  159. }
  160. WOW64BTAPI
  161. ULONG
  162. BTCpuGetStackPointer(
  163. VOID
  164. )
  165. /*++
  166. Routine Description:
  167. Returns the current 32-bit stack pointer value.
  168. Arguments:
  169. None.
  170. Return Value:
  171. Value of 32-bit stack pointer.
  172. --*/
  173. {
  174. return 0;
  175. }
  176. WOW64BTAPI
  177. VOID
  178. BTCpuSetStackPointer(
  179. ULONG Value
  180. )
  181. /*++
  182. Routine Description:
  183. Modifies the current 32-bit stack pointer value.
  184. Arguments:
  185. Value - new value to use for 32-bit stack pointer.
  186. Return Value:
  187. None.
  188. --*/
  189. {
  190. }
  191. WOW64BTAPI
  192. VOID
  193. BTCpuSetInstructionPointer(
  194. ULONG Value
  195. )
  196. /*++
  197. Routine Description:
  198. Modifies the current 32-bit instruction pointer value.
  199. Arguments:
  200. Value - new value to use for 32-bit instruction pointer.
  201. Return Value:
  202. None.
  203. --*/
  204. {
  205. }
  206. WOW64BTAPI
  207. VOID
  208. BTCpuNotifyDllLoad(
  209. LPWSTR DllName,
  210. PVOID DllBase,
  211. ULONG DllSize
  212. )
  213. /*++
  214. Routine Description:
  215. This routine get notified when application successfully load a dll.
  216. Arguments:
  217. DllName - Name of the Dll the application has loaded.
  218. DllBase - BaseAddress of the dll.
  219. DllSize - size of the Dll.
  220. Return Value:
  221. None.
  222. --*/
  223. {
  224. }
  225. WOW64BTAPI
  226. VOID
  227. BTCpuNotifyDllUnload(
  228. PVOID DllBase
  229. )
  230. /*++
  231. Routine Description:
  232. This routine get notified when application unload a dll.
  233. Arguments:
  234. DllBase - BaseAddress of the dll.
  235. Return Value:
  236. None.
  237. --*/
  238. {
  239. }
  240. WOW64BTAPI
  241. VOID
  242. BTCpuFlushInstructionCache (
  243. PVOID BaseAddress,
  244. ULONG Length
  245. )
  246. /*++
  247. Routine Description:
  248. The CPU needs to flush its cache around the specified address, since
  249. some external code has altered the specified range of addresses.
  250. Arguments:
  251. BaseAddress - start of range to flush
  252. Length - number of bytes to flush
  253. Return Value:
  254. None.
  255. --*/
  256. {
  257. }
  258. WOW64BTAPI
  259. NTSTATUS
  260. BTCpuGetContext(
  261. IN HANDLE ThreadHandle,
  262. IN HANDLE ProcessHandle,
  263. IN PTEB Teb,
  264. OUT PCONTEXT32 Context)
  265. /*++
  266. Routine Description:
  267. Extracts the cpu context of the specified thread.
  268. When entered, it is guaranteed that the target thread is suspended at
  269. a proper CPU state.
  270. Arguments:
  271. ThreadHandle - Target thread handle to retreive the context for
  272. ProcessHandle - Open handle to the process that the thread runs in
  273. Teb - Pointer to the target's thread TEB
  274. Context - Context record to fill
  275. Return Value:
  276. NTSTATUS.
  277. --*/
  278. {
  279. return STATUS_NOT_IMPLEMENTED;
  280. }
  281. WOW64BTAPI
  282. NTSTATUS
  283. BTCpuSetContext(
  284. IN HANDLE ThreadHandle,
  285. IN HANDLE ProcessHandle,
  286. IN PTEB Teb,
  287. PCONTEXT32 Context)
  288. /*++
  289. Routine Description:
  290. Sets the cpu context for the specified thread.
  291. When entered, if the target thread isn't the currently executing thread, the
  292. n it is
  293. guaranteed that the target thread is suspended at a proper CPU state.
  294. Arguments:
  295. ThreadHandle - Target thread handle to retreive the context for
  296. ProcessHandle - Open handle to the process that the thread runs in
  297. Teb - Pointer to the target's thread TEB
  298. Context - Context record to set
  299. Return Value:
  300. NTSTATUS.
  301. --*/
  302. {
  303. return STATUS_NOT_IMPLEMENTED;
  304. }
  305. WOW64BTAPI
  306. NTSTATUS
  307. BTCpuSuspendThread(
  308. IN HANDLE ThreadHandle,
  309. IN HANDLE ProcessHandle,
  310. IN PTEB Teb,
  311. OUT PULONG PreviousSuspendCount OPTIONAL)
  312. /*++
  313. Routine Description:
  314. This routine is entered while the target thread is actually suspended, howev
  315. er, it's
  316. not known if the target thread is in a consistent state relative to
  317. the CPU.
  318. Arguments:
  319. ThreadHandle - Handle of target thread to suspend
  320. ProcessHandle - Handle of target thread's process
  321. Teb - Address of the target thread's TEB
  322. PreviousSuspendCount - Previous suspend count
  323. Return Value:
  324. NTSTATUS.
  325. --*/
  326. {
  327. return STATUS_NOT_IMPLEMENTED;
  328. }