PageRenderTime 185ms CodeModel.GetById 33ms RepoModel.GetById 1ms app.codeStats 0ms

/base/Windows/Inc/Vid.h

#
C Header | 964 lines | 764 code | 133 blank | 67 comment | 1 complexity | d55524254fe88e03a71517bfe646b442 MD5 | raw file
  1. /*++
  2. Copyright (c) Microsoft Corporation
  3. Module Name:
  4. Vid.h
  5. Abstract:
  6. Header file for the VID user-mode interface layer, Vid.dll.
  7. Author:
  8. John Gregg (jgregg) 08-Jun-2005
  9. --*/
  10. #pragma once
  11. #if !defined(_VID_DLL_)
  12. #define VIDDLLAPI DECLSPEC_IMPORT
  13. #else
  14. #define VIDDLLAPI
  15. #endif
  16. #include "VidDefs.h"
  17. //
  18. // The following is required in order to make sure the C++ compiler doesn't
  19. // mangle the functions exported from Vid.dll.
  20. //
  21. #ifdef __cplusplus
  22. extern "C"
  23. {
  24. #endif
  25. //
  26. // This is a wrapper for the queue handle
  27. // which contains the user mode VA of the
  28. // client exchange buffer.
  29. //
  30. typedef struct _VID_QUEUE_HANDLE
  31. {
  32. QUEUE_HANDLE FileHandle;
  33. PVOID ExchangeBufferContext;
  34. UINT32 ConcurrencyLevel;
  35. } VID_QUEUE_HANDLE, *PVID_QUEUE_HANDLE;
  36. static const VID_QUEUE_HANDLE INVALID_VID_QUEUE_HANDLE
  37. = { INVALID_HANDLE_VALUE, NULL, 0 };
  38. #define VID_QUEUE_HANDLE_IS_EQUAL(h1, h2) \
  39. (h1.FileHandle == h2.FileHandle)
  40. #ifndef _TEST_VID_
  41. //
  42. // Partition related API.
  43. //
  44. VIDDLLAPI
  45. BOOL
  46. WINAPI
  47. VidGetIdealPartitionNumaMask(
  48. __in UINT64 PartitionPageCount,
  49. __in UINT32 VirtualProcessorCount,
  50. __out UINT64* NumaNodeMask
  51. );
  52. VIDDLLAPI
  53. PT_HANDLE
  54. WINAPI
  55. VidCreatePartition(
  56. __in_ecount(PartitionNameSizeInChars) WCHAR* PartitionName,
  57. __in UINT32 PartitionNameSizeInChars,
  58. __in UINT32 ProcessorCount,
  59. __in UINT64 NumaNodeMask
  60. );
  61. VIDDLLAPI
  62. PT_HANDLE
  63. WINAPI
  64. VidCreatePartitionEx(
  65. __in_ecount(PartitionNameSizeInChars) WCHAR* PartitionName,
  66. __in UINT32 PartitionNameSizeInChars,
  67. __in UINT32 ProcessorCount,
  68. __in UINT64 NumaNodeMask,
  69. __in UINT32 Flags
  70. );
  71. VIDDLLAPI
  72. BOOL
  73. WINAPI
  74. VidDeletePartition(
  75. __in PT_HANDLE Partition
  76. );
  77. //
  78. // Virtual processor related API.
  79. //
  80. VIDDLLAPI
  81. BOOL
  82. WINAPI
  83. VidAddVirtualProcessor(
  84. __in PT_HANDLE Partition,
  85. __out VID_PROCESSOR_INDEX* NewProcessorIndex
  86. );
  87. VIDDLLAPI
  88. BOOL
  89. WINAPI
  90. VidRemoveVirtualProcessor(
  91. __in PT_HANDLE Partition,
  92. __in VID_PROCESSOR_INDEX ProcessorIndex
  93. );
  94. VIDDLLAPI
  95. BOOL
  96. WINAPI
  97. VidStartVirtualProcessor(
  98. __in PT_HANDLE Partition,
  99. __in VID_PROCESSOR_INDEX ProcessorIndex
  100. );
  101. VIDDLLAPI
  102. BOOL
  103. WINAPI
  104. VidStopVirtualProcessor(
  105. __in PT_HANDLE Partition,
  106. __in VID_PROCESSOR_INDEX ProcessorIndex,
  107. __in_opt PVOID UserContext,
  108. __in VID_QUEUE_HANDLE MessageQueue
  109. );
  110. VIDDLLAPI
  111. BOOL
  112. WINAPI
  113. VidGetVirtualProcessorRunningStatus(
  114. __in PT_HANDLE Partition,
  115. __in VID_PROCESSOR_INDEX ProcessorIndex,
  116. __out VID_PROCESSOR_STATUS* ProcessorStatus
  117. );
  118. VIDDLLAPI
  119. BOOL
  120. WINAPI
  121. VidGetVirtualProcessorState(
  122. __in PT_HANDLE Partition,
  123. __in VID_PROCESSOR_INDEX ProcessorIndex,
  124. __in_ecount(ProcessorStateCodeCount)
  125. VID_VP_STATE_CODE* ProcessorStateCodeArray,
  126. __in UINT8 ProcessorStateCodeCount,
  127. __out_ecount(ProcessorStateCodeCount)
  128. VID_VP_STATE_VALUE* ProcessorStateOutputArray
  129. );
  130. VIDDLLAPI
  131. BOOL
  132. WINAPI
  133. VidSetVirtualProcessorState(
  134. __in PT_HANDLE Partition,
  135. __in VID_PROCESSOR_INDEX ProcessorIndex,
  136. __in_ecount(ProcessorStateCodeCount)
  137. VID_VP_STATE_CODE* ProcessorStateCodeArray,
  138. __in UINT8 ProcessorStateCodeCount,
  139. __in_ecount(ProcessorStateCodeCount)
  140. VID_VP_STATE_VALUE* ProcessorStateInputArray
  141. );
  142. VIDDLLAPI
  143. BOOL
  144. WINAPI
  145. VidAssertVirtualProcessorInterrupt(
  146. __in PT_HANDLE Partition,
  147. __in HV_INTERRUPT_CONTROL InterruptControl,
  148. __in UINT64 DestinationAddress,
  149. __in HV_INTERRUPT_VECTOR InterruptVector,
  150. __in UINT32 Flags
  151. );
  152. VIDDLLAPI
  153. BOOL
  154. WINAPI
  155. VidClearVirtualProcessorInterrupt(
  156. __in PT_HANDLE Partition
  157. );
  158. VIDDLLAPI
  159. BOOL
  160. WINAPI
  161. VidRegisterCpuidHandler(
  162. __in PT_HANDLE Partition,
  163. __in VID_PROCESSOR_INDEX ProcessorIndex,
  164. __in VID_QUEUE_HANDLE MessageQueue,
  165. __in UINT32 CpuidFunction,
  166. __in PVOID UserContext,
  167. __out HANDLER_REF * HandlerRef
  168. );
  169. VIDDLLAPI
  170. BOOL
  171. WINAPI
  172. VidRegisterLegacyFpErrorHandler(
  173. __in PT_HANDLE Partition,
  174. __in VID_QUEUE_HANDLE MessageQueue,
  175. __in UINT32 Flags,
  176. __in PVOID UserContext,
  177. __out HANDLER_REF* HandlerRef
  178. );
  179. //
  180. // Client notifications related API.
  181. //
  182. VIDDLLAPI
  183. VID_QUEUE_HANDLE
  184. WINAPI
  185. VidCreateMessageQueueEx(
  186. __in PT_HANDLE PartitionHandle,
  187. __in_ecount(QueueNameSizeInChars)
  188. WCHAR* QueueName,
  189. __in UINT32 QueueNameSizeInChars,
  190. __in UINT32 Flags,
  191. __in UINT32 ConcurrencyLevel,
  192. __in VID_QUEUE_HANDLE QueueGroup
  193. );
  194. VIDDLLAPI
  195. VID_QUEUE_HANDLE
  196. WINAPI
  197. VidCreateMessageQueue(
  198. __in PT_HANDLE PartitionHandle,
  199. __in_ecount(QueueNameSizeInChars)
  200. WCHAR* QueueName,
  201. __in UINT32 QueueNameSizeInChars,
  202. __in UINT32 Flags
  203. );
  204. VIDDLLAPI
  205. BOOL
  206. WINAPI
  207. VidDeleteMessageQueue(
  208. __in VID_QUEUE_HANDLE MessageQueue
  209. );
  210. VIDDLLAPI
  211. BOOL
  212. WINAPI
  213. VidRegisterIoPortHandler(
  214. __in PT_HANDLE Partition,
  215. __in VID_QUEUE_HANDLE MessageQueue,
  216. __in VID_IO_PORT_ADDRESS PortRangeBegin,
  217. __in VID_IO_PORT_ADDRESS PortRangeEnd,
  218. __in UINT32 Flags,
  219. __in PVOID UserContext,
  220. __out HANDLER_REF* HandlerRef
  221. );
  222. VIDDLLAPI
  223. BOOL
  224. WINAPI
  225. VidRegisterMsrHandler(
  226. __in PT_HANDLE Partition,
  227. __in VID_QUEUE_HANDLE MessageQueue,
  228. __in VID_MSR_ADDRESS MsrRangeBegin,
  229. __in VID_MSR_ADDRESS MsrRangeEnd,
  230. __in UINT32 Flags,
  231. __in PVOID UserContext,
  232. __out HANDLER_REF* HandlerRef
  233. );
  234. VIDDLLAPI
  235. BOOL
  236. WINAPI
  237. VidRegisterExceptionHandler(
  238. __in PT_HANDLE Partition,
  239. __in VID_QUEUE_HANDLE MessageQueue,
  240. __in UINT8 ExceptionVector,
  241. __in UINT32 Flags,
  242. __in PVOID UserContext,
  243. __out HANDLER_REF* HandlerRef
  244. );
  245. VIDDLLAPI
  246. BOOL
  247. WINAPI
  248. VidRegisterTripleFaultHandler(
  249. __in PT_HANDLE Partition,
  250. __in VID_QUEUE_HANDLE MessageQueue,
  251. __in UINT32 Flags,
  252. __in PVOID UserContext,
  253. __out HANDLER_REF* HandlerRef
  254. );
  255. VIDDLLAPI
  256. BOOL
  257. WINAPI
  258. VidRegisterApicEoiHandler(
  259. __in PT_HANDLE Partition,
  260. __in VID_QUEUE_HANDLE MessageQueue,
  261. __in UINT32 Flags,
  262. __in PVOID UserContext,
  263. __out HANDLER_REF* HandlerRef
  264. );
  265. VIDDLLAPI
  266. BOOL
  267. WINAPI
  268. VidUnregisterHandler(
  269. __in PT_HANDLE Partition,
  270. __in HANDLER_REF HandlerRef
  271. );
  272. VIDDLLAPI
  273. BOOL
  274. WINAPI
  275. VidHandleMessageAndGetNextMessage(
  276. __in VID_QUEUE_HANDLE MessageQueue,
  277. __in UINT32 Flags,
  278. __in PVID_MSG_RETURN_DATA MessageReturnData,
  279. __out PVID_MSG_DATA MessageData,
  280. __in_opt LPOVERLAPPED Overlapped
  281. );
  282. VIDDLLAPI
  283. BOOL
  284. WINAPI
  285. VidHandleMessageAndGetNextMessageEx(
  286. __in VID_QUEUE_HANDLE MessageQueue,
  287. __in UINT32 Flags,
  288. __inout VID_MSG_RETURN_DATA** MessageReturnData,
  289. __out_opt VID_MSG_DATA** MessageData,
  290. __in UINT32 Timeout
  291. );
  292. //
  293. // Save and Restore API.
  294. //
  295. VIDDLLAPI
  296. BOOL
  297. WINAPI
  298. VidSavePartitionState(
  299. __in PT_HANDLE Partition,
  300. __in UINT32 Flags,
  301. __out_bcount(*SavedStateBlobSize)
  302. PVID_SAVED_STATE_DESCRIPTOR SavedStateBlob,
  303. __inout UINT32* SavedStateBlobSize
  304. );
  305. VIDDLLAPI
  306. BOOL
  307. WINAPI
  308. VidRestorePartitionState(
  309. __in PT_HANDLE Partition,
  310. __in UINT32 Flags,
  311. __in_bcount(SavedStateBlobSize)
  312. PVID_SAVED_STATE_DESCRIPTOR SavedStateBlob,
  313. __in UINT32 SavedStateBlobSize
  314. );
  315. //
  316. // Scheduling APIs
  317. //
  318. VIDDLLAPI
  319. BOOL
  320. WINAPI
  321. VidSetCpuReserve(
  322. __in PT_HANDLE Partition,
  323. __in UINT32 CpuReserve
  324. );
  325. VIDDLLAPI
  326. BOOL
  327. WINAPI
  328. VidSetCpuCap(
  329. __in PT_HANDLE Partition,
  330. __in UINT32 CpuCap
  331. );
  332. VIDDLLAPI
  333. BOOL
  334. WINAPI
  335. VidSetRelativeWeight(
  336. __in PT_HANDLE Partition,
  337. __in UINT32 Weight
  338. );
  339. VIDDLLAPI
  340. BOOL
  341. WINAPI
  342. VidSetSchedulingControl(
  343. __in PT_HANDLE Partition,
  344. __in HV_SCHEDULING_CONTROL Flags
  345. );
  346. //
  347. // Partition Property APIs
  348. //
  349. VIDDLLAPI
  350. BOOL
  351. WINAPI
  352. VidSetPartitionProperty(
  353. __in PT_HANDLE Partition,
  354. __in UINT64 PropertyCode,
  355. __in UINT64 PropertyValue
  356. );
  357. //
  358. // Timer APIs
  359. //
  360. VIDDLLAPI
  361. BOOL
  362. WINAPI
  363. VidCreateTimer(
  364. __in PT_HANDLE Partition,
  365. __in VID_QUEUE_HANDLE QueueHandle,
  366. __in PVOID UserContext,
  367. __out TIMER_REF * TimerRef
  368. );
  369. VIDDLLAPI
  370. BOOL
  371. WINAPI
  372. VidGetCurrentReferenceTime(
  373. __in PT_HANDLE Partition,
  374. __out HV_NANO100_TIME * CurrentTime
  375. );
  376. VIDDLLAPI
  377. BOOL
  378. WINAPI
  379. VidSetAbsoluteTimer(
  380. __in PT_HANDLE Partition,
  381. __in TIMER_REF TimerRef,
  382. __in HV_NANO100_TIME SignalTime
  383. );
  384. VIDDLLAPI
  385. BOOL
  386. WINAPI
  387. VidCancelTimer(
  388. __in PT_HANDLE Partition,
  389. __in TIMER_REF TimerRef
  390. );
  391. VIDDLLAPI
  392. BOOL
  393. WINAPI
  394. VidDeleteTimer(
  395. __in PT_HANDLE Partition,
  396. __in TIMER_REF TimerRef
  397. );
  398. //
  399. // Debugging related API.
  400. //
  401. VIDDLLAPI
  402. BOOL
  403. WINAPI
  404. VidSingleStepVirtualProcessor(
  405. __in PT_HANDLE Partition,
  406. __in VID_PROCESSOR_INDEX ProcessorIndex,
  407. __in VID_QUEUE_HANDLE MessageQueue
  408. );
  409. VIDDLLAPI
  410. BOOL
  411. WINAPI
  412. VidRegisterSoftwareBreakpoint(
  413. __in PT_HANDLE Partition,
  414. __in VID_PROCESSOR_INDEX ProcessorIndex,
  415. __in UINT64 BreakpointAddress,
  416. __in UINT32 Flags,
  417. __in PVOID UserContext,
  418. __in VID_QUEUE_HANDLE MessageQueue
  419. );
  420. VIDDLLAPI
  421. BOOL
  422. WINAPI
  423. VidUnregisterSoftwareBreakpoint(
  424. __in PT_HANDLE Partition,
  425. __in VID_PROCESSOR_INDEX ProcessorIndex,
  426. __in UINT64 BreakpointAddress
  427. );
  428. VIDDLLAPI
  429. BOOL
  430. WINAPI
  431. VidGetHvPartitionId(
  432. __in PT_HANDLE Partition,
  433. __out PHV_PARTITION_ID PartitionId
  434. );
  435. //
  436. // Performance statistics-related API.
  437. //
  438. // FUTURE-jgregg-1/24/2006: Some of these
  439. // currently call the HV directly; they should
  440. // be updated to tie into the perflib providers.
  441. //
  442. VIDDLLAPI
  443. HANDLE
  444. WINAPI
  445. VidOpenStatisticsHandle();
  446. VIDDLLAPI
  447. BOOL
  448. WINAPI
  449. VidCloseStatisticsHandle(
  450. __in HANDLE StatsHandle
  451. );
  452. VIDDLLAPI
  453. BOOL
  454. WINAPI
  455. VidGetVidStatistics(
  456. __in HANDLE StatsHandle,
  457. __inout PUINT32 BufferSize,
  458. __out_bcount(*BufferSize) PUINT64 StatsBuffer
  459. );
  460. VIDDLLAPI
  461. BOOL
  462. WINAPI
  463. VidGetPartitionStatistics(
  464. __in PT_HANDLE PartitionHandle,
  465. __inout PUINT32 BufferSize,
  466. __out_bcount(*BufferSize) PUINT64 StatsBuffer
  467. );
  468. VIDDLLAPI
  469. BOOL
  470. WINAPI
  471. VidGetQueueStatistics(
  472. __in VID_QUEUE_HANDLE QueueHandle,
  473. __inout PUINT32 BufferSize,
  474. __out_bcount(*BufferSize) PUINT64 StatsBuffer
  475. );
  476. VIDDLLAPI
  477. BOOL
  478. WINAPI
  479. VidGetNumaNodeStatistics(
  480. __in HANDLE StatsHandle,
  481. __in UINT32 NodeIndex,
  482. __inout PUINT32 BufferSize,
  483. __out_bcount(*BufferSize) PUINT64 StatsBuffer
  484. );
  485. VIDDLLAPI
  486. BOOL
  487. WINAPI
  488. VidTestGetNumaNodeStat(
  489. __in HANDLE StatsHandle,
  490. __in UINT32 NodeIndex,
  491. __in VID_NUMA_NODE_STAT_PROPERTY Property,
  492. __out PUINT64 Value
  493. );
  494. VIDDLLAPI
  495. BOOL
  496. WINAPI
  497. VidGetPartitionIds(
  498. __in HANDLE StatsHandle,
  499. __out PHV_PARTITION_ID ParentPartitionId,
  500. __inout UINT32* Count,
  501. __out PHV_PARTITION_ID ChildPartitionIds,
  502. __inout UINT32* NameBufferSize,
  503. __out WCHAR* NameBuffer
  504. );
  505. VIDDLLAPI
  506. BOOL
  507. WINAPI
  508. VidGetHvVpRuntime(
  509. __in HANDLE StatsHandle,
  510. __in HV_PARTITION_ID PartitionId,
  511. __in VID_PROCESSOR_INDEX VpIndex,
  512. __out UINT64 * HvRunTime
  513. );
  514. VIDDLLAPI
  515. BOOL
  516. WINAPI
  517. VidGetHvRuntimeForAllLps(
  518. __in HANDLE StatsHandle,
  519. __out UINT32* LpCount,
  520. __out UINT64* LpMask,
  521. __out UINT64* LpRuntimes,
  522. __in UINT32 LpRuntimesSizeInBytes
  523. );
  524. VIDDLLAPI
  525. BOOL
  526. WINAPI
  527. VidGetHvRuntimeForAllVps(
  528. __in HANDLE StatsHandle,
  529. __in HV_PARTITION_ID PartitionId,
  530. __out UINT32* VpCount,
  531. __out UINT64* VpRuntimes,
  532. __in UINT32 VpRuntimesSizeInBytes
  533. );
  534. VIDDLLAPI
  535. BOOL
  536. WINAPI
  537. VidGetHvLogicalProcessorRuntime(
  538. __in HANDLE StatsHandle,
  539. __in UINT32 LogicalProcessorIndex,
  540. __out UINT64* HvRuntime,
  541. __out UINT64* HvHypervisorTime,
  542. __out UINT64* HvGroupRuntime,
  543. __out UINT64* HvGlobalTime
  544. );
  545. VIDDLLAPI
  546. BOOL
  547. WINAPI
  548. VidGetHvMemoryBalance(
  549. __in PT_HANDLE PartitionHandle,
  550. __out UINT64 * PagesAvailable,
  551. __out UINT64 * PagesInUse
  552. );
  553. VIDDLLAPI
  554. BOOL
  555. WINAPI
  556. VidMapHvGlobalStatsPage(
  557. __in HANDLE StatsHandle,
  558. __in BOOLEAN UseIndex,
  559. __in UINT32 Index,
  560. __in UINT32 ReservedIndex,
  561. __out PVOID * UserMapping
  562. );
  563. VIDDLLAPI
  564. BOOL
  565. WINAPI
  566. VidUnmapHvGlobalStatsPage(
  567. __in HANDLE StatsHandle,
  568. __in BOOLEAN UseIndex,
  569. __in UINT32 Index,
  570. __in UINT32 ReservedIndex
  571. );
  572. VIDDLLAPI
  573. BOOL
  574. WINAPI
  575. VidMapHvRootStatsPage(
  576. __in HANDLE StatsHandle,
  577. __in BOOLEAN UseIndex,
  578. __in UINT32 Index,
  579. __in UINT32 ReservedIndex,
  580. __out PVOID * UserMapping
  581. );
  582. VIDDLLAPI
  583. BOOL
  584. WINAPI
  585. VidUnmapHvRootStatsPage(
  586. __in HANDLE StatsHandle,
  587. __in BOOLEAN UseIndex,
  588. __in UINT32 Index,
  589. __in UINT32 ReservedIndex
  590. );
  591. VIDDLLAPI
  592. BOOL
  593. WINAPI
  594. VidMapHvLocalStatsPage(
  595. __in PT_HANDLE PartitionHandle,
  596. __in BOOLEAN UseIndex,
  597. __in UINT32 Index,
  598. __in UINT32 ReservedIndex,
  599. __out PVOID * UserMapping
  600. );
  601. VIDDLLAPI
  602. BOOL
  603. WINAPI
  604. VidUnmapHvLocalStatsPage(
  605. __in PT_HANDLE PartitionHandle,
  606. __in BOOLEAN UseIndex,
  607. __in UINT32 Index,
  608. __in UINT32 ReservedIndex
  609. );
  610. //
  611. // Partition HV Memory pool policy API.
  612. //
  613. VIDDLLAPI
  614. BOOL
  615. WINAPI
  616. VidSetHvMemoryPolicy(
  617. __in PT_HANDLE PartitionHandle,
  618. __in UINT32 Flags,
  619. __in QUEUE_HANDLE QueueHandle,
  620. __in PVOID UserContext,
  621. __in UINT64 DepositBlockSizeKb,
  622. __in UINT64 NotificationThresholdKb,
  623. __in UINT64 SptPoolSize
  624. );
  625. //
  626. // Partition memory management related API.
  627. //
  628. VIDDLLAPI
  629. BOOL
  630. WINAPI
  631. VidCreateMemoryBlock(
  632. __in PT_HANDLE Partition,
  633. __in UINT64 PageCount,
  634. __in UINT64 MinWorkingSetSize,
  635. __in_ecount(PagingFileNameSizeInChars)
  636. WCHAR* PagingFileName,
  637. __in UINT32 PagingFileNameSizeInChars,
  638. __in PSID PagingFileAccessSid,
  639. __in VID_PHYSICAL_NODE_INDEX NumaNodeIndex,
  640. __in UINT64 Flags,
  641. __out MB_HANDLE* NewMemoryBlock
  642. );
  643. VIDDLLAPI
  644. BOOL
  645. WINAPI
  646. VidDestroyMemoryBlock(
  647. __in PT_HANDLE Partition,
  648. __in MB_HANDLE MemoryBlock
  649. );
  650. VIDDLLAPI
  651. BOOL
  652. WINAPI
  653. VidSetMemoryBlockMinWorkingSet(
  654. __in PT_HANDLE Partition,
  655. __in MB_HANDLE MemoryBlock,
  656. __in UINT64 MinWorkingSetSize,
  657. __in_ecount(PagingFileNameSizeInChars)
  658. WCHAR* PagingFileName,
  659. __in UINT32 PagingFileNameSizeInChars,
  660. __in PSID PagingFileAccessSid
  661. );
  662. VIDDLLAPI
  663. BOOL
  664. WINAPI
  665. VidSetMemoryBlockProperty(
  666. __in PT_HANDLE Partition,
  667. __in MB_HANDLE MemoryBlock,
  668. __in UINT64 Property,
  669. __in BOOL SetProperty
  670. );
  671. VIDDLLAPI
  672. BOOL
  673. WINAPI
  674. VidScanMemoryBlockForSharedPages(
  675. __in PT_HANDLE Partition,
  676. __in MB_HANDLE MemoryBlock
  677. );
  678. VIDDLLAPI
  679. BOOL
  680. WINAPI
  681. VidProtectMemoryBlockPages(
  682. __in PT_HANDLE Partition,
  683. __in MB_HANDLE MemoryBlock
  684. );
  685. VIDDLLAPI
  686. BOOL
  687. WINAPI
  688. VidUnprotectMemoryBlockPages(
  689. __in PT_HANDLE Partition,
  690. __in MB_HANDLE MemoryBlock
  691. );
  692. VIDDLLAPI
  693. BOOL
  694. WINAPI
  695. VidCreateMemoryBlockGpaRange(
  696. __in PT_HANDLE Partition,
  697. __in MB_HANDLE MemoryBlock,
  698. __in GUEST_PHYSICAL_PAGE_INDEX StartPage,
  699. __in UINT64 RangePageCount,
  700. __in MB_PAGE_INDEX StartMbp,
  701. __in UINT64 Flags,
  702. __out RG_HANDLE* NewGpaRange
  703. );
  704. VIDDLLAPI
  705. BOOL
  706. WINAPI
  707. VidCreateMmioGpaRange(
  708. __in PT_HANDLE Partition,
  709. __in GUEST_PHYSICAL_PAGE_INDEX StartPage,
  710. __in UINT64 RangePageCount,
  711. __in VID_QUEUE_HANDLE MessageQueue,
  712. __in PVOID ClientContext,
  713. __out RG_HANDLE* NewGpaRange
  714. );
  715. VIDDLLAPI
  716. BOOL
  717. WINAPI
  718. VidDestroyGpaRange(
  719. __in PT_HANDLE Partition,
  720. __in RG_HANDLE GpaRange
  721. );
  722. VIDDLLAPI
  723. BOOL
  724. WINAPI
  725. VidSetMemoryBlockNotificationQueue(
  726. __in PT_HANDLE Partition,
  727. __in MB_HANDLE MemoryBlock,
  728. __in VID_QUEUE_HANDLE MessageQueue,
  729. __in PVOID ClientContext
  730. );
  731. VIDDLLAPI
  732. BOOL
  733. WINAPI
  734. VidSetMemoryBlockClientNotifications(
  735. __in PT_HANDLE Partition,
  736. __in MB_HANDLE MemoryBlock,
  737. __in MB_PAGE_INDEX StartMbp,
  738. __in UINT64 MbpCount,
  739. __in UINT32 NotificationMask
  740. );
  741. VIDDLLAPI
  742. BOOL
  743. WINAPI
  744. VidMapMemoryBlockPageRange(
  745. __in PT_HANDLE Partition,
  746. __in MB_HANDLE MemoryBlock,
  747. __in MB_PAGE_INDEX StartMbp,
  748. __in UINT64 MbpCount,
  749. __in VID_ACCESS_TYPE DesiredAccess,
  750. __inout VOID** UserMappingAddress
  751. );
  752. VIDDLLAPI
  753. BOOL
  754. WINAPI
  755. VidUnmapMemoryBlockPageRangeBulk(
  756. __in PT_HANDLE Partition,
  757. __in_ecount(UserMappingAddressCount) PVOID* UserMappingAddressList,
  758. __in UINT32 UserMappingAddressCount
  759. );
  760. VIDDLLAPI
  761. BOOL
  762. WINAPI
  763. VidReadMemoryBlockPageRange(
  764. __in PT_HANDLE Partition,
  765. __in MB_HANDLE MemoryBlock,
  766. __in MB_PAGE_INDEX StartMbp,
  767. __in UINT64 MbpCount,
  768. __out_bcount(BufferSize)
  769. PVOID ClientBuffer,
  770. __in UINT64 BufferSize
  771. );
  772. VIDDLLAPI
  773. BOOL
  774. WINAPI
  775. VidWriteMemoryBlockPageRange(
  776. __in PT_HANDLE Partition,
  777. __in MB_HANDLE MemoryBlock,
  778. __in MB_PAGE_INDEX StartMbp,
  779. __in UINT64 MbpCount,
  780. __in_bcount(BufferSize)
  781. PVOID ClientBuffer,
  782. __in UINT64 BufferSize
  783. );
  784. VIDDLLAPI
  785. BOOL
  786. WINAPI
  787. VidTranslateGvaToGpa(
  788. __in PT_HANDLE Partition,
  789. __in HV_VP_INDEX VpIndex,
  790. __in HV_TRANSLATE_GVA_CONTROL_FLAGS ControlFlags,
  791. __in HV_GVA_PAGE_NUMBER GvaPage,
  792. __out PHV_TRANSLATE_GVA_RESULT TranslationResult,
  793. __out PHV_GPA_PAGE_NUMBER GpaPage,
  794. __out PVOID* MmioContext,
  795. __out PVOID* MemoryBlockContext,
  796. __out UINT64* MemoryBlockPageIndex,
  797. __out UINT64* MemoryBlockGpaRangeFlags
  798. );
  799. //
  800. // These interfaces are used as hooks for testing.
  801. // They should not be in the retail product.
  802. //
  803. #ifdef DBG
  804. VIDDLLAPI
  805. BOOL
  806. WINAPI
  807. VidDebugHandleIntercept(
  808. __in PT_HANDLE Partition,
  809. __in_bcount(MessageSize) PVOID HvInterceptMessage,
  810. __in UINT32 MessageSize,
  811. __out PVID_MSG_DATA OutgoingMessageData
  812. );
  813. VIDDLLAPI
  814. BOOL
  815. WINAPI
  816. VidDebugFlushQueue(
  817. __in VID_QUEUE_HANDLE Queue
  818. );
  819. #endif // DBG
  820. #endif // _TEST_VID_
  821. #ifdef __cplusplus
  822. }
  823. #endif