1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2020 Dmitry Kozlyuk
6 * @file virt2phys driver interface
10 * Driver device interface GUID {539c2135-793a-4926-afec-d3a1b61bbc8a}.
12 DEFINE_GUID(GUID_DEVINTERFACE_VIRT2PHYS,
13 0x539c2135, 0x793a, 0x4926,
14 0xaf, 0xec, 0xd3, 0xa1, 0xb6, 0x1b, 0xbc, 0x8a);
17 * Driver device type for IO control codes.
19 #define VIRT2PHYS_DEVTYPE 0x8000
22 * Translate a valid non-paged virtual address to a physical address.
24 * Note: A physical address zero (0) is reported if input address
25 * is paged out or not mapped. However, if input is a valid mapping
26 * of I/O port 0x0000, output is also zero. There is no way
27 * to distinguish between these cases by return value only.
29 * Input: a non-paged virtual address (PVOID).
31 * Output: the corresponding physical address (LARGE_INTEGER).
33 #define IOCTL_VIRT2PHYS_TRANSLATE CTL_CODE( \
34 VIRT2PHYS_DEVTYPE, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS)