[55401] | 1 | /* $Id: SUPDrvIOC.h 104327 2024-04-12 20:02:21Z vboxsync $ */
|
---|
[1] | 2 | /** @file
|
---|
[3537] | 3 | * VirtualBox Support Driver - IOCtl definitions.
|
---|
[1] | 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[98103] | 7 | * Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
[1] | 8 | *
|
---|
[96407] | 9 | * This file is part of VirtualBox base platform packages, as
|
---|
| 10 | * available from https://www.virtualbox.org.
|
---|
[5999] | 11 | *
|
---|
[96407] | 12 | * This program is free software; you can redistribute it and/or
|
---|
| 13 | * modify it under the terms of the GNU General Public License
|
---|
| 14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
| 15 | * License.
|
---|
| 16 | *
|
---|
| 17 | * This program is distributed in the hope that it will be useful, but
|
---|
| 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 20 | * General Public License for more details.
|
---|
| 21 | *
|
---|
| 22 | * You should have received a copy of the GNU General Public License
|
---|
| 23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
| 24 | *
|
---|
[5999] | 25 | * The contents of this file may alternatively be used under the terms
|
---|
| 26 | * of the Common Development and Distribution License Version 1.0
|
---|
[96407] | 27 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
| 28 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
[5999] | 29 | * CDDL are applicable instead of those of the GPL.
|
---|
| 30 | *
|
---|
| 31 | * You may elect to license modified versions of this file under the
|
---|
| 32 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
[96407] | 33 | *
|
---|
| 34 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
[1] | 35 | */
|
---|
| 36 |
|
---|
[76568] | 37 | #ifndef VBOX_INCLUDED_SRC_Support_SUPDrvIOC_h
|
---|
| 38 | #define VBOX_INCLUDED_SRC_Support_SUPDrvIOC_h
|
---|
[76527] | 39 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 40 | # pragma once
|
---|
| 41 | #endif
|
---|
[1] | 42 |
|
---|
[21701] | 43 | #include <iprt/types.h>
|
---|
[41117] | 44 | #include <VBox/sup.h>
|
---|
[1] | 45 |
|
---|
| 46 | /*
|
---|
| 47 | * IOCtl numbers.
|
---|
| 48 | * We're using the Win32 type of numbers here, thus the macros below.
|
---|
| 49 | * The SUP_IOCTL_FLAG macro is used to separate requests from 32-bit
|
---|
| 50 | * and 64-bit processes.
|
---|
| 51 | */
|
---|
[87233] | 52 | #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_SPARC64) || defined(RT_ARCH_ARM64)
|
---|
[1] | 53 | # define SUP_IOCTL_FLAG 128
|
---|
[87233] | 54 | #elif defined(RT_ARCH_X86) || defined(RT_ARCH_SPARC) || defined(RT_ARCH_ARM32)
|
---|
[1] | 55 | # define SUP_IOCTL_FLAG 0
|
---|
| 56 | #else
|
---|
| 57 | # error "dunno which arch this is!"
|
---|
| 58 | #endif
|
---|
| 59 |
|
---|
[3672] | 60 | #ifdef RT_OS_WINDOWS
|
---|
[1] | 61 | # ifndef CTL_CODE
|
---|
[62664] | 62 | # include <iprt/win/windows.h>
|
---|
[1] | 63 | # endif
|
---|
[4800] | 64 | /* Automatic buffering, size not encoded. */
|
---|
| 65 | # define SUP_CTL_CODE_SIZE(Function, Size) CTL_CODE(FILE_DEVICE_UNKNOWN, (Function) | SUP_IOCTL_FLAG, METHOD_BUFFERED, FILE_WRITE_ACCESS)
|
---|
| 66 | # define SUP_CTL_CODE_BIG(Function) CTL_CODE(FILE_DEVICE_UNKNOWN, (Function) | SUP_IOCTL_FLAG, METHOD_BUFFERED, FILE_WRITE_ACCESS)
|
---|
| 67 | # define SUP_CTL_CODE_FAST(Function) CTL_CODE(FILE_DEVICE_UNKNOWN, (Function) | SUP_IOCTL_FLAG, METHOD_NEITHER, FILE_WRITE_ACCESS)
|
---|
| 68 | # define SUP_CTL_CODE_NO_SIZE(uIOCtl) (uIOCtl)
|
---|
[1] | 69 |
|
---|
[51907] | 70 | # define SUP_NT_STATUS_BASE UINT32_C(0xe9860000) /**< STATUS_SEVERITY_ERROR + C-bit + facility 0x986. */
|
---|
| 71 | # define SUP_NT_STATUS_IS_VBOX(a_rcNt) ( ((uint32_t)(a_rcNt) & 0xffff0000) == SUP_NT_STATUS_BASE )
|
---|
| 72 | # define SUP_NT_STATUS_TO_VBOX(a_rcNt) ( (int)((uint32_t)(a_rcNt) | UINT32_C(0xffff0000)) )
|
---|
| 73 |
|
---|
[53002] | 74 | /** NT device name for system access. */
|
---|
| 75 | # define SUPDRV_NT_DEVICE_NAME_SYS L"\\Device\\VBoxDrv"
|
---|
| 76 | /** NT device name for user access. */
|
---|
| 77 | # define SUPDRV_NT_DEVICE_NAME_USR L"\\Device\\VBoxDrvU"
|
---|
| 78 | # ifdef VBOX_WITH_HARDENING
|
---|
| 79 | /** NT device name for hardened stub access. */
|
---|
| 80 | # define SUPDRV_NT_DEVICE_NAME_STUB L"\\Device\\VBoxDrvStub"
|
---|
| 81 | /** NT device name for getting error information for failed VBoxDrv or
|
---|
| 82 | * VBoxDrvStub open. */
|
---|
| 83 | # define SUPDRV_NT_DEVICE_NAME_ERROR_INFO L"\\Device\\VBoxDrvErrorInfo"
|
---|
| 84 | # endif
|
---|
| 85 |
|
---|
| 86 |
|
---|
[4800] | 87 | #elif defined(RT_OS_SOLARIS)
|
---|
| 88 | /* No automatic buffering, size limited to 255 bytes. */
|
---|
| 89 | # include <sys/ioccom.h>
|
---|
| 90 | # define SUP_CTL_CODE_SIZE(Function, Size) _IOWRN('V', (Function) | SUP_IOCTL_FLAG, sizeof(SUPREQHDR))
|
---|
[4824] | 91 | # define SUP_CTL_CODE_BIG(Function) _IOWRN('V', (Function) | SUP_IOCTL_FLAG, sizeof(SUPREQHDR))
|
---|
[4800] | 92 | # define SUP_CTL_CODE_FAST(Function) _IO( 'V', (Function) | SUP_IOCTL_FLAG)
|
---|
[88215] | 93 | # define SUP_CTL_CODE_NO_SIZE(uIOCtl) ((uintptr_t)(uIOCtl))
|
---|
[4800] | 94 |
|
---|
[3672] | 95 | #elif defined(RT_OS_OS2)
|
---|
[4800] | 96 | /* No automatic buffering, size not encoded. */
|
---|
| 97 | # define SUP_CTL_CATEGORY 0xc0
|
---|
| 98 | # define SUP_CTL_CODE_SIZE(Function, Size) ((unsigned char)(Function))
|
---|
| 99 | # define SUP_CTL_CODE_BIG(Function) ((unsigned char)(Function))
|
---|
| 100 | # define SUP_CTL_CATEGORY_FAST 0xc1
|
---|
| 101 | # define SUP_CTL_CODE_FAST(Function) ((unsigned char)(Function))
|
---|
| 102 | # define SUP_CTL_CODE_NO_SIZE(uIOCtl) (uIOCtl)
|
---|
[1] | 103 |
|
---|
[3672] | 104 | #elif defined(RT_OS_LINUX)
|
---|
[4800] | 105 | /* No automatic buffering, size limited to 16KB. */
|
---|
| 106 | # include <linux/ioctl.h>
|
---|
| 107 | # define SUP_CTL_CODE_SIZE(Function, Size) _IOC(_IOC_READ | _IOC_WRITE, 'V', (Function) | SUP_IOCTL_FLAG, (Size))
|
---|
| 108 | # define SUP_CTL_CODE_BIG(Function) _IO('V', (Function) | SUP_IOCTL_FLAG)
|
---|
| 109 | # define SUP_CTL_CODE_FAST(Function) _IO('V', (Function) | SUP_IOCTL_FLAG)
|
---|
| 110 | # define SUP_CTL_CODE_NO_SIZE(uIOCtl) ((uIOCtl) & ~IOCSIZE_MASK)
|
---|
[1] | 111 |
|
---|
[3672] | 112 | #elif defined(RT_OS_L4)
|
---|
[4800] | 113 | /* Implemented in suplib, no worries. */
|
---|
| 114 | # define SUP_CTL_CODE_SIZE(Function, Size) (Function)
|
---|
| 115 | # define SUP_CTL_CODE_BIG(Function) (Function)
|
---|
| 116 | # define SUP_CTL_CODE_FAST(Function) (Function)
|
---|
| 117 | # define SUP_CTL_CODE_NO_SIZE(uIOCtl) (uIOCtl)
|
---|
[3512] | 118 |
|
---|
[4800] | 119 | #else /* BSD Like */
|
---|
| 120 | /* Automatic buffering, size limited to 4KB on *BSD and 8KB on Darwin - commands the limit, 4KB. */
|
---|
[1] | 121 | # include <sys/ioccom.h>
|
---|
[4800] | 122 | # define SUP_CTL_CODE_SIZE(Function, Size) _IOC(IOC_INOUT, 'V', (Function) | SUP_IOCTL_FLAG, (Size))
|
---|
| 123 | # define SUP_CTL_CODE_BIG(Function) _IO('V', (Function) | SUP_IOCTL_FLAG)
|
---|
| 124 | # define SUP_CTL_CODE_FAST(Function) _IO('V', (Function) | SUP_IOCTL_FLAG)
|
---|
| 125 | # define SUP_CTL_CODE_NO_SIZE(uIOCtl) ( (uIOCtl) & ~_IOC(0,0,0,IOCPARM_MASK) )
|
---|
[1] | 126 | #endif
|
---|
| 127 |
|
---|
[71198] | 128 | /** @name Fast path I/O control codes.
|
---|
| 129 | * @note These must run parallel to SUP_VMMR0_DO_XXX
|
---|
| 130 | * @note Implementations ASSUMES up to 32 I/O controls codes in the fast range.
|
---|
| 131 | * @{ */
|
---|
[43394] | 132 | /** Fast path IOCtl: VMMR0_DO_HM_RUN */
|
---|
[81071] | 133 | #define SUP_IOCTL_FAST_DO_HM_RUN SUP_CTL_CODE_FAST(64)
|
---|
| 134 | /** Fast path IOCtl: VMMR0_DO_NEM_RUN */
|
---|
| 135 | #define SUP_IOCTL_FAST_DO_NEM_RUN SUP_CTL_CODE_FAST(65)
|
---|
[397] | 136 | /** Just a NOP call for profiling the latency of a fast ioctl call to VMMR0. */
|
---|
[4800] | 137 | #define SUP_IOCTL_FAST_DO_NOP SUP_CTL_CODE_FAST(66)
|
---|
[71198] | 138 | /** First fast path IOCtl number. */
|
---|
[81071] | 139 | #define SUP_IOCTL_FAST_DO_FIRST SUP_IOCTL_FAST_DO_HM_RUN
|
---|
[71198] | 140 | /** @} */
|
---|
[1] | 141 |
|
---|
[71198] | 142 |
|
---|
[51488] | 143 | #ifdef RT_OS_DARWIN
|
---|
| 144 | /** Cookie used to fend off some unwanted clients to the IOService. */
|
---|
| 145 | # define SUP_DARWIN_IOSERVICE_COOKIE 0x64726962 /* 'bird' */
|
---|
| 146 | #endif
|
---|
[1] | 147 |
|
---|
[4800] | 148 |
|
---|
[1] | 149 | /*******************************************************************************
|
---|
| 150 | * Structures and Typedefs *
|
---|
| 151 | *******************************************************************************/
|
---|
[3672] | 152 | #ifdef RT_ARCH_AMD64
|
---|
[1] | 153 | # pragma pack(8) /* paranoia. */
|
---|
[87233] | 154 | #elif defined(RT_ARCH_X86)
|
---|
[1] | 155 | # pragma pack(4) /* paranoia. */
|
---|
| 156 | #endif
|
---|
| 157 |
|
---|
[4800] | 158 |
|
---|
[1] | 159 | /**
|
---|
[4800] | 160 | * Common In/Out header.
|
---|
[1] | 161 | */
|
---|
[4800] | 162 | typedef struct SUPREQHDR
|
---|
[1] | 163 | {
|
---|
[4800] | 164 | /** Cookie. */
|
---|
| 165 | uint32_t u32Cookie;
|
---|
| 166 | /** Session cookie. */
|
---|
| 167 | uint32_t u32SessionCookie;
|
---|
| 168 | /** The size of the input. */
|
---|
| 169 | uint32_t cbIn;
|
---|
| 170 | /** The size of the output. */
|
---|
| 171 | uint32_t cbOut;
|
---|
| 172 | /** Flags. See SUPREQHDR_FLAGS_* for details and values. */
|
---|
| 173 | uint32_t fFlags;
|
---|
| 174 | /** The VBox status code of the operation, out direction only. */
|
---|
| 175 | int32_t rc;
|
---|
| 176 | } SUPREQHDR;
|
---|
| 177 | /** Pointer to a IOC header. */
|
---|
| 178 | typedef SUPREQHDR *PSUPREQHDR;
|
---|
[1] | 179 |
|
---|
[4800] | 180 | /** @name SUPREQHDR::fFlags values
|
---|
| 181 | * @{ */
|
---|
| 182 | /** Masks out the magic value. */
|
---|
| 183 | #define SUPREQHDR_FLAGS_MAGIC_MASK UINT32_C(0xff0000ff)
|
---|
| 184 | /** The generic mask. */
|
---|
| 185 | #define SUPREQHDR_FLAGS_GEN_MASK UINT32_C(0x0000ff00)
|
---|
| 186 | /** The request specific mask. */
|
---|
| 187 | #define SUPREQHDR_FLAGS_REQ_MASK UINT32_C(0x00ff0000)
|
---|
[1193] | 188 |
|
---|
[4800] | 189 | /** There is extra input that needs copying on some platforms. */
|
---|
| 190 | #define SUPREQHDR_FLAGS_EXTRA_IN UINT32_C(0x00000100)
|
---|
| 191 | /** There is extra output that needs copying on some platforms. */
|
---|
| 192 | #define SUPREQHDR_FLAGS_EXTRA_OUT UINT32_C(0x00000200)
|
---|
| 193 |
|
---|
| 194 | /** The magic value. */
|
---|
| 195 | #define SUPREQHDR_FLAGS_MAGIC UINT32_C(0x42000042)
|
---|
| 196 | /** The default value. Use this when no special stuff is requested. */
|
---|
| 197 | #define SUPREQHDR_FLAGS_DEFAULT SUPREQHDR_FLAGS_MAGIC
|
---|
| 198 | /** @} */
|
---|
| 199 |
|
---|
| 200 |
|
---|
| 201 | /** @name SUP_IOCTL_COOKIE
|
---|
| 202 | * @{
|
---|
| 203 | */
|
---|
| 204 | /** Negotiate cookie. */
|
---|
| 205 | #define SUP_IOCTL_COOKIE SUP_CTL_CODE_SIZE(1, SUP_IOCTL_COOKIE_SIZE)
|
---|
| 206 | /** The request size. */
|
---|
| 207 | #define SUP_IOCTL_COOKIE_SIZE sizeof(SUPCOOKIE)
|
---|
| 208 | /** The SUPREQHDR::cbIn value. */
|
---|
| 209 | #define SUP_IOCTL_COOKIE_SIZE_IN sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPCOOKIE, u.In)
|
---|
| 210 | /** The SUPREQHDR::cbOut value. */
|
---|
| 211 | #define SUP_IOCTL_COOKIE_SIZE_OUT sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPCOOKIE, u.Out)
|
---|
[1840] | 212 | /** SUPCOOKIE_IN magic word. */
|
---|
[4800] | 213 | #define SUPCOOKIE_MAGIC "The Magic Word!"
|
---|
| 214 | /** The initial cookie. */
|
---|
| 215 | #define SUPCOOKIE_INITIAL_COOKIE 0x69726f74 /* 'tori' */
|
---|
| 216 |
|
---|
[1840] | 217 | /** Current interface version.
|
---|
[41783] | 218 | * The upper 16-bit is the major version, the lower the minor version.
|
---|
[14575] | 219 | * When incompatible changes are made, the upper major number has to be changed.
|
---|
| 220 | *
|
---|
[20504] | 221 | * Update rules:
|
---|
[22609] | 222 | * -# Only update the major number when incompatible changes have been made to
|
---|
[22150] | 223 | * the IOC interface or the ABI provided via the functions returned by
|
---|
| 224 | * SUPQUERYFUNCS.
|
---|
[20504] | 225 | * -# When adding new features (new IOC number, new flags, new exports, ++)
|
---|
| 226 | * only update the minor number and change SUPLib.cpp to require the
|
---|
| 227 | * new IOC version.
|
---|
| 228 | * -# When incrementing the major number, clear the minor part and reset
|
---|
| 229 | * any IOC version requirements in SUPLib.cpp.
|
---|
[22150] | 230 | * -# When increment the major number, execute all pending work.
|
---|
[20504] | 231 | *
|
---|
[14575] | 232 | * @todo Pending work on next major version change:
|
---|
[90970] | 233 | * - nothing
|
---|
[14575] | 234 | */
|
---|
[104327] | 235 | #define SUPDRV_IOC_VERSION 0x00340000
|
---|
[1840] | 236 |
|
---|
[4800] | 237 | /** SUP_IOCTL_COOKIE. */
|
---|
| 238 | typedef struct SUPCOOKIE
|
---|
[1] | 239 | {
|
---|
[4800] | 240 | /** The header.
|
---|
| 241 | * u32Cookie must be set to SUPCOOKIE_INITIAL_COOKIE.
|
---|
| 242 | * u32SessionCookie should be set to some random value. */
|
---|
| 243 | SUPREQHDR Hdr;
|
---|
| 244 | union
|
---|
| 245 | {
|
---|
| 246 | struct
|
---|
| 247 | {
|
---|
| 248 | /** Magic word. */
|
---|
| 249 | char szMagic[16];
|
---|
| 250 | /** The requested interface version number. */
|
---|
| 251 | uint32_t u32ReqVersion;
|
---|
| 252 | /** The minimum interface version number. */
|
---|
| 253 | uint32_t u32MinVersion;
|
---|
| 254 | } In;
|
---|
| 255 | struct
|
---|
| 256 | {
|
---|
| 257 | /** Cookie. */
|
---|
| 258 | uint32_t u32Cookie;
|
---|
| 259 | /** Session cookie. */
|
---|
| 260 | uint32_t u32SessionCookie;
|
---|
| 261 | /** Interface version for this session. */
|
---|
| 262 | uint32_t u32SessionVersion;
|
---|
| 263 | /** The actual interface version in the driver. */
|
---|
| 264 | uint32_t u32DriverVersion;
|
---|
| 265 | /** Number of functions available for the SUP_IOCTL_QUERY_FUNCS request. */
|
---|
| 266 | uint32_t cFunctions;
|
---|
| 267 | /** Session handle. */
|
---|
| 268 | R0PTRTYPE(PSUPDRVSESSION) pSession;
|
---|
| 269 | } Out;
|
---|
| 270 | } u;
|
---|
| 271 | } SUPCOOKIE, *PSUPCOOKIE;
|
---|
| 272 | /** @} */
|
---|
[1] | 273 |
|
---|
| 274 |
|
---|
[4800] | 275 | /** @name SUP_IOCTL_QUERY_FUNCS
|
---|
| 276 | * Query SUPR0 functions.
|
---|
| 277 | * @{
|
---|
| 278 | */
|
---|
[19868] | 279 | #define SUP_IOCTL_QUERY_FUNCS(cFuncs) SUP_CTL_CODE_BIG(2)
|
---|
[73097] | 280 | #define SUP_IOCTL_QUERY_FUNCS_SIZE(cFuncs) RT_UOFFSETOF_DYN(SUPQUERYFUNCS, u.Out.aFunctions[(cFuncs)])
|
---|
[4800] | 281 | #define SUP_IOCTL_QUERY_FUNCS_SIZE_IN sizeof(SUPREQHDR)
|
---|
| 282 | #define SUP_IOCTL_QUERY_FUNCS_SIZE_OUT(cFuncs) SUP_IOCTL_QUERY_FUNCS_SIZE(cFuncs)
|
---|
[1840] | 283 |
|
---|
[4800] | 284 | /** A function. */
|
---|
[1] | 285 | typedef struct SUPFUNC
|
---|
| 286 | {
|
---|
| 287 | /** Name - mangled. */
|
---|
[91800] | 288 | char szName[47];
|
---|
| 289 | /** For internal checking. Ignore. */
|
---|
| 290 | uint8_t cArgs;
|
---|
[1] | 291 | /** Address. */
|
---|
[1840] | 292 | RTR0PTR pfn;
|
---|
[1] | 293 | } SUPFUNC, *PSUPFUNC;
|
---|
| 294 |
|
---|
[4800] | 295 | typedef struct SUPQUERYFUNCS
|
---|
[1] | 296 | {
|
---|
[4800] | 297 | /** The header. */
|
---|
| 298 | SUPREQHDR Hdr;
|
---|
| 299 | union
|
---|
| 300 | {
|
---|
| 301 | struct
|
---|
| 302 | {
|
---|
| 303 | /** Number of functions returned. */
|
---|
| 304 | uint32_t cFunctions;
|
---|
| 305 | /** Array of functions. */
|
---|
| 306 | SUPFUNC aFunctions[1];
|
---|
| 307 | } Out;
|
---|
| 308 | } u;
|
---|
| 309 | } SUPQUERYFUNCS, *PSUPQUERYFUNCS;
|
---|
| 310 | /** @} */
|
---|
[1] | 311 |
|
---|
| 312 |
|
---|
[4800] | 313 | /** @name SUP_IOCTL_LDR_OPEN
|
---|
| 314 | * Open an image.
|
---|
| 315 | * @{
|
---|
| 316 | */
|
---|
[20860] | 317 | #define SUP_IOCTL_LDR_OPEN SUP_CTL_CODE_SIZE(3, SUP_IOCTL_LDR_OPEN_SIZE)
|
---|
[4800] | 318 | #define SUP_IOCTL_LDR_OPEN_SIZE sizeof(SUPLDROPEN)
|
---|
| 319 | #define SUP_IOCTL_LDR_OPEN_SIZE_IN sizeof(SUPLDROPEN)
|
---|
| 320 | #define SUP_IOCTL_LDR_OPEN_SIZE_OUT (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPLDROPEN, u.Out))
|
---|
| 321 | typedef struct SUPLDROPEN
|
---|
[1] | 322 | {
|
---|
[4800] | 323 | /** The header. */
|
---|
| 324 | SUPREQHDR Hdr;
|
---|
| 325 | union
|
---|
| 326 | {
|
---|
| 327 | struct
|
---|
| 328 | {
|
---|
[87700] | 329 | /** Size of the image we'll be loading (including all tables).
|
---|
| 330 | * Zero if the caller does not wish to prepare loading anything, then
|
---|
| 331 | * cbImageBits must be zero too ofc. */
|
---|
[85507] | 332 | uint32_t cbImageWithEverything;
|
---|
[87700] | 333 | /** The size of the image bits. (Less or equal to cbImageWithTabs.)
|
---|
| 334 | * Zero if the caller does not wish to prepare loading anything. */
|
---|
[25258] | 335 | uint32_t cbImageBits;
|
---|
[4800] | 336 | /** Image name.
|
---|
| 337 | * This is the NAME of the image, not the file name. It is used
|
---|
| 338 | * to share code with other processes. (Max len is 32 chars!) */
|
---|
| 339 | char szName[32];
|
---|
[25258] | 340 | /** Image file name.
|
---|
| 341 | * This can be used to load the image using a native loader. */
|
---|
[34972] | 342 | char szFilename[260];
|
---|
[4800] | 343 | } In;
|
---|
| 344 | struct
|
---|
| 345 | {
|
---|
| 346 | /** The base address of the image. */
|
---|
| 347 | RTR0PTR pvImageBase;
|
---|
| 348 | /** Indicate whether or not the image requires loading. */
|
---|
| 349 | bool fNeedsLoading;
|
---|
[25275] | 350 | /** Indicates that we're using the native ring-0 loader. */
|
---|
| 351 | bool fNativeLoader;
|
---|
[4800] | 352 | } Out;
|
---|
| 353 | } u;
|
---|
| 354 | } SUPLDROPEN, *PSUPLDROPEN;
|
---|
| 355 | /** @} */
|
---|
[1] | 356 |
|
---|
| 357 |
|
---|
[4800] | 358 | /** @name SUP_IOCTL_LDR_LOAD
|
---|
| 359 | * Upload the image bits.
|
---|
| 360 | * @{
|
---|
| 361 | */
|
---|
[20860] | 362 | #define SUP_IOCTL_LDR_LOAD SUP_CTL_CODE_BIG(4)
|
---|
[73097] | 363 | #define SUP_IOCTL_LDR_LOAD_SIZE(cbImage) RT_MAX(RT_UOFFSETOF_DYN(SUPLDRLOAD, u.In.abImage[cbImage]), SUP_IOCTL_LDR_LOAD_SIZE_OUT)
|
---|
| 364 | #define SUP_IOCTL_LDR_LOAD_SIZE_IN(cbImage) RT_UOFFSETOF_DYN(SUPLDRLOAD, u.In.abImage[cbImage])
|
---|
[57378] | 365 | #define SUP_IOCTL_LDR_LOAD_SIZE_OUT (RT_UOFFSETOF(SUPLDRLOAD, u.Out.szError) + RT_SIZEOFMEMB(SUPLDRLOAD, u.Out.szError))
|
---|
[1] | 366 |
|
---|
| 367 | /**
|
---|
| 368 | * Module initialization callback function.
|
---|
| 369 | * This is called once after the module has been loaded.
|
---|
| 370 | *
|
---|
| 371 | * @returns 0 on success.
|
---|
[40763] | 372 | * @returns Appropriate error code on failure.
|
---|
[40636] | 373 | * @param hMod Image handle for use in APIs.
|
---|
[1] | 374 | */
|
---|
[85121] | 375 | typedef DECLCALLBACKTYPE(int, FNR0MODULEINIT,(void *hMod));
|
---|
[1] | 376 | /** Pointer to a FNR0MODULEINIT(). */
|
---|
[1840] | 377 | typedef R0PTRTYPE(FNR0MODULEINIT *) PFNR0MODULEINIT;
|
---|
[1] | 378 |
|
---|
| 379 | /**
|
---|
| 380 | * Module termination callback function.
|
---|
[40763] | 381 | * This is called once right before the module is being unloaded.
|
---|
| 382 | *
|
---|
[40636] | 383 | * @param hMod Image handle for use in APIs.
|
---|
[1] | 384 | */
|
---|
[85121] | 385 | typedef DECLCALLBACKTYPE(void, FNR0MODULETERM,(void *hMod));
|
---|
[1] | 386 | /** Pointer to a FNR0MODULETERM(). */
|
---|
[1840] | 387 | typedef R0PTRTYPE(FNR0MODULETERM *) PFNR0MODULETERM;
|
---|
[1] | 388 |
|
---|
| 389 | /**
|
---|
| 390 | * Symbol table entry.
|
---|
| 391 | */
|
---|
| 392 | typedef struct SUPLDRSYM
|
---|
| 393 | {
|
---|
| 394 | /** Offset into of the string table. */
|
---|
| 395 | uint32_t offName;
|
---|
[37229] | 396 | /** Offset of the symbol relative to the image load address.
|
---|
| 397 | * @remarks When used inside the SUPDrv to calculate real addresses, it
|
---|
| 398 | * must be cast to int32_t for the sake of native loader support
|
---|
| 399 | * on Solaris. (The loader puts the and data in different
|
---|
| 400 | * memory areans, and the text one is generally higher.) */
|
---|
[1] | 401 | uint32_t offSymbol;
|
---|
[10377] | 402 | } SUPLDRSYM;
|
---|
| 403 | /** Pointer to a symbol table entry. */
|
---|
| 404 | typedef SUPLDRSYM *PSUPLDRSYM;
|
---|
| 405 | /** Pointer to a const symbol table entry. */
|
---|
| 406 | typedef SUPLDRSYM const *PCSUPLDRSYM;
|
---|
[1] | 407 |
|
---|
[85507] | 408 | #define SUPLDR_PROT_READ 1 /**< Grant read access (RTMEM_PROT_READ). */
|
---|
| 409 | #define SUPLDR_PROT_WRITE 2 /**< Grant write access (RTMEM_PROT_WRITE). */
|
---|
| 410 | #define SUPLDR_PROT_EXEC 4 /**< Grant execute access (RTMEM_PROT_EXEC). */
|
---|
| 411 |
|
---|
[4806] | 412 | /**
|
---|
[85507] | 413 | * A segment table entry - chiefly for conveying memory protection.
|
---|
| 414 | */
|
---|
| 415 | typedef struct SUPLDRSEG
|
---|
| 416 | {
|
---|
| 417 | /** The RVA of the segment. */
|
---|
| 418 | uint32_t off;
|
---|
| 419 | /** The size of the segment. */
|
---|
| 420 | uint32_t cb : 28;
|
---|
| 421 | /** The segment protection (SUPLDR_PROT_XXX). */
|
---|
| 422 | uint32_t fProt : 3;
|
---|
| 423 | /** MBZ. */
|
---|
| 424 | uint32_t fUnused;
|
---|
| 425 | } SUPLDRSEG;
|
---|
| 426 | /** Pointer to a segment table entry. */
|
---|
| 427 | typedef SUPLDRSEG *PSUPLDRSEG;
|
---|
| 428 | /** Pointer to a const segment table entry. */
|
---|
| 429 | typedef SUPLDRSEG const *PCSUPLDRSEG;
|
---|
| 430 |
|
---|
| 431 | /**
|
---|
[4806] | 432 | * SUPLDRLOAD::u::In::EP type.
|
---|
| 433 | */
|
---|
| 434 | typedef enum SUPLDRLOADEP
|
---|
| 435 | {
|
---|
| 436 | SUPLDRLOADEP_NOTHING = 0,
|
---|
| 437 | SUPLDRLOADEP_VMMR0,
|
---|
[14332] | 438 | SUPLDRLOADEP_SERVICE,
|
---|
[4806] | 439 | SUPLDRLOADEP_32BIT_HACK = 0x7fffffff
|
---|
| 440 | } SUPLDRLOADEP;
|
---|
| 441 |
|
---|
[4800] | 442 | typedef struct SUPLDRLOAD
|
---|
[1] | 443 | {
|
---|
[4800] | 444 | /** The header. */
|
---|
| 445 | SUPREQHDR Hdr;
|
---|
[1] | 446 | union
|
---|
| 447 | {
|
---|
| 448 | struct
|
---|
| 449 | {
|
---|
[4800] | 450 | /** The address of module initialization function. Similar to _DLL_InitTerm(hmod, 0). */
|
---|
[54331] | 451 | RTR0PTR pfnModuleInit;
|
---|
[4800] | 452 | /** The address of module termination function. Similar to _DLL_InitTerm(hmod, 1). */
|
---|
[54331] | 453 | RTR0PTR pfnModuleTerm;
|
---|
[4800] | 454 | /** Special entry points. */
|
---|
| 455 | union
|
---|
| 456 | {
|
---|
[14332] | 457 | /** SUPLDRLOADEP_VMMR0. */
|
---|
[4800] | 458 | struct
|
---|
| 459 | {
|
---|
[4811] | 460 | /** Address of VMMR0EntryFast function. */
|
---|
[14332] | 461 | RTR0PTR pvVMMR0EntryFast;
|
---|
[4811] | 462 | /** Address of VMMR0EntryEx function. */
|
---|
[14332] | 463 | RTR0PTR pvVMMR0EntryEx;
|
---|
[4800] | 464 | } VMMR0;
|
---|
[14332] | 465 | /** SUPLDRLOADEP_SERVICE. */
|
---|
| 466 | struct
|
---|
| 467 | {
|
---|
| 468 | /** The service request handler.
|
---|
| 469 | * (PFNR0SERVICEREQHANDLER isn't defined yet.) */
|
---|
| 470 | RTR0PTR pfnServiceReq;
|
---|
| 471 | /** Reserved, must be NIL. */
|
---|
| 472 | RTR0PTR apvReserved[3];
|
---|
| 473 | } Service;
|
---|
[4800] | 474 | } EP;
|
---|
| 475 | /** Address. */
|
---|
| 476 | RTR0PTR pvImageBase;
|
---|
| 477 | /** Entry point type. */
|
---|
[4806] | 478 | SUPLDRLOADEP eEPType;
|
---|
[25258] | 479 | /** The size of the image bits (starting at offset 0 and
|
---|
| 480 | * approaching offSymbols). */
|
---|
| 481 | uint32_t cbImageBits;
|
---|
[85507] | 482 | /** The offset of the symbol table (SUPLDRSYM array). */
|
---|
[4800] | 483 | uint32_t offSymbols;
|
---|
| 484 | /** The number of entries in the symbol table. */
|
---|
| 485 | uint32_t cSymbols;
|
---|
| 486 | /** The offset of the string table. */
|
---|
| 487 | uint32_t offStrTab;
|
---|
| 488 | /** Size of the string table. */
|
---|
| 489 | uint32_t cbStrTab;
|
---|
[85507] | 490 | /** Offset to the segment table (SUPLDRSEG array). */
|
---|
| 491 | uint32_t offSegments;
|
---|
| 492 | /** Number of segments. */
|
---|
| 493 | uint32_t cSegments;
|
---|
[25258] | 494 | /** Size of image data in achImage. */
|
---|
[85507] | 495 | uint32_t cbImageWithEverything;
|
---|
[86512] | 496 | /** Flags (SUPLDRLOAD_F_XXX). */
|
---|
| 497 | uint32_t fFlags;
|
---|
[4800] | 498 | /** The image data. */
|
---|
[25528] | 499 | uint8_t abImage[1];
|
---|
[4800] | 500 | } In;
|
---|
[57378] | 501 | struct
|
---|
| 502 | {
|
---|
| 503 | /** Magic value indicating whether extended error information is
|
---|
| 504 | * present or not (SUPLDRLOAD_ERROR_MAGIC). */
|
---|
| 505 | uint64_t uErrorMagic;
|
---|
| 506 | /** Extended error information. */
|
---|
| 507 | char szError[2048];
|
---|
| 508 | } Out;
|
---|
[4800] | 509 | } u;
|
---|
| 510 | } SUPLDRLOAD, *PSUPLDRLOAD;
|
---|
[57378] | 511 | /** Magic value that indicates that there is a valid error information string
|
---|
| 512 | * present on SUP_IOCTL_LDR_LOAD failure.
|
---|
| 513 | * @remarks The value is choosen to be an unlikely init and term address. */
|
---|
| 514 | #define SUPLDRLOAD_ERROR_MAGIC UINT64_C(0xabcdefef0feddcb9)
|
---|
[86512] | 515 | /** The module depends on VMMR0. */
|
---|
| 516 | #define SUPLDRLOAD_F_DEP_VMMR0 RT_BIT_32(0)
|
---|
| 517 | /** Valid flag mask. */
|
---|
| 518 | #define SUPLDRLOAD_F_VALID_MASK UINT32_C(0x00000001)
|
---|
[4800] | 519 | /** @} */
|
---|
[1] | 520 |
|
---|
| 521 |
|
---|
[4800] | 522 | /** @name SUP_IOCTL_LDR_FREE
|
---|
| 523 | * Free an image.
|
---|
| 524 | * @{
|
---|
| 525 | */
|
---|
[20860] | 526 | #define SUP_IOCTL_LDR_FREE SUP_CTL_CODE_SIZE(5, SUP_IOCTL_LDR_FREE_SIZE)
|
---|
[4800] | 527 | #define SUP_IOCTL_LDR_FREE_SIZE sizeof(SUPLDRFREE)
|
---|
| 528 | #define SUP_IOCTL_LDR_FREE_SIZE_IN sizeof(SUPLDRFREE)
|
---|
| 529 | #define SUP_IOCTL_LDR_FREE_SIZE_OUT sizeof(SUPREQHDR)
|
---|
| 530 | typedef struct SUPLDRFREE
|
---|
| 531 | {
|
---|
| 532 | /** The header. */
|
---|
| 533 | SUPREQHDR Hdr;
|
---|
| 534 | union
|
---|
| 535 | {
|
---|
| 536 | struct
|
---|
| 537 | {
|
---|
| 538 | /** Address. */
|
---|
| 539 | RTR0PTR pvImageBase;
|
---|
| 540 | } In;
|
---|
| 541 | } u;
|
---|
| 542 | } SUPLDRFREE, *PSUPLDRFREE;
|
---|
| 543 | /** @} */
|
---|
[1840] | 544 |
|
---|
[4800] | 545 |
|
---|
[54013] | 546 | /** @name SUP_IOCTL_LDR_LOCK_DOWN
|
---|
| 547 | * Lock down the image loader interface.
|
---|
| 548 | * @{
|
---|
| 549 | */
|
---|
| 550 | #define SUP_IOCTL_LDR_LOCK_DOWN SUP_CTL_CODE_SIZE(38, SUP_IOCTL_LDR_LOCK_DOWN_SIZE)
|
---|
| 551 | #define SUP_IOCTL_LDR_LOCK_DOWN_SIZE sizeof(SUPREQHDR)
|
---|
| 552 | #define SUP_IOCTL_LDR_LOCK_DOWN_SIZE_IN sizeof(SUPREQHDR)
|
---|
| 553 | #define SUP_IOCTL_LDR_LOCK_DOWN_SIZE_OUT sizeof(SUPREQHDR)
|
---|
| 554 | /** @} */
|
---|
| 555 |
|
---|
| 556 |
|
---|
[4800] | 557 | /** @name SUP_IOCTL_LDR_GET_SYMBOL
|
---|
| 558 | * Get address of a symbol within an image.
|
---|
| 559 | * @{
|
---|
| 560 | */
|
---|
[20860] | 561 | #define SUP_IOCTL_LDR_GET_SYMBOL SUP_CTL_CODE_SIZE(6, SUP_IOCTL_LDR_GET_SYMBOL_SIZE)
|
---|
[4800] | 562 | #define SUP_IOCTL_LDR_GET_SYMBOL_SIZE sizeof(SUPLDRGETSYMBOL)
|
---|
| 563 | #define SUP_IOCTL_LDR_GET_SYMBOL_SIZE_IN sizeof(SUPLDRGETSYMBOL)
|
---|
| 564 | #define SUP_IOCTL_LDR_GET_SYMBOL_SIZE_OUT (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPLDRGETSYMBOL, u.Out))
|
---|
| 565 | typedef struct SUPLDRGETSYMBOL
|
---|
[1] | 566 | {
|
---|
[4800] | 567 | /** The header. */
|
---|
| 568 | SUPREQHDR Hdr;
|
---|
| 569 | union
|
---|
| 570 | {
|
---|
| 571 | struct
|
---|
| 572 | {
|
---|
| 573 | /** Address. */
|
---|
| 574 | RTR0PTR pvImageBase;
|
---|
| 575 | /** The symbol name. */
|
---|
| 576 | char szSymbol[64];
|
---|
| 577 | } In;
|
---|
| 578 | struct
|
---|
| 579 | {
|
---|
| 580 | /** The symbol address. */
|
---|
| 581 | RTR0PTR pvSymbol;
|
---|
| 582 | } Out;
|
---|
| 583 | } u;
|
---|
| 584 | } SUPLDRGETSYMBOL, *PSUPLDRGETSYMBOL;
|
---|
| 585 | /** @} */
|
---|
[1] | 586 |
|
---|
| 587 |
|
---|
[4800] | 588 | /** @name SUP_IOCTL_CALL_VMMR0
|
---|
| 589 | * Call the R0 VMM Entry point.
|
---|
| 590 | * @{
|
---|
| 591 | */
|
---|
[20860] | 592 | #define SUP_IOCTL_CALL_VMMR0(cbReq) SUP_CTL_CODE_SIZE(7, SUP_IOCTL_CALL_VMMR0_SIZE(cbReq))
|
---|
[54331] | 593 | #define SUP_IOCTL_CALL_VMMR0_NO_SIZE() SUP_CTL_CODE_SIZE(7, 0)
|
---|
[73097] | 594 | #define SUP_IOCTL_CALL_VMMR0_SIZE(cbReq) RT_UOFFSETOF_DYN(SUPCALLVMMR0, abReqPkt[cbReq])
|
---|
[4800] | 595 | #define SUP_IOCTL_CALL_VMMR0_SIZE_IN(cbReq) SUP_IOCTL_CALL_VMMR0_SIZE(cbReq)
|
---|
| 596 | #define SUP_IOCTL_CALL_VMMR0_SIZE_OUT(cbReq) SUP_IOCTL_CALL_VMMR0_SIZE(cbReq)
|
---|
| 597 | typedef struct SUPCALLVMMR0
|
---|
[1] | 598 | {
|
---|
[4800] | 599 | /** The header. */
|
---|
| 600 | SUPREQHDR Hdr;
|
---|
| 601 | union
|
---|
| 602 | {
|
---|
| 603 | struct
|
---|
| 604 | {
|
---|
| 605 | /** The VM handle. */
|
---|
| 606 | PVMR0 pVMR0;
|
---|
[19257] | 607 | /** VCPU id. */
|
---|
| 608 | uint32_t idCpu;
|
---|
[4800] | 609 | /** Which operation to execute. */
|
---|
| 610 | uint32_t uOperation;
|
---|
| 611 | /** Argument to use when no request packet is supplied. */
|
---|
[4811] | 612 | uint64_t u64Arg;
|
---|
[4800] | 613 | } In;
|
---|
| 614 | } u;
|
---|
| 615 | /** The VMMR0Entry request packet. */
|
---|
| 616 | uint8_t abReqPkt[1];
|
---|
| 617 | } SUPCALLVMMR0, *PSUPCALLVMMR0;
|
---|
| 618 | /** @} */
|
---|
[1] | 619 |
|
---|
[4800] | 620 |
|
---|
[36232] | 621 | /** @name SUP_IOCTL_CALL_VMMR0_BIG
|
---|
| 622 | * Version of SUP_IOCTL_CALL_VMMR0 for dealing with large requests.
|
---|
| 623 | * @{
|
---|
| 624 | */
|
---|
| 625 | #define SUP_IOCTL_CALL_VMMR0_BIG SUP_CTL_CODE_BIG(27)
|
---|
[73097] | 626 | #define SUP_IOCTL_CALL_VMMR0_BIG_SIZE(cbReq) RT_UOFFSETOF_DYN(SUPCALLVMMR0, abReqPkt[cbReq])
|
---|
[36232] | 627 | #define SUP_IOCTL_CALL_VMMR0_BIG_SIZE_IN(cbReq) SUP_IOCTL_CALL_VMMR0_SIZE(cbReq)
|
---|
| 628 | #define SUP_IOCTL_CALL_VMMR0_BIG_SIZE_OUT(cbReq) SUP_IOCTL_CALL_VMMR0_SIZE(cbReq)
|
---|
| 629 | /** @} */
|
---|
| 630 |
|
---|
| 631 |
|
---|
[4800] | 632 | /** @name SUP_IOCTL_LOW_ALLOC
|
---|
| 633 | * Allocate memory below 4GB (physically).
|
---|
| 634 | * @{
|
---|
| 635 | */
|
---|
[20860] | 636 | #define SUP_IOCTL_LOW_ALLOC SUP_CTL_CODE_BIG(8)
|
---|
[73097] | 637 | #define SUP_IOCTL_LOW_ALLOC_SIZE(cPages) ((uint32_t)RT_UOFFSETOF_DYN(SUPLOWALLOC, u.Out.aPages[cPages]))
|
---|
[4800] | 638 | #define SUP_IOCTL_LOW_ALLOC_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPLOWALLOC, u.In))
|
---|
| 639 | #define SUP_IOCTL_LOW_ALLOC_SIZE_OUT(cPages) SUP_IOCTL_LOW_ALLOC_SIZE(cPages)
|
---|
| 640 | typedef struct SUPLOWALLOC
|
---|
[1] | 641 | {
|
---|
[4800] | 642 | /** The header. */
|
---|
| 643 | SUPREQHDR Hdr;
|
---|
| 644 | union
|
---|
| 645 | {
|
---|
| 646 | struct
|
---|
| 647 | {
|
---|
| 648 | /** Number of pages to allocate. */
|
---|
| 649 | uint32_t cPages;
|
---|
| 650 | } In;
|
---|
| 651 | struct
|
---|
| 652 | {
|
---|
| 653 | /** The ring-3 address of the allocated memory. */
|
---|
| 654 | RTR3PTR pvR3;
|
---|
| 655 | /** The ring-0 address of the allocated memory. */
|
---|
| 656 | RTR0PTR pvR0;
|
---|
| 657 | /** Array of pages. */
|
---|
| 658 | RTHCPHYS aPages[1];
|
---|
| 659 | } Out;
|
---|
| 660 | } u;
|
---|
| 661 | } SUPLOWALLOC, *PSUPLOWALLOC;
|
---|
| 662 | /** @} */
|
---|
[1] | 663 |
|
---|
| 664 |
|
---|
[4800] | 665 | /** @name SUP_IOCTL_LOW_FREE
|
---|
| 666 | * Free low memory.
|
---|
| 667 | * @{
|
---|
| 668 | */
|
---|
[20860] | 669 | #define SUP_IOCTL_LOW_FREE SUP_CTL_CODE_SIZE(9, SUP_IOCTL_LOW_FREE_SIZE)
|
---|
[4800] | 670 | #define SUP_IOCTL_LOW_FREE_SIZE sizeof(SUPLOWFREE)
|
---|
| 671 | #define SUP_IOCTL_LOW_FREE_SIZE_IN sizeof(SUPLOWFREE)
|
---|
| 672 | #define SUP_IOCTL_LOW_FREE_SIZE_OUT sizeof(SUPREQHDR)
|
---|
| 673 | typedef struct SUPLOWFREE
|
---|
[1] | 674 | {
|
---|
[4800] | 675 | /** The header. */
|
---|
| 676 | SUPREQHDR Hdr;
|
---|
| 677 | union
|
---|
| 678 | {
|
---|
| 679 | struct
|
---|
| 680 | {
|
---|
| 681 | /** The ring-3 address of the memory to free. */
|
---|
| 682 | RTR3PTR pvR3;
|
---|
| 683 | } In;
|
---|
| 684 | } u;
|
---|
| 685 | } SUPLOWFREE, *PSUPLOWFREE;
|
---|
| 686 | /** @} */
|
---|
[1] | 687 |
|
---|
[4800] | 688 |
|
---|
[20860] | 689 | /** @name SUP_IOCTL_PAGE_ALLOC_EX
|
---|
| 690 | * Allocate memory and map it into kernel and/or user space. The memory is of
|
---|
| 691 | * course locked. The result should be freed using SUP_IOCTL_PAGE_FREE.
|
---|
| 692 | *
|
---|
| 693 | * @remarks Allocations without a kernel mapping may fail with
|
---|
| 694 | * VERR_NOT_SUPPORTED on some platforms.
|
---|
| 695 | *
|
---|
[4800] | 696 | * @{
|
---|
| 697 | */
|
---|
[20860] | 698 | #define SUP_IOCTL_PAGE_ALLOC_EX SUP_CTL_CODE_BIG(10)
|
---|
[73097] | 699 | #define SUP_IOCTL_PAGE_ALLOC_EX_SIZE(cPages) RT_UOFFSETOF_DYN(SUPPAGEALLOCEX, u.Out.aPages[cPages])
|
---|
[20860] | 700 | #define SUP_IOCTL_PAGE_ALLOC_EX_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPPAGEALLOCEX, u.In))
|
---|
| 701 | #define SUP_IOCTL_PAGE_ALLOC_EX_SIZE_OUT(cPages) SUP_IOCTL_PAGE_ALLOC_EX_SIZE(cPages)
|
---|
| 702 | typedef struct SUPPAGEALLOCEX
|
---|
[1] | 703 | {
|
---|
[4800] | 704 | /** The header. */
|
---|
| 705 | SUPREQHDR Hdr;
|
---|
| 706 | union
|
---|
| 707 | {
|
---|
| 708 | struct
|
---|
| 709 | {
|
---|
| 710 | /** Number of pages to allocate */
|
---|
| 711 | uint32_t cPages;
|
---|
[20860] | 712 | /** Whether it should have kernel mapping. */
|
---|
| 713 | bool fKernelMapping;
|
---|
| 714 | /** Whether it should have a user mapping. */
|
---|
| 715 | bool fUserMapping;
|
---|
| 716 | /** Reserved. Must be false. */
|
---|
| 717 | bool fReserved0;
|
---|
| 718 | /** Reserved. Must be false. */
|
---|
| 719 | bool fReserved1;
|
---|
[4800] | 720 | } In;
|
---|
| 721 | struct
|
---|
| 722 | {
|
---|
| 723 | /** Returned ring-3 address. */
|
---|
| 724 | RTR3PTR pvR3;
|
---|
[20860] | 725 | /** Returned ring-0 address. */
|
---|
| 726 | RTR0PTR pvR0;
|
---|
[4800] | 727 | /** The physical addresses of the allocated pages. */
|
---|
| 728 | RTHCPHYS aPages[1];
|
---|
| 729 | } Out;
|
---|
| 730 | } u;
|
---|
[20860] | 731 | } SUPPAGEALLOCEX, *PSUPPAGEALLOCEX;
|
---|
[4800] | 732 | /** @} */
|
---|
[1] | 733 |
|
---|
| 734 |
|
---|
[20860] | 735 | /** @name SUP_IOCTL_PAGE_MAP_KERNEL
|
---|
| 736 | * Maps a portion of memory allocated by SUP_IOCTL_PAGE_ALLOC_EX /
|
---|
| 737 | * SUPR0PageAllocEx into kernel space for use by a device or similar.
|
---|
| 738 | *
|
---|
| 739 | * The mapping will be freed together with the ring-3 mapping when
|
---|
| 740 | * SUP_IOCTL_PAGE_FREE or SUPR0PageFree is called.
|
---|
| 741 | *
|
---|
| 742 | * @remarks Not necessarily supported on all platforms.
|
---|
| 743 | *
|
---|
| 744 | * @{
|
---|
| 745 | */
|
---|
| 746 | #define SUP_IOCTL_PAGE_MAP_KERNEL SUP_CTL_CODE_SIZE(11, SUP_IOCTL_PAGE_MAP_KERNEL_SIZE)
|
---|
| 747 | #define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE sizeof(SUPPAGEMAPKERNEL)
|
---|
| 748 | #define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE_IN sizeof(SUPPAGEMAPKERNEL)
|
---|
| 749 | #define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE_OUT sizeof(SUPPAGEMAPKERNEL)
|
---|
| 750 | typedef struct SUPPAGEMAPKERNEL
|
---|
| 751 | {
|
---|
| 752 | /** The header. */
|
---|
| 753 | SUPREQHDR Hdr;
|
---|
| 754 | union
|
---|
| 755 | {
|
---|
| 756 | struct
|
---|
| 757 | {
|
---|
| 758 | /** The pointer of to the previously allocated memory. */
|
---|
| 759 | RTR3PTR pvR3;
|
---|
| 760 | /** The offset to start mapping from. */
|
---|
| 761 | uint32_t offSub;
|
---|
| 762 | /** Size of the section to map. */
|
---|
| 763 | uint32_t cbSub;
|
---|
| 764 | /** Flags reserved for future fun. */
|
---|
| 765 | uint32_t fFlags;
|
---|
| 766 | } In;
|
---|
| 767 | struct
|
---|
| 768 | {
|
---|
| 769 | /** The ring-0 address corresponding to pvR3 + offSub. */
|
---|
| 770 | RTR0PTR pvR0;
|
---|
| 771 | } Out;
|
---|
| 772 | } u;
|
---|
| 773 | } SUPPAGEMAPKERNEL, *PSUPPAGEMAPKERNEL;
|
---|
| 774 | /** @} */
|
---|
| 775 |
|
---|
| 776 |
|
---|
| 777 | /** @name SUP_IOCTL_PAGE_PROTECT
|
---|
| 778 | * Changes the page level protection of the user and/or kernel mappings of
|
---|
| 779 | * memory previously allocated by SUPR0PageAllocEx.
|
---|
| 780 | *
|
---|
| 781 | * @remarks Not necessarily supported on all platforms.
|
---|
| 782 | *
|
---|
| 783 | * @{
|
---|
| 784 | */
|
---|
| 785 | #define SUP_IOCTL_PAGE_PROTECT SUP_CTL_CODE_SIZE(12, SUP_IOCTL_PAGE_PROTECT_SIZE)
|
---|
| 786 | #define SUP_IOCTL_PAGE_PROTECT_SIZE sizeof(SUPPAGEPROTECT)
|
---|
| 787 | #define SUP_IOCTL_PAGE_PROTECT_SIZE_IN sizeof(SUPPAGEPROTECT)
|
---|
| 788 | #define SUP_IOCTL_PAGE_PROTECT_SIZE_OUT sizeof(SUPPAGEPROTECT)
|
---|
| 789 | typedef struct SUPPAGEPROTECT
|
---|
| 790 | {
|
---|
| 791 | /** The header. */
|
---|
| 792 | SUPREQHDR Hdr;
|
---|
| 793 | union
|
---|
| 794 | {
|
---|
| 795 | struct
|
---|
| 796 | {
|
---|
| 797 | /** The pointer of to the previously allocated memory.
|
---|
| 798 | * Pass NIL_RTR3PTR if the ring-0 mapping should remain unaffected. */
|
---|
| 799 | RTR3PTR pvR3;
|
---|
| 800 | /** The pointer of to the previously allocated memory.
|
---|
| 801 | * Pass NIL_RTR0PTR if the ring-0 mapping should remain unaffected. */
|
---|
| 802 | RTR0PTR pvR0;
|
---|
| 803 | /** The offset to start changing protection at. */
|
---|
| 804 | uint32_t offSub;
|
---|
| 805 | /** Size of the portion that should be changed. */
|
---|
| 806 | uint32_t cbSub;
|
---|
| 807 | /** Protection flags, RTMEM_PROT_*. */
|
---|
| 808 | uint32_t fProt;
|
---|
| 809 | } In;
|
---|
| 810 | } u;
|
---|
| 811 | } SUPPAGEPROTECT, *PSUPPAGEPROTECT;
|
---|
| 812 | /** @} */
|
---|
| 813 |
|
---|
| 814 |
|
---|
[4800] | 815 | /** @name SUP_IOCTL_PAGE_FREE
|
---|
[20860] | 816 | * Free memory allocated with SUP_IOCTL_PAGE_ALLOC_EX.
|
---|
[4800] | 817 | * @{
|
---|
| 818 | */
|
---|
| 819 | #define SUP_IOCTL_PAGE_FREE SUP_CTL_CODE_SIZE(13, SUP_IOCTL_PAGE_FREE_SIZE_IN)
|
---|
| 820 | #define SUP_IOCTL_PAGE_FREE_SIZE sizeof(SUPPAGEFREE)
|
---|
| 821 | #define SUP_IOCTL_PAGE_FREE_SIZE_IN sizeof(SUPPAGEFREE)
|
---|
| 822 | #define SUP_IOCTL_PAGE_FREE_SIZE_OUT sizeof(SUPREQHDR)
|
---|
| 823 | typedef struct SUPPAGEFREE
|
---|
[1] | 824 | {
|
---|
[4800] | 825 | /** The header. */
|
---|
| 826 | SUPREQHDR Hdr;
|
---|
| 827 | union
|
---|
| 828 | {
|
---|
| 829 | struct
|
---|
| 830 | {
|
---|
| 831 | /** Address of memory range to free. */
|
---|
| 832 | RTR3PTR pvR3;
|
---|
| 833 | } In;
|
---|
| 834 | } u;
|
---|
| 835 | } SUPPAGEFREE, *PSUPPAGEFREE;
|
---|
| 836 | /** @} */
|
---|
[1] | 837 |
|
---|
[4800] | 838 |
|
---|
[20860] | 839 |
|
---|
| 840 |
|
---|
[4800] | 841 | /** @name SUP_IOCTL_PAGE_LOCK
|
---|
| 842 | * Pin down physical pages.
|
---|
| 843 | * @{
|
---|
| 844 | */
|
---|
| 845 | #define SUP_IOCTL_PAGE_LOCK SUP_CTL_CODE_BIG(14)
|
---|
| 846 | #define SUP_IOCTL_PAGE_LOCK_SIZE(cPages) (RT_MAX((size_t)SUP_IOCTL_PAGE_LOCK_SIZE_IN, (size_t)SUP_IOCTL_PAGE_LOCK_SIZE_OUT(cPages)))
|
---|
| 847 | #define SUP_IOCTL_PAGE_LOCK_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPPAGELOCK, u.In))
|
---|
[73097] | 848 | #define SUP_IOCTL_PAGE_LOCK_SIZE_OUT(cPages) RT_UOFFSETOF_DYN(SUPPAGELOCK, u.Out.aPages[cPages])
|
---|
[4800] | 849 | typedef struct SUPPAGELOCK
|
---|
[1] | 850 | {
|
---|
[4800] | 851 | /** The header. */
|
---|
| 852 | SUPREQHDR Hdr;
|
---|
| 853 | union
|
---|
| 854 | {
|
---|
| 855 | struct
|
---|
| 856 | {
|
---|
| 857 | /** Start of page range. Must be PAGE aligned. */
|
---|
| 858 | RTR3PTR pvR3;
|
---|
| 859 | /** The range size given as a page count. */
|
---|
| 860 | uint32_t cPages;
|
---|
| 861 | } In;
|
---|
[1] | 862 |
|
---|
[4800] | 863 | struct
|
---|
| 864 | {
|
---|
| 865 | /** Array of pages. */
|
---|
| 866 | RTHCPHYS aPages[1];
|
---|
| 867 | } Out;
|
---|
| 868 | } u;
|
---|
| 869 | } SUPPAGELOCK, *PSUPPAGELOCK;
|
---|
| 870 | /** @} */
|
---|
[1] | 871 |
|
---|
[1840] | 872 |
|
---|
[4800] | 873 | /** @name SUP_IOCTL_PAGE_UNLOCK
|
---|
| 874 | * Unpin physical pages.
|
---|
| 875 | * @{ */
|
---|
| 876 | #define SUP_IOCTL_PAGE_UNLOCK SUP_CTL_CODE_SIZE(15, SUP_IOCTL_PAGE_UNLOCK_SIZE)
|
---|
| 877 | #define SUP_IOCTL_PAGE_UNLOCK_SIZE sizeof(SUPPAGEUNLOCK)
|
---|
| 878 | #define SUP_IOCTL_PAGE_UNLOCK_SIZE_IN sizeof(SUPPAGEUNLOCK)
|
---|
| 879 | #define SUP_IOCTL_PAGE_UNLOCK_SIZE_OUT sizeof(SUPREQHDR)
|
---|
| 880 | typedef struct SUPPAGEUNLOCK
|
---|
[1] | 881 | {
|
---|
[4800] | 882 | /** The header. */
|
---|
| 883 | SUPREQHDR Hdr;
|
---|
| 884 | union
|
---|
| 885 | {
|
---|
| 886 | struct
|
---|
| 887 | {
|
---|
[33540] | 888 | /** Start of page range of a range previously pinned. */
|
---|
[4800] | 889 | RTR3PTR pvR3;
|
---|
| 890 | } In;
|
---|
| 891 | } u;
|
---|
| 892 | } SUPPAGEUNLOCK, *PSUPPAGEUNLOCK;
|
---|
| 893 | /** @} */
|
---|
[1] | 894 |
|
---|
[4800] | 895 |
|
---|
| 896 | /** @name SUP_IOCTL_CONT_ALLOC
|
---|
[33540] | 897 | * Allocate continuous memory.
|
---|
[4800] | 898 | * @{
|
---|
| 899 | */
|
---|
| 900 | #define SUP_IOCTL_CONT_ALLOC SUP_CTL_CODE_SIZE(16, SUP_IOCTL_CONT_ALLOC_SIZE)
|
---|
| 901 | #define SUP_IOCTL_CONT_ALLOC_SIZE sizeof(SUPCONTALLOC)
|
---|
| 902 | #define SUP_IOCTL_CONT_ALLOC_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPCONTALLOC, u.In))
|
---|
| 903 | #define SUP_IOCTL_CONT_ALLOC_SIZE_OUT sizeof(SUPCONTALLOC)
|
---|
| 904 | typedef struct SUPCONTALLOC
|
---|
[1] | 905 | {
|
---|
[4800] | 906 | /** The header. */
|
---|
| 907 | SUPREQHDR Hdr;
|
---|
| 908 | union
|
---|
| 909 | {
|
---|
| 910 | struct
|
---|
| 911 | {
|
---|
| 912 | /** The allocation size given as a page count. */
|
---|
| 913 | uint32_t cPages;
|
---|
| 914 | } In;
|
---|
[1] | 915 |
|
---|
[4800] | 916 | struct
|
---|
| 917 | {
|
---|
| 918 | /** The address of the ring-0 mapping of the allocated memory. */
|
---|
| 919 | RTR0PTR pvR0;
|
---|
| 920 | /** The address of the ring-3 mapping of the allocated memory. */
|
---|
| 921 | RTR3PTR pvR3;
|
---|
| 922 | /** The physical address of the allocation. */
|
---|
| 923 | RTHCPHYS HCPhys;
|
---|
| 924 | } Out;
|
---|
| 925 | } u;
|
---|
| 926 | } SUPCONTALLOC, *PSUPCONTALLOC;
|
---|
| 927 | /** @} */
|
---|
[1] | 928 |
|
---|
[1840] | 929 |
|
---|
[4800] | 930 | /** @name SUP_IOCTL_CONT_FREE Input.
|
---|
| 931 | * @{
|
---|
| 932 | */
|
---|
[33540] | 933 | /** Free continuous memory. */
|
---|
[4800] | 934 | #define SUP_IOCTL_CONT_FREE SUP_CTL_CODE_SIZE(17, SUP_IOCTL_CONT_FREE_SIZE)
|
---|
| 935 | #define SUP_IOCTL_CONT_FREE_SIZE sizeof(SUPCONTFREE)
|
---|
| 936 | #define SUP_IOCTL_CONT_FREE_SIZE_IN sizeof(SUPCONTFREE)
|
---|
| 937 | #define SUP_IOCTL_CONT_FREE_SIZE_OUT sizeof(SUPREQHDR)
|
---|
| 938 | typedef struct SUPCONTFREE
|
---|
[1] | 939 | {
|
---|
[4800] | 940 | /** The header. */
|
---|
| 941 | SUPREQHDR Hdr;
|
---|
| 942 | union
|
---|
| 943 | {
|
---|
| 944 | struct
|
---|
| 945 | {
|
---|
| 946 | /** The ring-3 address of the memory to free. */
|
---|
| 947 | RTR3PTR pvR3;
|
---|
| 948 | } In;
|
---|
| 949 | } u;
|
---|
| 950 | } SUPCONTFREE, *PSUPCONTFREE;
|
---|
| 951 | /** @} */
|
---|
[1] | 952 |
|
---|
| 953 |
|
---|
[4800] | 954 | /** @name SUP_IOCTL_GET_PAGING_MODE
|
---|
| 955 | * Get the host paging mode.
|
---|
| 956 | * @{
|
---|
| 957 | */
|
---|
| 958 | #define SUP_IOCTL_GET_PAGING_MODE SUP_CTL_CODE_SIZE(18, SUP_IOCTL_GET_PAGING_MODE_SIZE)
|
---|
| 959 | #define SUP_IOCTL_GET_PAGING_MODE_SIZE sizeof(SUPGETPAGINGMODE)
|
---|
| 960 | #define SUP_IOCTL_GET_PAGING_MODE_SIZE_IN sizeof(SUPREQHDR)
|
---|
| 961 | #define SUP_IOCTL_GET_PAGING_MODE_SIZE_OUT sizeof(SUPGETPAGINGMODE)
|
---|
| 962 | typedef struct SUPGETPAGINGMODE
|
---|
[1] | 963 | {
|
---|
[4800] | 964 | /** The header. */
|
---|
| 965 | SUPREQHDR Hdr;
|
---|
| 966 | union
|
---|
| 967 | {
|
---|
| 968 | struct
|
---|
| 969 | {
|
---|
| 970 | /** The paging mode. */
|
---|
| 971 | SUPPAGINGMODE enmMode;
|
---|
| 972 | } Out;
|
---|
| 973 | } u;
|
---|
| 974 | } SUPGETPAGINGMODE, *PSUPGETPAGINGMODE;
|
---|
| 975 | /** @} */
|
---|
[1] | 976 |
|
---|
| 977 |
|
---|
[4800] | 978 | /** @name SUP_IOCTL_SET_VM_FOR_FAST
|
---|
| 979 | * Set the VM handle for doing fast call ioctl calls.
|
---|
| 980 | * @{
|
---|
| 981 | */
|
---|
| 982 | #define SUP_IOCTL_SET_VM_FOR_FAST SUP_CTL_CODE_SIZE(19, SUP_IOCTL_SET_VM_FOR_FAST_SIZE)
|
---|
| 983 | #define SUP_IOCTL_SET_VM_FOR_FAST_SIZE sizeof(SUPSETVMFORFAST)
|
---|
| 984 | #define SUP_IOCTL_SET_VM_FOR_FAST_SIZE_IN sizeof(SUPSETVMFORFAST)
|
---|
| 985 | #define SUP_IOCTL_SET_VM_FOR_FAST_SIZE_OUT sizeof(SUPREQHDR)
|
---|
| 986 | typedef struct SUPSETVMFORFAST
|
---|
[1] | 987 | {
|
---|
[4800] | 988 | /** The header. */
|
---|
| 989 | SUPREQHDR Hdr;
|
---|
| 990 | union
|
---|
| 991 | {
|
---|
| 992 | struct
|
---|
| 993 | {
|
---|
| 994 | /** The ring-0 VM handle (pointer). */
|
---|
| 995 | PVMR0 pVMR0;
|
---|
| 996 | } In;
|
---|
| 997 | } u;
|
---|
| 998 | } SUPSETVMFORFAST, *PSUPSETVMFORFAST;
|
---|
| 999 | /** @} */
|
---|
[1] | 1000 |
|
---|
| 1001 |
|
---|
[4800] | 1002 | /** @name SUP_IOCTL_GIP_MAP
|
---|
| 1003 | * Map the GIP into user space.
|
---|
| 1004 | * @{
|
---|
| 1005 | */
|
---|
| 1006 | #define SUP_IOCTL_GIP_MAP SUP_CTL_CODE_SIZE(20, SUP_IOCTL_GIP_MAP_SIZE)
|
---|
| 1007 | #define SUP_IOCTL_GIP_MAP_SIZE sizeof(SUPGIPMAP)
|
---|
| 1008 | #define SUP_IOCTL_GIP_MAP_SIZE_IN sizeof(SUPREQHDR)
|
---|
| 1009 | #define SUP_IOCTL_GIP_MAP_SIZE_OUT sizeof(SUPGIPMAP)
|
---|
| 1010 | typedef struct SUPGIPMAP
|
---|
[1] | 1011 | {
|
---|
[4800] | 1012 | /** The header. */
|
---|
| 1013 | SUPREQHDR Hdr;
|
---|
| 1014 | union
|
---|
| 1015 | {
|
---|
| 1016 | struct
|
---|
| 1017 | {
|
---|
| 1018 | /** The physical address of the GIP. */
|
---|
| 1019 | RTHCPHYS HCPhysGip;
|
---|
| 1020 | /** Pointer to the read-only usermode GIP mapping for this session. */
|
---|
| 1021 | R3PTRTYPE(PSUPGLOBALINFOPAGE) pGipR3;
|
---|
| 1022 | /** Pointer to the supervisor mode GIP mapping. */
|
---|
| 1023 | R0PTRTYPE(PSUPGLOBALINFOPAGE) pGipR0;
|
---|
| 1024 | } Out;
|
---|
| 1025 | } u;
|
---|
| 1026 | } SUPGIPMAP, *PSUPGIPMAP;
|
---|
| 1027 | /** @} */
|
---|
[1] | 1028 |
|
---|
[4755] | 1029 |
|
---|
[4800] | 1030 | /** @name SUP_IOCTL_GIP_UNMAP
|
---|
| 1031 | * Unmap the GIP.
|
---|
| 1032 | * @{
|
---|
| 1033 | */
|
---|
| 1034 | #define SUP_IOCTL_GIP_UNMAP SUP_CTL_CODE_SIZE(21, SUP_IOCTL_GIP_UNMAP_SIZE)
|
---|
| 1035 | #define SUP_IOCTL_GIP_UNMAP_SIZE sizeof(SUPGIPUNMAP)
|
---|
| 1036 | #define SUP_IOCTL_GIP_UNMAP_SIZE_IN sizeof(SUPGIPUNMAP)
|
---|
| 1037 | #define SUP_IOCTL_GIP_UNMAP_SIZE_OUT sizeof(SUPGIPUNMAP)
|
---|
| 1038 | typedef struct SUPGIPUNMAP
|
---|
[4755] | 1039 | {
|
---|
[4800] | 1040 | /** The header. */
|
---|
| 1041 | SUPREQHDR Hdr;
|
---|
| 1042 | } SUPGIPUNMAP, *PSUPGIPUNMAP;
|
---|
| 1043 | /** @} */
|
---|
[4755] | 1044 |
|
---|
| 1045 |
|
---|
[14332] | 1046 | /** @name SUP_IOCTL_CALL_SERVICE
|
---|
| 1047 | * Call the a ring-0 service.
|
---|
| 1048 | *
|
---|
| 1049 | * @todo Might have to convert this to a big request, just like
|
---|
| 1050 | * SUP_IOCTL_CALL_VMMR0
|
---|
| 1051 | * @{
|
---|
| 1052 | */
|
---|
| 1053 | #define SUP_IOCTL_CALL_SERVICE(cbReq) SUP_CTL_CODE_SIZE(22, SUP_IOCTL_CALL_SERVICE_SIZE(cbReq))
|
---|
[54373] | 1054 | #define SUP_IOCTL_CALL_SERVICE_NO_SIZE() SUP_CTL_CODE_SIZE(22, 0)
|
---|
[73097] | 1055 | #define SUP_IOCTL_CALL_SERVICE_SIZE(cbReq) RT_UOFFSETOF_DYN(SUPCALLSERVICE, abReqPkt[cbReq])
|
---|
[14332] | 1056 | #define SUP_IOCTL_CALL_SERVICE_SIZE_IN(cbReq) SUP_IOCTL_CALL_SERVICE_SIZE(cbReq)
|
---|
| 1057 | #define SUP_IOCTL_CALL_SERVICE_SIZE_OUT(cbReq) SUP_IOCTL_CALL_SERVICE_SIZE(cbReq)
|
---|
| 1058 | typedef struct SUPCALLSERVICE
|
---|
| 1059 | {
|
---|
| 1060 | /** The header. */
|
---|
| 1061 | SUPREQHDR Hdr;
|
---|
| 1062 | union
|
---|
| 1063 | {
|
---|
| 1064 | struct
|
---|
| 1065 | {
|
---|
| 1066 | /** The service name. */
|
---|
| 1067 | char szName[28];
|
---|
| 1068 | /** Which operation to execute. */
|
---|
| 1069 | uint32_t uOperation;
|
---|
| 1070 | /** Argument to use when no request packet is supplied. */
|
---|
| 1071 | uint64_t u64Arg;
|
---|
| 1072 | } In;
|
---|
| 1073 | } u;
|
---|
| 1074 | /** The request packet passed to SUP. */
|
---|
| 1075 | uint8_t abReqPkt[1];
|
---|
| 1076 | } SUPCALLSERVICE, *PSUPCALLSERVICE;
|
---|
| 1077 | /** @} */
|
---|
| 1078 |
|
---|
| 1079 |
|
---|
[18191] | 1080 | /** @name SUP_IOCTL_LOGGER_SETTINGS
|
---|
| 1081 | * Changes the ring-0 release or debug logger settings.
|
---|
| 1082 | * @{
|
---|
| 1083 | */
|
---|
[20860] | 1084 | #define SUP_IOCTL_LOGGER_SETTINGS(cbStrTab) SUP_CTL_CODE_SIZE(23, SUP_IOCTL_LOGGER_SETTINGS_SIZE(cbStrTab))
|
---|
[54331] | 1085 | #define SUP_IOCTL_LOGGER_SETTINGS_NO_SIZE() SUP_CTL_CODE_SIZE(23, 0)
|
---|
[73097] | 1086 | #define SUP_IOCTL_LOGGER_SETTINGS_SIZE(cbStrTab) RT_UOFFSETOF_DYN(SUPLOGGERSETTINGS, u.In.szStrings[cbStrTab])
|
---|
| 1087 | #define SUP_IOCTL_LOGGER_SETTINGS_SIZE_IN(cbStrTab) RT_UOFFSETOF_DYN(SUPLOGGERSETTINGS, u.In.szStrings[cbStrTab])
|
---|
[18191] | 1088 | #define SUP_IOCTL_LOGGER_SETTINGS_SIZE_OUT sizeof(SUPREQHDR)
|
---|
| 1089 | typedef struct SUPLOGGERSETTINGS
|
---|
| 1090 | {
|
---|
| 1091 | /** The header. */
|
---|
| 1092 | SUPREQHDR Hdr;
|
---|
| 1093 | union
|
---|
| 1094 | {
|
---|
| 1095 | struct
|
---|
| 1096 | {
|
---|
| 1097 | /** Which logger. */
|
---|
| 1098 | uint32_t fWhich;
|
---|
| 1099 | /** What to do with it. */
|
---|
| 1100 | uint32_t fWhat;
|
---|
| 1101 | /** Offset of the flags setting string. */
|
---|
| 1102 | uint32_t offFlags;
|
---|
| 1103 | /** Offset of the groups setting string. */
|
---|
| 1104 | uint32_t offGroups;
|
---|
| 1105 | /** Offset of the destination setting string. */
|
---|
| 1106 | uint32_t offDestination;
|
---|
| 1107 | /** The string table. */
|
---|
| 1108 | char szStrings[1];
|
---|
| 1109 | } In;
|
---|
| 1110 | } u;
|
---|
| 1111 | } SUPLOGGERSETTINGS, *PSUPLOGGERSETTINGS;
|
---|
| 1112 |
|
---|
| 1113 | /** Debug logger. */
|
---|
| 1114 | #define SUPLOGGERSETTINGS_WHICH_DEBUG 0
|
---|
| 1115 | /** Release logger. */
|
---|
| 1116 | #define SUPLOGGERSETTINGS_WHICH_RELEASE 1
|
---|
| 1117 |
|
---|
| 1118 | /** Change the settings. */
|
---|
| 1119 | #define SUPLOGGERSETTINGS_WHAT_SETTINGS 0
|
---|
| 1120 | /** Create the logger instance. */
|
---|
| 1121 | #define SUPLOGGERSETTINGS_WHAT_CREATE 1
|
---|
| 1122 | /** Destroy the logger instance. */
|
---|
| 1123 | #define SUPLOGGERSETTINGS_WHAT_DESTROY 2
|
---|
| 1124 |
|
---|
| 1125 | /** @} */
|
---|
| 1126 |
|
---|
| 1127 |
|
---|
[19868] | 1128 | /** @name Semaphore Types
|
---|
| 1129 | * @{ */
|
---|
| 1130 | #define SUP_SEM_TYPE_EVENT 0
|
---|
| 1131 | #define SUP_SEM_TYPE_EVENT_MULTI 1
|
---|
| 1132 | /** @} */
|
---|
| 1133 |
|
---|
| 1134 |
|
---|
[33167] | 1135 | /** @name SUP_IOCTL_SEM_OP2
|
---|
| 1136 | * Semaphore operations.
|
---|
| 1137 | * @remarks This replaces the old SUP_IOCTL_SEM_OP interface.
|
---|
| 1138 | * @{
|
---|
| 1139 | */
|
---|
[34972] | 1140 | #define SUP_IOCTL_SEM_OP2 SUP_CTL_CODE_SIZE(24, SUP_IOCTL_SEM_OP2_SIZE)
|
---|
[33167] | 1141 | #define SUP_IOCTL_SEM_OP2_SIZE sizeof(SUPSEMOP2)
|
---|
| 1142 | #define SUP_IOCTL_SEM_OP2_SIZE_IN sizeof(SUPSEMOP2)
|
---|
| 1143 | #define SUP_IOCTL_SEM_OP2_SIZE_OUT sizeof(SUPREQHDR)
|
---|
| 1144 | typedef struct SUPSEMOP2
|
---|
| 1145 | {
|
---|
| 1146 | /** The header. */
|
---|
| 1147 | SUPREQHDR Hdr;
|
---|
| 1148 | union
|
---|
| 1149 | {
|
---|
| 1150 | struct
|
---|
| 1151 | {
|
---|
| 1152 | /** The semaphore type. */
|
---|
| 1153 | uint32_t uType;
|
---|
| 1154 | /** The semaphore handle. */
|
---|
| 1155 | uint32_t hSem;
|
---|
| 1156 | /** The operation. */
|
---|
| 1157 | uint32_t uOp;
|
---|
| 1158 | /** Reserved, must be zero. */
|
---|
| 1159 | uint32_t uReserved;
|
---|
| 1160 | /** The number of milliseconds to wait if it's a wait operation. */
|
---|
| 1161 | union
|
---|
| 1162 | {
|
---|
| 1163 | /** Absolute timeout (RTTime[System]NanoTS).
|
---|
| 1164 | * Used by SUPSEMOP2_WAIT_NS_ABS. */
|
---|
| 1165 | uint64_t uAbsNsTimeout;
|
---|
| 1166 | /** Relative nanosecond timeout.
|
---|
| 1167 | * Used by SUPSEMOP2_WAIT_NS_REL. */
|
---|
| 1168 | uint64_t cRelNsTimeout;
|
---|
| 1169 | /** Relative millisecond timeout.
|
---|
| 1170 | * Used by SUPSEMOP2_WAIT_MS_REL. */
|
---|
| 1171 | uint32_t cRelMsTimeout;
|
---|
| 1172 | /** Generic 64-bit accessor.
|
---|
| 1173 | * ASSUMES little endian! */
|
---|
| 1174 | uint64_t u64;
|
---|
| 1175 | } uArg;
|
---|
| 1176 | } In;
|
---|
| 1177 | } u;
|
---|
| 1178 | } SUPSEMOP2, *PSUPSEMOP2;
|
---|
| 1179 |
|
---|
| 1180 | /** Wait for a number of milliseconds. */
|
---|
| 1181 | #define SUPSEMOP2_WAIT_MS_REL 0
|
---|
| 1182 | /** Wait until the specified deadline is reached. */
|
---|
| 1183 | #define SUPSEMOP2_WAIT_NS_ABS 1
|
---|
| 1184 | /** Wait for a number of nanoseconds. */
|
---|
| 1185 | #define SUPSEMOP2_WAIT_NS_REL 2
|
---|
| 1186 | /** Signal the semaphore. */
|
---|
| 1187 | #define SUPSEMOP2_SIGNAL 3
|
---|
[33540] | 1188 | /** Reset the semaphore (only applicable to SUP_SEM_TYPE_EVENT_MULTI). */
|
---|
[33167] | 1189 | #define SUPSEMOP2_RESET 4
|
---|
| 1190 | /** Close the semaphore handle. */
|
---|
| 1191 | #define SUPSEMOP2_CLOSE 5
|
---|
| 1192 | /** @} */
|
---|
| 1193 |
|
---|
[40819] | 1194 |
|
---|
[33167] | 1195 | /** @name SUP_IOCTL_SEM_OP3
|
---|
| 1196 | * Semaphore operations.
|
---|
| 1197 | * @{
|
---|
| 1198 | */
|
---|
[34972] | 1199 | #define SUP_IOCTL_SEM_OP3 SUP_CTL_CODE_SIZE(25, SUP_IOCTL_SEM_OP3_SIZE)
|
---|
[33167] | 1200 | #define SUP_IOCTL_SEM_OP3_SIZE sizeof(SUPSEMOP3)
|
---|
| 1201 | #define SUP_IOCTL_SEM_OP3_SIZE_IN sizeof(SUPSEMOP3)
|
---|
| 1202 | #define SUP_IOCTL_SEM_OP3_SIZE_OUT sizeof(SUPSEMOP3)
|
---|
| 1203 | typedef struct SUPSEMOP3
|
---|
| 1204 | {
|
---|
| 1205 | /** The header. */
|
---|
| 1206 | SUPREQHDR Hdr;
|
---|
| 1207 | union
|
---|
| 1208 | {
|
---|
| 1209 | struct
|
---|
| 1210 | {
|
---|
| 1211 | /** The semaphore type. */
|
---|
| 1212 | uint32_t uType;
|
---|
| 1213 | /** The semaphore handle. */
|
---|
| 1214 | uint32_t hSem;
|
---|
| 1215 | /** The operation. */
|
---|
| 1216 | uint32_t uOp;
|
---|
| 1217 | /** Reserved, must be zero. */
|
---|
| 1218 | uint32_t u32Reserved;
|
---|
| 1219 | /** Reserved for future use. */
|
---|
| 1220 | uint64_t u64Reserved;
|
---|
| 1221 | } In;
|
---|
| 1222 | union
|
---|
| 1223 | {
|
---|
| 1224 | /** The handle of the created semaphore.
|
---|
| 1225 | * Used by SUPSEMOP3_CREATE. */
|
---|
| 1226 | uint32_t hSem;
|
---|
| 1227 | /** The semaphore resolution in nano seconds.
|
---|
| 1228 | * Used by SUPSEMOP3_GET_RESOLUTION. */
|
---|
| 1229 | uint32_t cNsResolution;
|
---|
| 1230 | /** The 32-bit view. */
|
---|
| 1231 | uint32_t u32;
|
---|
| 1232 | /** Reserved some space for later expansion. */
|
---|
| 1233 | uint64_t u64Reserved;
|
---|
| 1234 | } Out;
|
---|
| 1235 | } u;
|
---|
| 1236 | } SUPSEMOP3, *PSUPSEMOP3;
|
---|
| 1237 |
|
---|
| 1238 | /** Get the wait resolution. */
|
---|
| 1239 | #define SUPSEMOP3_CREATE 0
|
---|
| 1240 | /** Get the wait resolution. */
|
---|
| 1241 | #define SUPSEMOP3_GET_RESOLUTION 1
|
---|
| 1242 | /** @} */
|
---|
| 1243 |
|
---|
[40819] | 1244 |
|
---|
[32358] | 1245 | /** @name SUP_IOCTL_VT_CAPS
|
---|
| 1246 | * Get the VT-x/AMD-V capabilities.
|
---|
| 1247 | *
|
---|
| 1248 | * @todo Intended for main, which means we need to relax the privilege requires
|
---|
| 1249 | * when accessing certain vboxdrv functions.
|
---|
| 1250 | *
|
---|
[23699] | 1251 | * @{
|
---|
| 1252 | */
|
---|
| 1253 | #define SUP_IOCTL_VT_CAPS SUP_CTL_CODE_SIZE(26, SUP_IOCTL_VT_CAPS_SIZE)
|
---|
| 1254 | #define SUP_IOCTL_VT_CAPS_SIZE sizeof(SUPVTCAPS)
|
---|
| 1255 | #define SUP_IOCTL_VT_CAPS_SIZE_IN sizeof(SUPREQHDR)
|
---|
| 1256 | #define SUP_IOCTL_VT_CAPS_SIZE_OUT sizeof(SUPVTCAPS)
|
---|
| 1257 | typedef struct SUPVTCAPS
|
---|
| 1258 | {
|
---|
| 1259 | /** The header. */
|
---|
| 1260 | SUPREQHDR Hdr;
|
---|
| 1261 | union
|
---|
| 1262 | {
|
---|
| 1263 | struct
|
---|
| 1264 | {
|
---|
| 1265 | /** The VT capability dword. */
|
---|
[70917] | 1266 | uint32_t fCaps;
|
---|
[23699] | 1267 | } Out;
|
---|
| 1268 | } u;
|
---|
| 1269 | } SUPVTCAPS, *PSUPVTCAPS;
|
---|
| 1270 | /** @} */
|
---|
[19868] | 1271 |
|
---|
[40819] | 1272 |
|
---|
| 1273 | /** @name SUP_IOCTL_TRACER_OPEN
|
---|
| 1274 | * Open the tracer.
|
---|
| 1275 | *
|
---|
| 1276 | * Should be matched by an SUP_IOCTL_TRACER_CLOSE call.
|
---|
| 1277 | *
|
---|
| 1278 | * @{
|
---|
| 1279 | */
|
---|
| 1280 | #define SUP_IOCTL_TRACER_OPEN SUP_CTL_CODE_SIZE(28, SUP_IOCTL_TRACER_OPEN_SIZE)
|
---|
| 1281 | #define SUP_IOCTL_TRACER_OPEN_SIZE sizeof(SUPTRACEROPEN)
|
---|
| 1282 | #define SUP_IOCTL_TRACER_OPEN_SIZE_IN sizeof(SUPTRACEROPEN)
|
---|
| 1283 | #define SUP_IOCTL_TRACER_OPEN_SIZE_OUT sizeof(SUPREQHDR)
|
---|
| 1284 | typedef struct SUPTRACEROPEN
|
---|
| 1285 | {
|
---|
| 1286 | /** The header. */
|
---|
| 1287 | SUPREQHDR Hdr;
|
---|
| 1288 | union
|
---|
| 1289 | {
|
---|
| 1290 | struct
|
---|
| 1291 | {
|
---|
| 1292 | /** Tracer cookie. Used to make sure we only open a matching tracer. */
|
---|
| 1293 | uint32_t uCookie;
|
---|
| 1294 | /** Tracer specific argument. */
|
---|
| 1295 | RTHCUINTPTR uArg;
|
---|
| 1296 | } In;
|
---|
| 1297 | } u;
|
---|
| 1298 | } SUPTRACEROPEN, *PSUPTRACEROPEN;
|
---|
| 1299 | /** @} */
|
---|
| 1300 |
|
---|
| 1301 |
|
---|
| 1302 | /** @name SUP_IOCTL_TRACER_CLOSE
|
---|
| 1303 | * Close the tracer.
|
---|
| 1304 | *
|
---|
| 1305 | * Must match a SUP_IOCTL_TRACER_OPEN call.
|
---|
| 1306 | *
|
---|
| 1307 | * @{
|
---|
| 1308 | */
|
---|
| 1309 | #define SUP_IOCTL_TRACER_CLOSE SUP_CTL_CODE_SIZE(29, SUP_IOCTL_TRACER_CLOSE_SIZE)
|
---|
| 1310 | #define SUP_IOCTL_TRACER_CLOSE_SIZE sizeof(SUPREQHDR)
|
---|
| 1311 | #define SUP_IOCTL_TRACER_CLOSE_SIZE_IN sizeof(SUPREQHDR)
|
---|
| 1312 | #define SUP_IOCTL_TRACER_CLOSE_SIZE_OUT sizeof(SUPREQHDR)
|
---|
| 1313 | /** @} */
|
---|
| 1314 |
|
---|
| 1315 |
|
---|
| 1316 | /** @name SUP_IOCTL_TRACER_IOCTL
|
---|
| 1317 | * Speak UNIX ioctl() with the tracer.
|
---|
| 1318 | *
|
---|
| 1319 | * The session must have opened the tracer prior to issuing this request.
|
---|
| 1320 | *
|
---|
| 1321 | * @{
|
---|
| 1322 | */
|
---|
| 1323 | #define SUP_IOCTL_TRACER_IOCTL SUP_CTL_CODE_SIZE(30, SUP_IOCTL_TRACER_IOCTL_SIZE)
|
---|
| 1324 | #define SUP_IOCTL_TRACER_IOCTL_SIZE sizeof(SUPTRACERIOCTL)
|
---|
| 1325 | #define SUP_IOCTL_TRACER_IOCTL_SIZE_IN sizeof(SUPTRACERIOCTL)
|
---|
| 1326 | #define SUP_IOCTL_TRACER_IOCTL_SIZE_OUT (RT_UOFFSETOF(SUPTRACERIOCTL, u.Out.iRetVal) + sizeof(int32_t))
|
---|
| 1327 | typedef struct SUPTRACERIOCTL
|
---|
| 1328 | {
|
---|
| 1329 | /** The header. */
|
---|
| 1330 | SUPREQHDR Hdr;
|
---|
| 1331 | union
|
---|
| 1332 | {
|
---|
| 1333 | struct
|
---|
| 1334 | {
|
---|
| 1335 | /** The command. */
|
---|
| 1336 | RTHCUINTPTR uCmd;
|
---|
| 1337 | /** Argument to the command. */
|
---|
| 1338 | RTHCUINTPTR uArg;
|
---|
| 1339 | } In;
|
---|
| 1340 |
|
---|
| 1341 | struct
|
---|
| 1342 | {
|
---|
| 1343 | /** The return value. */
|
---|
| 1344 | int32_t iRetVal;
|
---|
| 1345 | } Out;
|
---|
| 1346 | } u;
|
---|
| 1347 | } SUPTRACERIOCTL, *PSUPTRACERIOCTL;
|
---|
| 1348 | /** @} */
|
---|
| 1349 |
|
---|
| 1350 |
|
---|
[40981] | 1351 | /** @name SUP_IOCTL_TRACER_UMOD_REG
|
---|
| 1352 | * Registers tracepoints in a user mode module.
|
---|
| 1353 | *
|
---|
| 1354 | * @{
|
---|
| 1355 | */
|
---|
[40982] | 1356 | #define SUP_IOCTL_TRACER_UMOD_REG SUP_CTL_CODE_SIZE(31, SUP_IOCTL_TRACER_UMOD_REG_SIZE)
|
---|
[40981] | 1357 | #define SUP_IOCTL_TRACER_UMOD_REG_SIZE sizeof(SUPTRACERUMODREG)
|
---|
| 1358 | #define SUP_IOCTL_TRACER_UMOD_REG_SIZE_IN sizeof(SUPTRACERUMODREG)
|
---|
| 1359 | #define SUP_IOCTL_TRACER_UMOD_REG_SIZE_OUT sizeof(SUPREQHDR)
|
---|
| 1360 | typedef struct SUPTRACERUMODREG
|
---|
| 1361 | {
|
---|
| 1362 | /** The header. */
|
---|
| 1363 | SUPREQHDR Hdr;
|
---|
| 1364 | union
|
---|
| 1365 | {
|
---|
| 1366 | struct
|
---|
| 1367 | {
|
---|
[41117] | 1368 | /** The address at which the VTG header actually resides.
|
---|
| 1369 | * This will differ from R3PtrVtgHdr for raw-mode context
|
---|
| 1370 | * modules. */
|
---|
| 1371 | RTUINTPTR uVtgHdrAddr;
|
---|
| 1372 | /** The ring-3 pointer of the VTG header. */
|
---|
| 1373 | RTR3PTR R3PtrVtgHdr;
|
---|
| 1374 | /** The ring-3 pointer of the probe location string table. */
|
---|
| 1375 | RTR3PTR R3PtrStrTab;
|
---|
| 1376 | /** The size of the string table. */
|
---|
| 1377 | uint32_t cbStrTab;
|
---|
[40981] | 1378 | /** Future flags, MBZ. */
|
---|
| 1379 | uint32_t fFlags;
|
---|
| 1380 | /** The module name. */
|
---|
| 1381 | char szName[64];
|
---|
| 1382 | } In;
|
---|
| 1383 | } u;
|
---|
| 1384 | } SUPTRACERUMODREG, *PSUPTRACERUMODREG;
|
---|
| 1385 | /** @} */
|
---|
| 1386 |
|
---|
| 1387 |
|
---|
| 1388 | /** @name SUP_IOCTL_TRACER_UMOD_DEREG
|
---|
| 1389 | * Deregisters tracepoints in a user mode module.
|
---|
| 1390 | *
|
---|
| 1391 | * @{
|
---|
| 1392 | */
|
---|
[40982] | 1393 | #define SUP_IOCTL_TRACER_UMOD_DEREG SUP_CTL_CODE_SIZE(32, SUP_IOCTL_TRACER_UMOD_DEREG_SIZE)
|
---|
[40981] | 1394 | #define SUP_IOCTL_TRACER_UMOD_DEREG_SIZE sizeof(SUPTRACERUMODDEREG)
|
---|
| 1395 | #define SUP_IOCTL_TRACER_UMOD_DEREG_SIZE_IN sizeof(SUPTRACERUMODDEREG)
|
---|
| 1396 | #define SUP_IOCTL_TRACER_UMOD_DEREG_SIZE_OUT sizeof(SUPREQHDR)
|
---|
| 1397 | typedef struct SUPTRACERUMODDEREG
|
---|
| 1398 | {
|
---|
| 1399 | /** The header. */
|
---|
| 1400 | SUPREQHDR Hdr;
|
---|
| 1401 | union
|
---|
| 1402 | {
|
---|
| 1403 | struct
|
---|
| 1404 | {
|
---|
| 1405 | /** Pointer to the VTG header. */
|
---|
| 1406 | RTR3PTR pVtgHdr;
|
---|
| 1407 | } In;
|
---|
| 1408 | } u;
|
---|
| 1409 | } SUPTRACERUMODDEREG, *PSUPTRACERUMODDEREG;
|
---|
| 1410 | /** @} */
|
---|
| 1411 |
|
---|
| 1412 |
|
---|
[41117] | 1413 | /** @name SUP_IOCTL_TRACER_UMOD_FIRE_PROBE
|
---|
| 1414 | * Fire a probe in a user tracepoint module.
|
---|
| 1415 | *
|
---|
| 1416 | * @{
|
---|
| 1417 | */
|
---|
| 1418 | #define SUP_IOCTL_TRACER_UMOD_FIRE_PROBE SUP_CTL_CODE_SIZE(33, SUP_IOCTL_TRACER_UMOD_FIRE_PROBE_SIZE)
|
---|
| 1419 | #define SUP_IOCTL_TRACER_UMOD_FIRE_PROBE_SIZE sizeof(SUPTRACERUMODFIREPROBE)
|
---|
| 1420 | #define SUP_IOCTL_TRACER_UMOD_FIRE_PROBE_SIZE_IN sizeof(SUPTRACERUMODFIREPROBE)
|
---|
| 1421 | #define SUP_IOCTL_TRACER_UMOD_FIRE_PROBE_SIZE_OUT sizeof(SUPREQHDR)
|
---|
| 1422 | typedef struct SUPTRACERUMODFIREPROBE
|
---|
| 1423 | {
|
---|
| 1424 | /** The header. */
|
---|
| 1425 | SUPREQHDR Hdr;
|
---|
| 1426 | union
|
---|
| 1427 | {
|
---|
| 1428 | SUPDRVTRACERUSRCTX In;
|
---|
| 1429 | } u;
|
---|
| 1430 | } SUPTRACERUMODFIREPROBE, *PSUPTRACERUMODFIREPROBE;
|
---|
| 1431 | /** @} */
|
---|
| 1432 |
|
---|
| 1433 |
|
---|
[49634] | 1434 | /** @name SUP_IOCTL_MSR_PROBER
|
---|
| 1435 | * MSR probing interface, not available in normal builds.
|
---|
| 1436 | *
|
---|
| 1437 | * @{
|
---|
| 1438 | */
|
---|
| 1439 | #define SUP_IOCTL_MSR_PROBER SUP_CTL_CODE_SIZE(34, SUP_IOCTL_MSR_PROBER_SIZE)
|
---|
| 1440 | #define SUP_IOCTL_MSR_PROBER_SIZE sizeof(SUPMSRPROBER)
|
---|
| 1441 | #define SUP_IOCTL_MSR_PROBER_SIZE_IN sizeof(SUPMSRPROBER)
|
---|
| 1442 | #define SUP_IOCTL_MSR_PROBER_SIZE_OUT sizeof(SUPMSRPROBER)
|
---|
| 1443 |
|
---|
| 1444 | typedef enum SUPMSRPROBEROP
|
---|
| 1445 | {
|
---|
| 1446 | SUPMSRPROBEROP_INVALID = 0, /**< The customary invalid zero value. */
|
---|
| 1447 | SUPMSRPROBEROP_READ, /**< Read an MSR. */
|
---|
| 1448 | SUPMSRPROBEROP_WRITE, /**< Write a value to an MSR (use with care!). */
|
---|
| 1449 | SUPMSRPROBEROP_MODIFY, /**< Read-modify-restore-flushall. */
|
---|
| 1450 | SUPMSRPROBEROP_MODIFY_FASTER, /**< Read-modify-restore, skip the flushing. */
|
---|
| 1451 | SUPMSRPROBEROP_END, /**< End of valid values. */
|
---|
| 1452 | SUPMSRPROBEROP_32BIT_HACK = 0x7fffffff /**< The customary 32-bit type hack. */
|
---|
| 1453 | } SUPMSRPROBEROP;
|
---|
| 1454 |
|
---|
| 1455 | typedef struct SUPMSRPROBER
|
---|
| 1456 | {
|
---|
| 1457 | /** The header. */
|
---|
| 1458 | SUPREQHDR Hdr;
|
---|
| 1459 |
|
---|
| 1460 | /** Input/output union. */
|
---|
| 1461 | union
|
---|
| 1462 | {
|
---|
| 1463 | /** Inputs. */
|
---|
| 1464 | struct
|
---|
| 1465 | {
|
---|
| 1466 | /** The operation. */
|
---|
| 1467 | SUPMSRPROBEROP enmOp;
|
---|
| 1468 | /** The MSR to test. */
|
---|
| 1469 | uint32_t uMsr;
|
---|
| 1470 | /** The CPU to perform the operation on.
|
---|
| 1471 | * Use UINT32_MAX to indicate that any CPU will do. */
|
---|
| 1472 | uint32_t idCpu;
|
---|
| 1473 | /** Alignment padding. */
|
---|
| 1474 | uint32_t u32Padding;
|
---|
| 1475 | /** Operation specific arguments. */
|
---|
| 1476 | union
|
---|
| 1477 | {
|
---|
| 1478 | /* SUPMSRPROBEROP_READ takes no extra arguments. */
|
---|
| 1479 |
|
---|
| 1480 | /** For SUPMSRPROBEROP_WRITE. */
|
---|
| 1481 | struct
|
---|
| 1482 | {
|
---|
| 1483 | /** The value to write. */
|
---|
| 1484 | uint64_t uToWrite;
|
---|
| 1485 | } Write;
|
---|
| 1486 |
|
---|
| 1487 | /** For SUPMSRPROBEROP_MODIFY and SUPMSRPROBEROP_MODIFY_FASTER. */
|
---|
| 1488 | struct
|
---|
| 1489 | {
|
---|
| 1490 | /** The value to AND the current MSR value with to construct the value to
|
---|
| 1491 | * write. This applied first. */
|
---|
| 1492 | uint64_t fAndMask;
|
---|
| 1493 | /** The value to OR the result of the above mentioned AND operation with
|
---|
| 1494 | * attempting to modify the MSR. */
|
---|
| 1495 | uint64_t fOrMask;
|
---|
| 1496 | } Modify;
|
---|
| 1497 |
|
---|
[58340] | 1498 | /** Reserve space for the future. */
|
---|
[49634] | 1499 | uint64_t auPadding[3];
|
---|
| 1500 | } uArgs;
|
---|
| 1501 | } In;
|
---|
| 1502 |
|
---|
| 1503 | /** Outputs. */
|
---|
| 1504 | struct
|
---|
| 1505 | {
|
---|
| 1506 | /** Operation specific results. */
|
---|
| 1507 | union
|
---|
| 1508 | {
|
---|
| 1509 | /** For SUPMSRPROBEROP_READ. */
|
---|
| 1510 | struct
|
---|
| 1511 | {
|
---|
| 1512 | /** The value we've read. */
|
---|
| 1513 | uint64_t uValue;
|
---|
| 1514 | /** Set if we GPed while reading it. */
|
---|
| 1515 | bool fGp;
|
---|
| 1516 | } Read;
|
---|
| 1517 |
|
---|
| 1518 | /** For SUPMSRPROBEROP_WRITE. */
|
---|
| 1519 | struct
|
---|
| 1520 | {
|
---|
| 1521 | /** Set if we GPed while writing it. */
|
---|
| 1522 | bool fGp;
|
---|
| 1523 | } Write;
|
---|
| 1524 |
|
---|
| 1525 | /** For SUPMSRPROBEROP_MODIFY and SUPMSRPROBEROP_MODIFY_FASTER. */
|
---|
| 1526 | SUPMSRPROBERMODIFYRESULT Modify;
|
---|
| 1527 |
|
---|
| 1528 | /** Size padding/aligning. */
|
---|
| 1529 | uint64_t auPadding[5];
|
---|
| 1530 | } uResults;
|
---|
| 1531 | } Out;
|
---|
| 1532 | } u;
|
---|
| 1533 | } SUPMSRPROBER, *PSUPMSRPROBER;
|
---|
| 1534 | AssertCompileMemberAlignment(SUPMSRPROBER, u, 8);
|
---|
| 1535 | AssertCompileMemberAlignment(SUPMSRPROBER, u.In.uArgs, 8);
|
---|
| 1536 | AssertCompileMembersSameSizeAndOffset(SUPMSRPROBER, u.In, SUPMSRPROBER, u.Out);
|
---|
| 1537 | /** @} */
|
---|
| 1538 |
|
---|
[49965] | 1539 | /** @name SUP_IOCTL_RESUME_SUSPENDED_KBDS
|
---|
| 1540 | * Resume suspended keyboard devices if any found in the system.
|
---|
[49787] | 1541 | *
|
---|
| 1542 | * @{
|
---|
| 1543 | */
|
---|
[49965] | 1544 | #define SUP_IOCTL_RESUME_SUSPENDED_KBDS SUP_CTL_CODE_SIZE(35, SUP_IOCTL_RESUME_SUSPENDED_KBDS_SIZE)
|
---|
| 1545 | #define SUP_IOCTL_RESUME_SUSPENDED_KBDS_SIZE sizeof(SUPREQHDR)
|
---|
| 1546 | #define SUP_IOCTL_RESUME_SUSPENDED_KBDS_SIZE_IN sizeof(SUPREQHDR)
|
---|
| 1547 | #define SUP_IOCTL_RESUME_SUSPENDED_KBDS_SIZE_OUT sizeof(SUPREQHDR)
|
---|
[49787] | 1548 | /** @} */
|
---|
[49634] | 1549 |
|
---|
[49787] | 1550 |
|
---|
[53063] | 1551 | /** @name SUP_IOCTL_TSC_DELTA_MEASURE
|
---|
| 1552 | * Measure the TSC-delta between the specified CPU and the master TSC.
|
---|
| 1553 | *
|
---|
[54252] | 1554 | * To call this I/O control, the client must first have mapped the GIP.
|
---|
| 1555 | *
|
---|
[53063] | 1556 | * @{
|
---|
| 1557 | */
|
---|
| 1558 | #define SUP_IOCTL_TSC_DELTA_MEASURE SUP_CTL_CODE_SIZE(36, SUP_IOCTL_TSC_DELTA_MEASURE_SIZE)
|
---|
| 1559 | #define SUP_IOCTL_TSC_DELTA_MEASURE_SIZE sizeof(SUPTSCDELTAMEASURE)
|
---|
| 1560 | #define SUP_IOCTL_TSC_DELTA_MEASURE_SIZE_IN sizeof(SUPTSCDELTAMEASURE)
|
---|
| 1561 | #define SUP_IOCTL_TSC_DELTA_MEASURE_SIZE_OUT sizeof(SUPREQHDR)
|
---|
| 1562 | typedef struct SUPTSCDELTAMEASURE
|
---|
| 1563 | {
|
---|
| 1564 | /** The header. */
|
---|
| 1565 | SUPREQHDR Hdr;
|
---|
| 1566 |
|
---|
| 1567 | /** Input/output union. */
|
---|
| 1568 | union
|
---|
| 1569 | {
|
---|
| 1570 | struct
|
---|
| 1571 | {
|
---|
| 1572 | /** Which CPU to take the TSC-delta measurement for. */
|
---|
| 1573 | RTCPUID idCpu;
|
---|
| 1574 | /** Number of times to retry on failure (specify 0 for default). */
|
---|
| 1575 | uint8_t cRetries;
|
---|
| 1576 | /** Number of milliseconds to wait before each retry. */
|
---|
| 1577 | uint8_t cMsWaitRetry;
|
---|
| 1578 | /** Whether to force taking a measurement if one exists already. */
|
---|
| 1579 | bool fForce;
|
---|
| 1580 | /** Whether to do the measurement asynchronously (if possible). */
|
---|
| 1581 | bool fAsync;
|
---|
| 1582 | } In;
|
---|
| 1583 | } u;
|
---|
| 1584 | } SUPTSCDELTAMEASURE, *PSUPTSCDELTAMEASURE;
|
---|
| 1585 | AssertCompileMemberAlignment(SUPTSCDELTAMEASURE, u, 8);
|
---|
[54252] | 1586 | AssertCompileSize(SUPTSCDELTAMEASURE, 6*4 + 4+1+1+1+1);
|
---|
[53063] | 1587 | /** @} */
|
---|
| 1588 |
|
---|
[57218] | 1589 |
|
---|
[53212] | 1590 | /** @name SUP_IOCTL_TSC_READ
|
---|
[54224] | 1591 | * Reads the TSC and apply TSC-delta if applicable, determining the delta if
|
---|
| 1592 | * necessary (i64TSCDelta = INT64_MAX).
|
---|
[53212] | 1593 | *
|
---|
[54224] | 1594 | * This latter function is the primary use case of this I/O control. To call
|
---|
| 1595 | * this I/O control, the client must first have mapped the GIP.
|
---|
| 1596 | *
|
---|
[53212] | 1597 | * @{
|
---|
| 1598 | */
|
---|
| 1599 | #define SUP_IOCTL_TSC_READ SUP_CTL_CODE_SIZE(37, SUP_IOCTL_TSC_READ_SIZE)
|
---|
| 1600 | #define SUP_IOCTL_TSC_READ_SIZE sizeof(SUPTSCREAD)
|
---|
[55409] | 1601 | #define SUP_IOCTL_TSC_READ_SIZE_IN sizeof(SUPREQHDR)
|
---|
| 1602 | #define SUP_IOCTL_TSC_READ_SIZE_OUT sizeof(SUPTSCREAD)
|
---|
[53212] | 1603 | typedef struct SUPTSCREAD
|
---|
| 1604 | {
|
---|
| 1605 | /** The header. */
|
---|
| 1606 | SUPREQHDR Hdr;
|
---|
[53063] | 1607 |
|
---|
[53212] | 1608 | /** Input/output union. */
|
---|
| 1609 | union
|
---|
| 1610 | {
|
---|
| 1611 | struct
|
---|
| 1612 | {
|
---|
| 1613 | /** The TSC after applying the relevant delta. */
|
---|
| 1614 | uint64_t u64AdjustedTsc;
|
---|
| 1615 | /** The APIC Id of the CPU where the TSC was read. */
|
---|
| 1616 | uint16_t idApic;
|
---|
[54252] | 1617 | /** Explicit alignment padding. */
|
---|
| 1618 | uint16_t auPadding[3];
|
---|
[53212] | 1619 | } Out;
|
---|
| 1620 | } u;
|
---|
| 1621 | } SUPTSCREAD, *PSUPTSCREAD;
|
---|
| 1622 | AssertCompileMemberAlignment(SUPTSCREAD, u, 8);
|
---|
[54252] | 1623 | AssertCompileSize(SUPTSCREAD, 6*4 + 2*8);
|
---|
[53212] | 1624 | /** @} */
|
---|
| 1625 |
|
---|
[57218] | 1626 |
|
---|
| 1627 | /** @name SUP_IOCTL_GIP_SET_FLAGS
|
---|
| 1628 | * Set GIP flags.
|
---|
| 1629 | *
|
---|
| 1630 | * @{
|
---|
| 1631 | */
|
---|
| 1632 | #define SUP_IOCTL_GIP_SET_FLAGS SUP_CTL_CODE_SIZE(39, SUP_IOCTL_GIP_SET_FLAGS_SIZE)
|
---|
| 1633 | #define SUP_IOCTL_GIP_SET_FLAGS_SIZE sizeof(SUPGIPSETFLAGS)
|
---|
| 1634 | #define SUP_IOCTL_GIP_SET_FLAGS_SIZE_IN sizeof(SUPGIPSETFLAGS)
|
---|
| 1635 | #define SUP_IOCTL_GIP_SET_FLAGS_SIZE_OUT sizeof(SUPREQHDR)
|
---|
| 1636 | typedef struct SUPGIPSETFLAGS
|
---|
| 1637 | {
|
---|
| 1638 | /** The header. */
|
---|
| 1639 | SUPREQHDR Hdr;
|
---|
| 1640 | union
|
---|
| 1641 | {
|
---|
| 1642 | struct
|
---|
| 1643 | {
|
---|
| 1644 | /** The AND flags mask, see SUPGIP_FLAGS_XXX. */
|
---|
| 1645 | uint32_t fAndMask;
|
---|
| 1646 | /** The OR flags mask, see SUPGIP_FLAGS_XXX. */
|
---|
| 1647 | uint32_t fOrMask;
|
---|
| 1648 | } In;
|
---|
| 1649 | } u;
|
---|
| 1650 | } SUPGIPSETFLAGS, *PSUPGIPSETFLAGS;
|
---|
| 1651 | /** @} */
|
---|
| 1652 |
|
---|
[67821] | 1653 |
|
---|
| 1654 | /** @name SUP_IOCTL_UCODE_REV
|
---|
| 1655 | * Get the CPU microcode revision.
|
---|
| 1656 | *
|
---|
| 1657 | * @{
|
---|
| 1658 | */
|
---|
[76281] | 1659 | #define SUP_IOCTL_UCODE_REV SUP_CTL_CODE_SIZE(40, SUP_IOCTL_UCODE_REV_SIZE)
|
---|
[67821] | 1660 | #define SUP_IOCTL_UCODE_REV_SIZE sizeof(SUPUCODEREV)
|
---|
| 1661 | #define SUP_IOCTL_UCODE_REV_SIZE_IN sizeof(SUPREQHDR)
|
---|
| 1662 | #define SUP_IOCTL_UCODE_REV_SIZE_OUT sizeof(SUPUCODEREV)
|
---|
| 1663 | typedef struct SUPUCODEREV
|
---|
| 1664 | {
|
---|
| 1665 | /** The header. */
|
---|
| 1666 | SUPREQHDR Hdr;
|
---|
| 1667 | union
|
---|
| 1668 | {
|
---|
| 1669 | struct
|
---|
| 1670 | {
|
---|
| 1671 | /** The microcode revision dword. */
|
---|
| 1672 | uint32_t MicrocodeRev;
|
---|
| 1673 | } Out;
|
---|
| 1674 | } u;
|
---|
| 1675 | } SUPUCODEREV, *PSUPUCODEREV;
|
---|
| 1676 | /** @} */
|
---|
| 1677 |
|
---|
| 1678 |
|
---|
[76461] | 1679 | /** @name SUP_IOCTL_HWVIRT_MSRS
|
---|
| 1680 | * Get hardware-virtualization MSRs.
|
---|
| 1681 | *
|
---|
| 1682 | * This queries a lot more information than merely VT-x/AMD-V basic capabilities
|
---|
| 1683 | * provided by SUP_IOCTL_VT_CAPS.
|
---|
[81369] | 1684 | *
|
---|
| 1685 | * @{
|
---|
[76461] | 1686 | */
|
---|
| 1687 | #define SUP_IOCTL_GET_HWVIRT_MSRS SUP_CTL_CODE_SIZE(41, SUP_IOCTL_GET_HWVIRT_MSRS_SIZE)
|
---|
| 1688 | #define SUP_IOCTL_GET_HWVIRT_MSRS_SIZE sizeof(SUPGETHWVIRTMSRS)
|
---|
| 1689 | #define SUP_IOCTL_GET_HWVIRT_MSRS_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPGETHWVIRTMSRS, u.In))
|
---|
| 1690 | #define SUP_IOCTL_GET_HWVIRT_MSRS_SIZE_OUT sizeof(SUPGETHWVIRTMSRS)
|
---|
| 1691 |
|
---|
| 1692 | typedef struct SUPGETHWVIRTMSRS
|
---|
| 1693 | {
|
---|
| 1694 | /** The header. */
|
---|
| 1695 | SUPREQHDR Hdr;
|
---|
| 1696 | union
|
---|
| 1697 | {
|
---|
| 1698 | struct
|
---|
| 1699 | {
|
---|
| 1700 | /** Whether to force re-querying of MSRs. */
|
---|
| 1701 | bool fForce;
|
---|
| 1702 | /** Reserved. Must be false. */
|
---|
| 1703 | bool fReserved0;
|
---|
| 1704 | /** Reserved. Must be false. */
|
---|
| 1705 | bool fReserved1;
|
---|
| 1706 | /** Reserved. Must be false. */
|
---|
| 1707 | bool fReserved2;
|
---|
| 1708 | } In;
|
---|
| 1709 |
|
---|
| 1710 | struct
|
---|
| 1711 | {
|
---|
| 1712 | /** Hardware-virtualization MSRs. */
|
---|
| 1713 | SUPHWVIRTMSRS HwvirtMsrs;
|
---|
| 1714 | } Out;
|
---|
| 1715 | } u;
|
---|
| 1716 | } SUPGETHWVIRTMSRS, *PSUPGETHWVIRTMSRS;
|
---|
| 1717 | /** @} */
|
---|
| 1718 |
|
---|
| 1719 |
|
---|
[87233] | 1720 | #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
|
---|
| 1721 | # pragma pack() /* paranoia */
|
---|
| 1722 | #endif
|
---|
[1] | 1723 |
|
---|
[76568] | 1724 | #endif /* !VBOX_INCLUDED_SRC_Support_SUPDrvIOC_h */
|
---|
[1] | 1725 |
|
---|