Debian Codegraph @

windows/virt2phys/virt2phys_logic.h

raw symbols SCIP
1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2021 Dmitry Kozlyuk
3 */
4
5 #ifndef VIRT2PHYS_LOGIC_H
6 #define VIRT2PHYS_LOGIC_H
7
8 struct virt2phys_params {
9 /** Maximum number of tracked processes (0 = unlimited). */
10 ULONG process_count_limit;
11 /** Maximum amount of memory locked by a process (0 = unlimited). */
12 ULONG64 process_memory_limit;
13 };
14
15 /**
16 * Initialize internal data structures.
17 */
18 NTSTATUS virt2phys_init(const struct virt2phys_params *params);
19
20 /**
21 * Free memory allocated for internal data structures.
22 * Do not unlock memory so that it's not paged even if driver is unloaded
23 * when an application still uses this memory.
24 */
25 void virt2phys_cleanup(void);
26
27 /**
28 * Unlock all tracked memory blocks of a process.
29 * Free memory allocated for tracking of the process.
30 */
31 void virt2phys_process_cleanup(HANDLE process_id);
32
33 /**
34 * Lock current process memory region containing @p virt
35 * and get physical address corresponding to @p virt.
36 */
37 NTSTATUS virt2phys_translate(PVOID virt, PHYSICAL_ADDRESS *phys);
38
39 #endif /* VIRT2PHYS_LOGIC_H */