1 | /** @file
|
---|
2 | * SUP - Support Library. (HDrv)
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2017 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef ___VBox_sup_h
|
---|
27 | #define ___VBox_sup_h
|
---|
28 |
|
---|
29 | #include <VBox/cdefs.h>
|
---|
30 | #include <VBox/types.h>
|
---|
31 | #include <VBox/err.h>
|
---|
32 | #include <iprt/assert.h>
|
---|
33 | #include <iprt/stdarg.h>
|
---|
34 | #include <iprt/cpuset.h>
|
---|
35 | #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
|
---|
36 | # include <iprt/asm-amd64-x86.h>
|
---|
37 | #endif
|
---|
38 |
|
---|
39 | RT_C_DECLS_BEGIN
|
---|
40 |
|
---|
41 | struct VTGOBJHDR;
|
---|
42 | struct VTGPROBELOC;
|
---|
43 |
|
---|
44 |
|
---|
45 | /** @defgroup grp_sup The Support Library API
|
---|
46 | * @{
|
---|
47 | */
|
---|
48 |
|
---|
49 | /**
|
---|
50 | * Physical page descriptor.
|
---|
51 | */
|
---|
52 | #pragma pack(4) /* space is more important. */
|
---|
53 | typedef struct SUPPAGE
|
---|
54 | {
|
---|
55 | /** Physical memory address. */
|
---|
56 | RTHCPHYS Phys;
|
---|
57 | /** Reserved entry for internal use by the caller. */
|
---|
58 | RTHCUINTPTR uReserved;
|
---|
59 | } SUPPAGE;
|
---|
60 | #pragma pack()
|
---|
61 | /** Pointer to a page descriptor. */
|
---|
62 | typedef SUPPAGE *PSUPPAGE;
|
---|
63 | /** Pointer to a const page descriptor. */
|
---|
64 | typedef const SUPPAGE *PCSUPPAGE;
|
---|
65 |
|
---|
66 | /**
|
---|
67 | * The paging mode.
|
---|
68 | *
|
---|
69 | * @remarks Users are making assumptions about the order here!
|
---|
70 | */
|
---|
71 | typedef enum SUPPAGINGMODE
|
---|
72 | {
|
---|
73 | /** The usual invalid entry.
|
---|
74 | * This is returned by SUPR3GetPagingMode() */
|
---|
75 | SUPPAGINGMODE_INVALID = 0,
|
---|
76 | /** Normal 32-bit paging, no global pages */
|
---|
77 | SUPPAGINGMODE_32_BIT,
|
---|
78 | /** Normal 32-bit paging with global pages. */
|
---|
79 | SUPPAGINGMODE_32_BIT_GLOBAL,
|
---|
80 | /** PAE mode, no global pages, no NX. */
|
---|
81 | SUPPAGINGMODE_PAE,
|
---|
82 | /** PAE mode with global pages. */
|
---|
83 | SUPPAGINGMODE_PAE_GLOBAL,
|
---|
84 | /** PAE mode with NX, no global pages. */
|
---|
85 | SUPPAGINGMODE_PAE_NX,
|
---|
86 | /** PAE mode with global pages and NX. */
|
---|
87 | SUPPAGINGMODE_PAE_GLOBAL_NX,
|
---|
88 | /** AMD64 mode, no global pages. */
|
---|
89 | SUPPAGINGMODE_AMD64,
|
---|
90 | /** AMD64 mode with global pages, no NX. */
|
---|
91 | SUPPAGINGMODE_AMD64_GLOBAL,
|
---|
92 | /** AMD64 mode with NX, no global pages. */
|
---|
93 | SUPPAGINGMODE_AMD64_NX,
|
---|
94 | /** AMD64 mode with global pages and NX. */
|
---|
95 | SUPPAGINGMODE_AMD64_GLOBAL_NX
|
---|
96 | } SUPPAGINGMODE;
|
---|
97 |
|
---|
98 |
|
---|
99 | /** @name Flags returned by SUPR0GetKernelFeatures().
|
---|
100 | * @{
|
---|
101 | */
|
---|
102 | /** GDT is read-only. */
|
---|
103 | #define SUPKERNELFEATURES_GDT_READ_ONLY RT_BIT(0)
|
---|
104 | /** SMAP is possibly enabled. */
|
---|
105 | #define SUPKERNELFEATURES_SMAP RT_BIT(1)
|
---|
106 | /** GDT is read-only but the writable GDT can be fetched by SUPR0GetCurrentGdtRw(). */
|
---|
107 | #define SUPKERNELFEATURES_GDT_NEED_WRITABLE RT_BIT(2)
|
---|
108 | /** @} */
|
---|
109 |
|
---|
110 |
|
---|
111 | /**
|
---|
112 | * Usermode probe context information.
|
---|
113 | */
|
---|
114 | typedef struct SUPDRVTRACERUSRCTX
|
---|
115 | {
|
---|
116 | /** The probe ID from the VTG location record. */
|
---|
117 | uint32_t idProbe;
|
---|
118 | /** 32 if X86, 64 if AMD64. */
|
---|
119 | uint8_t cBits;
|
---|
120 | /** Reserved padding. */
|
---|
121 | uint8_t abReserved[3];
|
---|
122 | /** Data which format is dictated by the cBits member. */
|
---|
123 | union
|
---|
124 | {
|
---|
125 | /** X86 context info. */
|
---|
126 | struct
|
---|
127 | {
|
---|
128 | uint32_t uVtgProbeLoc; /**< Location record address. */
|
---|
129 | uint32_t aArgs[20]; /**< Raw arguments. */
|
---|
130 | uint32_t eip;
|
---|
131 | uint32_t eflags;
|
---|
132 | uint32_t eax;
|
---|
133 | uint32_t ecx;
|
---|
134 | uint32_t edx;
|
---|
135 | uint32_t ebx;
|
---|
136 | uint32_t esp;
|
---|
137 | uint32_t ebp;
|
---|
138 | uint32_t esi;
|
---|
139 | uint32_t edi;
|
---|
140 | uint16_t cs;
|
---|
141 | uint16_t ss;
|
---|
142 | uint16_t ds;
|
---|
143 | uint16_t es;
|
---|
144 | uint16_t fs;
|
---|
145 | uint16_t gs;
|
---|
146 | } X86;
|
---|
147 |
|
---|
148 | /** AMD64 context info. */
|
---|
149 | struct
|
---|
150 | {
|
---|
151 | uint64_t uVtgProbeLoc; /**< Location record address. */
|
---|
152 | uint64_t aArgs[10]; /**< Raw arguments. */
|
---|
153 | uint64_t rip;
|
---|
154 | uint64_t rflags;
|
---|
155 | uint64_t rax;
|
---|
156 | uint64_t rcx;
|
---|
157 | uint64_t rdx;
|
---|
158 | uint64_t rbx;
|
---|
159 | uint64_t rsp;
|
---|
160 | uint64_t rbp;
|
---|
161 | uint64_t rsi;
|
---|
162 | uint64_t rdi;
|
---|
163 | uint64_t r8;
|
---|
164 | uint64_t r9;
|
---|
165 | uint64_t r10;
|
---|
166 | uint64_t r11;
|
---|
167 | uint64_t r12;
|
---|
168 | uint64_t r13;
|
---|
169 | uint64_t r14;
|
---|
170 | uint64_t r15;
|
---|
171 | } Amd64;
|
---|
172 | } u;
|
---|
173 | } SUPDRVTRACERUSRCTX;
|
---|
174 | /** Pointer to the usermode probe context information. */
|
---|
175 | typedef SUPDRVTRACERUSRCTX *PSUPDRVTRACERUSRCTX;
|
---|
176 | /** Pointer to the const usermode probe context information. */
|
---|
177 | typedef SUPDRVTRACERUSRCTX const *PCSUPDRVTRACERUSRCTX;
|
---|
178 |
|
---|
179 | /**
|
---|
180 | * The result of a modification operation (SUPMSRPROBEROP_MODIFY or
|
---|
181 | * SUPMSRPROBEROP_MODIFY_FASTER).
|
---|
182 | */
|
---|
183 | typedef struct SUPMSRPROBERMODIFYRESULT
|
---|
184 | {
|
---|
185 | /** The MSR value prior to the modifications. Valid if fBeforeGp is false */
|
---|
186 | uint64_t uBefore;
|
---|
187 | /** The value that was written. Valid if fBeforeGp is false */
|
---|
188 | uint64_t uWritten;
|
---|
189 | /** The MSR value after the modifications. Valid if AfterGp is false. */
|
---|
190 | uint64_t uAfter;
|
---|
191 | /** Set if we GPed reading the MSR before the modification. */
|
---|
192 | bool fBeforeGp;
|
---|
193 | /** Set if we GPed while trying to write the modified value.
|
---|
194 | * This is set when fBeforeGp is true. */
|
---|
195 | bool fModifyGp;
|
---|
196 | /** Set if we GPed while trying to read the MSR after the modification.
|
---|
197 | * This is set when fBeforeGp is true. */
|
---|
198 | bool fAfterGp;
|
---|
199 | /** Set if we GPed while trying to restore the MSR after the modification.
|
---|
200 | * This is set when fBeforeGp is true. */
|
---|
201 | bool fRestoreGp;
|
---|
202 | /** Structure size alignment padding. */
|
---|
203 | bool afReserved[4];
|
---|
204 | } SUPMSRPROBERMODIFYRESULT, *PSUPMSRPROBERMODIFYRESULT;
|
---|
205 |
|
---|
206 |
|
---|
207 | /**
|
---|
208 | * The CPU state.
|
---|
209 | */
|
---|
210 | typedef enum SUPGIPCPUSTATE
|
---|
211 | {
|
---|
212 | /** Invalid CPU state / unused CPU entry. */
|
---|
213 | SUPGIPCPUSTATE_INVALID = 0,
|
---|
214 | /** The CPU is not present. */
|
---|
215 | SUPGIPCPUSTATE_ABSENT,
|
---|
216 | /** The CPU is offline. */
|
---|
217 | SUPGIPCPUSTATE_OFFLINE,
|
---|
218 | /** The CPU is online. */
|
---|
219 | SUPGIPCPUSTATE_ONLINE,
|
---|
220 | /** Force 32-bit enum type. */
|
---|
221 | SUPGIPCPUSTATE_32_BIT_HACK = 0x7fffffff
|
---|
222 | } SUPGIPCPUSTATE;
|
---|
223 |
|
---|
224 | /**
|
---|
225 | * Per CPU data.
|
---|
226 | */
|
---|
227 | typedef struct SUPGIPCPU
|
---|
228 | {
|
---|
229 | /** Update transaction number.
|
---|
230 | * This number is incremented at the start and end of each update. It follows
|
---|
231 | * thusly that odd numbers indicates update in progress, while even numbers
|
---|
232 | * indicate stable data. Use this to make sure that the data items you fetch
|
---|
233 | * are consistent. */
|
---|
234 | volatile uint32_t u32TransactionId;
|
---|
235 | /** The interval in TSC ticks between two NanoTS updates.
|
---|
236 | * This is the average interval over the last 2, 4 or 8 updates + a little slack.
|
---|
237 | * The slack makes the time go a tiny tiny bit slower and extends the interval enough
|
---|
238 | * to avoid ending up with too many 1ns increments. */
|
---|
239 | volatile uint32_t u32UpdateIntervalTSC;
|
---|
240 | /** Current nanosecond timestamp. */
|
---|
241 | volatile uint64_t u64NanoTS;
|
---|
242 | /** The TSC at the time of u64NanoTS. */
|
---|
243 | volatile uint64_t u64TSC;
|
---|
244 | /** Current CPU Frequency. */
|
---|
245 | volatile uint64_t u64CpuHz;
|
---|
246 | /** The TSC delta with reference to the master TSC, subtract from RDTSC. */
|
---|
247 | volatile int64_t i64TSCDelta;
|
---|
248 | /** Number of errors during updating.
|
---|
249 | * Typical errors are under/overflows. */
|
---|
250 | volatile uint32_t cErrors;
|
---|
251 | /** Index of the head item in au32TSCHistory. */
|
---|
252 | volatile uint32_t iTSCHistoryHead;
|
---|
253 | /** Array of recent TSC interval deltas.
|
---|
254 | * The most recent item is at index iTSCHistoryHead.
|
---|
255 | * This history is used to calculate u32UpdateIntervalTSC.
|
---|
256 | */
|
---|
257 | volatile uint32_t au32TSCHistory[8];
|
---|
258 | /** The interval between the last two NanoTS updates. (experiment for now) */
|
---|
259 | volatile uint32_t u32PrevUpdateIntervalNS;
|
---|
260 |
|
---|
261 | /** Reserved for future per processor data. */
|
---|
262 | volatile uint32_t u32Reserved;
|
---|
263 | /** The TSC value read while doing TSC delta measurements across CPUs. */
|
---|
264 | volatile uint64_t u64TSCSample;
|
---|
265 | /** Reserved for future per processor data. */
|
---|
266 | volatile uint32_t au32Reserved1[3];
|
---|
267 |
|
---|
268 | /** The CPU state. */
|
---|
269 | SUPGIPCPUSTATE volatile enmState;
|
---|
270 | /** The host CPU ID of this CPU (the SUPGIPCPU is indexed by APIC ID). */
|
---|
271 | RTCPUID idCpu;
|
---|
272 | /** The CPU set index of this CPU. */
|
---|
273 | int16_t iCpuSet;
|
---|
274 | /** CPU group number (always zero, except on windows). */
|
---|
275 | uint16_t iCpuGroup;
|
---|
276 | /** CPU group member number (same as iCpuSet, except on windows). */
|
---|
277 | uint16_t iCpuGroupMember;
|
---|
278 | /** The APIC ID of this CPU. */
|
---|
279 | uint16_t idApic;
|
---|
280 | /** @todo Add topology/NUMA info. */
|
---|
281 | uint32_t iReservedForNumaNode;
|
---|
282 | } SUPGIPCPU;
|
---|
283 | AssertCompileSize(RTCPUID, 4);
|
---|
284 | AssertCompileSize(SUPGIPCPU, 128);
|
---|
285 | AssertCompileMemberAlignment(SUPGIPCPU, u64NanoTS, 8);
|
---|
286 | AssertCompileMemberAlignment(SUPGIPCPU, u64TSC, 8);
|
---|
287 | AssertCompileMemberAlignment(SUPGIPCPU, u64TSCSample, 8);
|
---|
288 |
|
---|
289 | /** Pointer to per cpu data.
|
---|
290 | * @remark there is no const version of this typedef, see g_pSUPGlobalInfoPage for details. */
|
---|
291 | typedef SUPGIPCPU *PSUPGIPCPU;
|
---|
292 |
|
---|
293 | /**
|
---|
294 | * CPU group information.
|
---|
295 | * @remarks Windows only.
|
---|
296 | */
|
---|
297 | typedef struct SUPGIPCPUGROUP
|
---|
298 | {
|
---|
299 | /** Current number of CPUs in this group. */
|
---|
300 | uint16_t volatile cMembers;
|
---|
301 | /** Maximum number of CPUs in the group. */
|
---|
302 | uint16_t cMaxMembers;
|
---|
303 | /** The CPU set index of the members. This table has cMaxMembers entries.
|
---|
304 | * @note For various reasons, entries from cMembers and up to cMaxMembers are
|
---|
305 | * may change as the host OS does set dynamic assignments during CPU
|
---|
306 | * hotplugging. */
|
---|
307 | int16_t aiCpuSetIdxs[1];
|
---|
308 | } SUPGIPCPUGROUP;
|
---|
309 | /** Pointer to a GIP CPU group structure. */
|
---|
310 | typedef SUPGIPCPUGROUP *PSUPGIPCPUGROUP;
|
---|
311 | /** Pointer to a const GIP CPU group structure. */
|
---|
312 | typedef SUPGIPCPUGROUP const *PCSUPGIPCPUGROUP;
|
---|
313 |
|
---|
314 | /**
|
---|
315 | * The rules concerning the applicability of SUPGIPCPU::i64TscDelta.
|
---|
316 | */
|
---|
317 | typedef enum SUPGIPUSETSCDELTA
|
---|
318 | {
|
---|
319 | /** Value for SUPGIPMODE_ASYNC_TSC. */
|
---|
320 | SUPGIPUSETSCDELTA_NOT_APPLICABLE = 0,
|
---|
321 | /** The OS specific part of SUPDrv (or the user) claims the TSC is as
|
---|
322 | * good as zero. */
|
---|
323 | SUPGIPUSETSCDELTA_ZERO_CLAIMED,
|
---|
324 | /** The differences in RDTSC output between the CPUs/cores/threads should
|
---|
325 | * be considered zero for all practical purposes. */
|
---|
326 | SUPGIPUSETSCDELTA_PRACTICALLY_ZERO,
|
---|
327 | /** The differences in RDTSC output between the CPUs/cores/threads are a few
|
---|
328 | * hundred ticks or less. (Probably not worth calling ASMGetApicId two times
|
---|
329 | * just to apply deltas.) */
|
---|
330 | SUPGIPUSETSCDELTA_ROUGHLY_ZERO,
|
---|
331 | /** Significant differences in RDTSC output between the CPUs/cores/threads,
|
---|
332 | * deltas must be applied. */
|
---|
333 | SUPGIPUSETSCDELTA_NOT_ZERO,
|
---|
334 | /** End of valid values (exclusive). */
|
---|
335 | SUPGIPUSETSCDELTA_END,
|
---|
336 | /** Make sure the type is 32-bit sized. */
|
---|
337 | SUPGIPUSETSCDELTA_32BIT_HACK = 0x7fffffff
|
---|
338 | } SUPGIPUSETSCDELTA;
|
---|
339 |
|
---|
340 |
|
---|
341 | /** @name SUPGIPGETCPU_XXX - methods that aCPUs can be indexed.
|
---|
342 | *
|
---|
343 | * @note Linux offers information via selector 0x78, and Windows via selector
|
---|
344 | * 0x53. But since they both support RDTSCP as well, and because most
|
---|
345 | * CPUs now have RDTSCP, we prefer it over LSL. We can implement more
|
---|
346 | * alternatives if it becomes necessary.
|
---|
347 | *
|
---|
348 | * @{
|
---|
349 | */
|
---|
350 | /** Use ASMGetApicId (or equivalent) and translate the result via
|
---|
351 | * aiCpuFromApicId. */
|
---|
352 | #define SUPGIPGETCPU_APIC_ID RT_BIT_32(0)
|
---|
353 | /** Use RDTSCP and translate the first RTCPUSET_MAX_CPUS of ECX via
|
---|
354 | * aiCpuFromCpuSetIdx.
|
---|
355 | *
|
---|
356 | * Linux stores the RTMpCpuId() value in ECX[11:0] and NUMA node number in
|
---|
357 | * ECX[12:31]. Solaris only stores RTMpCpuId() in ECX. On both systems
|
---|
358 | * RTMpCpuId() == RTMpCpuIdToSetIndex(RTMpCpuId()). RTCPUSET_MAX_CPUS is
|
---|
359 | * currently 64, 256 or 1024 in size, which lower than
|
---|
360 | * 4096, so there shouldn't be any range issues. */
|
---|
361 | #define SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS RT_BIT_32(1)
|
---|
362 | /** Subtract the max IDT size from IDTR.LIMIT, extract the
|
---|
363 | * first RTCPUSET_MAX_CPUS and translate it via aiCpuFromCpuSetIdx.
|
---|
364 | *
|
---|
365 | * Darwin stores the RTMpCpuId() (== RTMpCpuIdToSetIndex(RTMpCpuId()))
|
---|
366 | * value in the IDT limit. The masking is a precaution against what linux
|
---|
367 | * does with RDTSCP. */
|
---|
368 | #define SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS RT_BIT_32(2)
|
---|
369 | /** Windows specific RDTSCP variant, where CH gives you the group and CL gives
|
---|
370 | * you the CPU number within that group.
|
---|
371 | *
|
---|
372 | * Use SUPGLOBALINFOPAGE::aidFirstCpuFromCpuGroup to get the group base CPU set
|
---|
373 | * index, then translate the sum of thru aiCpuFromCpuSetIdx to find the aCPUs
|
---|
374 | * entry.
|
---|
375 | *
|
---|
376 | * @note The group number is actually 16-bit wide (ECX[23:8]), but we simplify
|
---|
377 | * it since we only support 256 CPUs/groups at the moment.
|
---|
378 | */
|
---|
379 | #define SUPGIPGETCPU_RDTSCP_GROUP_IN_CH_NUMBER_IN_CL RT_BIT_32(3)
|
---|
380 | /** @} */
|
---|
381 |
|
---|
382 | /** @def SUPGIP_MAX_CPU_GROUPS
|
---|
383 | * Maximum number of CPU groups. */
|
---|
384 | #if RTCPUSET_MAX_CPUS >= 256
|
---|
385 | # define SUPGIP_MAX_CPU_GROUPS 256
|
---|
386 | #else
|
---|
387 | # define SUPGIP_MAX_CPU_GROUPS RTCPUSET_MAX_CPUS
|
---|
388 | #endif
|
---|
389 |
|
---|
390 | /**
|
---|
391 | * Global Information Page.
|
---|
392 | *
|
---|
393 | * This page contains useful information and can be mapped into any
|
---|
394 | * process or VM. It can be accessed thru the g_pSUPGlobalInfoPage
|
---|
395 | * pointer when a session is open.
|
---|
396 | */
|
---|
397 | typedef struct SUPGLOBALINFOPAGE
|
---|
398 | {
|
---|
399 | /** Magic (SUPGLOBALINFOPAGE_MAGIC). */
|
---|
400 | uint32_t u32Magic;
|
---|
401 | /** The GIP version. */
|
---|
402 | uint32_t u32Version;
|
---|
403 |
|
---|
404 | /** The GIP update mode, see SUPGIPMODE. */
|
---|
405 | uint32_t u32Mode;
|
---|
406 | /** The number of entries in the CPU table.
|
---|
407 | * (This can work as RTMpGetArraySize().) */
|
---|
408 | uint16_t cCpus;
|
---|
409 | /** The size of the GIP in pages. */
|
---|
410 | uint16_t cPages;
|
---|
411 | /** The update frequency of the of the NanoTS. */
|
---|
412 | volatile uint32_t u32UpdateHz;
|
---|
413 | /** The update interval in nanoseconds. (10^9 / u32UpdateHz) */
|
---|
414 | volatile uint32_t u32UpdateIntervalNS;
|
---|
415 | /** The timestamp of the last time we update the update frequency. */
|
---|
416 | volatile uint64_t u64NanoTSLastUpdateHz;
|
---|
417 | /** The TSC frequency of the system. */
|
---|
418 | uint64_t u64CpuHz;
|
---|
419 | /** The set of online CPUs. */
|
---|
420 | RTCPUSET OnlineCpuSet;
|
---|
421 | /** The set of present CPUs. */
|
---|
422 | RTCPUSET PresentCpuSet;
|
---|
423 | /** The set of possible CPUs. */
|
---|
424 | RTCPUSET PossibleCpuSet;
|
---|
425 | /** The number of CPUs that are online. */
|
---|
426 | volatile uint16_t cOnlineCpus;
|
---|
427 | /** The number of CPUs present in the system. */
|
---|
428 | volatile uint16_t cPresentCpus;
|
---|
429 | /** The highest number of CPUs possible. */
|
---|
430 | uint16_t cPossibleCpus;
|
---|
431 | /** The highest number of CPU groups possible. */
|
---|
432 | uint16_t cPossibleCpuGroups;
|
---|
433 | /** The max CPU ID (RTMpGetMaxCpuId). */
|
---|
434 | RTCPUID idCpuMax;
|
---|
435 | /** The applicability of SUPGIPCPU::i64TscDelta. */
|
---|
436 | SUPGIPUSETSCDELTA enmUseTscDelta;
|
---|
437 | /** Mask of SUPGIPGETCPU_XXX values that indicates different ways that aCPU
|
---|
438 | * can be accessed from ring-3 and raw-mode context. */
|
---|
439 | uint32_t fGetGipCpu;
|
---|
440 | /** GIP flags, see SUPGIP_FLAGS_XXX. */
|
---|
441 | volatile uint32_t fFlags;
|
---|
442 |
|
---|
443 | /** Padding / reserved space for future data. */
|
---|
444 | uint32_t au32Padding1[24];
|
---|
445 |
|
---|
446 | /** Table indexed by the CPU APIC ID to get the CPU table index. */
|
---|
447 | uint16_t aiCpuFromApicId[256];
|
---|
448 | /** CPU set index to CPU table index. */
|
---|
449 | uint16_t aiCpuFromCpuSetIdx[RTCPUSET_MAX_CPUS];
|
---|
450 | /** Table indexed by CPU group to containing offsets to SUPGIPCPUGROUP
|
---|
451 | * structures, invalid entries are set to UINT16_MAX. The offsets are relative
|
---|
452 | * to the start of this structure.
|
---|
453 | * @note Windows only. The other hosts sets all entries to UINT16_MAX! */
|
---|
454 | uint16_t aoffCpuGroup[SUPGIP_MAX_CPU_GROUPS];
|
---|
455 |
|
---|
456 | /** Array of per-cpu data.
|
---|
457 | * This is index by ApicId via the aiCpuFromApicId table.
|
---|
458 | *
|
---|
459 | * The clock and frequency information is updated for all CPUs if @c u32Mode
|
---|
460 | * is SUPGIPMODE_ASYNC_TSC. If @c u32Mode is SUPGIPMODE_SYNC_TSC only the first
|
---|
461 | * entry is updated. If @c u32Mode is SUPGIPMODE_SYNC_TSC the TSC frequency in
|
---|
462 | * @c u64CpuHz is copied to all CPUs. */
|
---|
463 | SUPGIPCPU aCPUs[1];
|
---|
464 | } SUPGLOBALINFOPAGE;
|
---|
465 | AssertCompileMemberAlignment(SUPGLOBALINFOPAGE, u64NanoTSLastUpdateHz, 8);
|
---|
466 | #if defined(RT_ARCH_SPARC) || defined(RT_ARCH_SPARC64)
|
---|
467 | AssertCompileMemberAlignment(SUPGLOBALINFOPAGE, aCPUs, 32);
|
---|
468 | #else
|
---|
469 | AssertCompileMemberAlignment(SUPGLOBALINFOPAGE, aCPUs, 256);
|
---|
470 | #endif
|
---|
471 | AssertCompile(sizeof(SUPGLOBALINFOPAGE) <= 0x1000); /* Keeping it less or equal to a page for raw-mode (saved state). */
|
---|
472 |
|
---|
473 | /** Pointer to the global info page.
|
---|
474 | * @remark there is no const version of this typedef, see g_pSUPGlobalInfoPage for details. */
|
---|
475 | typedef SUPGLOBALINFOPAGE *PSUPGLOBALINFOPAGE;
|
---|
476 |
|
---|
477 |
|
---|
478 | /** The value of the SUPGLOBALINFOPAGE::u32Magic field. (Soryo Fuyumi) */
|
---|
479 | #define SUPGLOBALINFOPAGE_MAGIC 0x19590106
|
---|
480 | /** The GIP version.
|
---|
481 | * Upper 16 bits is the major version. Major version is only changed with
|
---|
482 | * incompatible changes in the GIP. */
|
---|
483 | #define SUPGLOBALINFOPAGE_VERSION 0x00080000
|
---|
484 |
|
---|
485 | /**
|
---|
486 | * SUPGLOBALINFOPAGE::u32Mode values.
|
---|
487 | */
|
---|
488 | typedef enum SUPGIPMODE
|
---|
489 | {
|
---|
490 | /** The usual invalid null entry. */
|
---|
491 | SUPGIPMODE_INVALID = 0,
|
---|
492 | /** The TSC of the cores and cpus in the system is in sync. */
|
---|
493 | SUPGIPMODE_SYNC_TSC,
|
---|
494 | /** Each core has it's own TSC. */
|
---|
495 | SUPGIPMODE_ASYNC_TSC,
|
---|
496 | /** The TSC of the cores are non-stop and have a constant frequency. */
|
---|
497 | SUPGIPMODE_INVARIANT_TSC,
|
---|
498 | /** End of valid GIP mode values (exclusive). */
|
---|
499 | SUPGIPMODE_END,
|
---|
500 | /** The usual 32-bit hack. */
|
---|
501 | SUPGIPMODE_32BIT_HACK = 0x7fffffff
|
---|
502 | } SUPGIPMODE;
|
---|
503 |
|
---|
504 | /** Pointer to the Global Information Page.
|
---|
505 | *
|
---|
506 | * This pointer is valid as long as SUPLib has a open session. Anyone using
|
---|
507 | * the page must treat this pointer as highly volatile and not trust it beyond
|
---|
508 | * one transaction.
|
---|
509 | *
|
---|
510 | * @remark The GIP page is read-only to everyone but the support driver and
|
---|
511 | * is actually mapped read only everywhere but in ring-0. However
|
---|
512 | * it is not marked 'const' as this might confuse compilers into
|
---|
513 | * thinking that values doesn't change even if members are marked
|
---|
514 | * as volatile. Thus, there is no PCSUPGLOBALINFOPAGE type.
|
---|
515 | */
|
---|
516 | #if defined(IN_SUP_R3) || defined(IN_SUP_R0)
|
---|
517 | extern DECLEXPORT(PSUPGLOBALINFOPAGE) g_pSUPGlobalInfoPage;
|
---|
518 |
|
---|
519 | #elif !defined(IN_RING0) || defined(RT_OS_WINDOWS) || defined(RT_OS_SOLARIS)
|
---|
520 | extern DECLIMPORT(PSUPGLOBALINFOPAGE) g_pSUPGlobalInfoPage;
|
---|
521 |
|
---|
522 | #else /* IN_RING0 && !RT_OS_WINDOWS */
|
---|
523 | # if !defined(__GNUC__) || defined(RT_OS_DARWIN) || !defined(RT_ARCH_AMD64)
|
---|
524 | # define g_pSUPGlobalInfoPage (&g_SUPGlobalInfoPage)
|
---|
525 | # else
|
---|
526 | # define g_pSUPGlobalInfoPage (SUPGetGIPHlp())
|
---|
527 | /** Workaround for ELF+GCC problem on 64-bit hosts.
|
---|
528 | * (GCC emits a mov with a R_X86_64_32 reloc, we need R_X86_64_64.) */
|
---|
529 | DECLINLINE(PSUPGLOBALINFOPAGE) SUPGetGIPHlp(void)
|
---|
530 | {
|
---|
531 | PSUPGLOBALINFOPAGE pGIP;
|
---|
532 | __asm__ __volatile__ ("movabs $g_SUPGlobalInfoPage,%0\n\t"
|
---|
533 | : "=a" (pGIP));
|
---|
534 | return pGIP;
|
---|
535 | }
|
---|
536 | # endif
|
---|
537 | /** The GIP.
|
---|
538 | * We save a level of indirection by exporting the GIP instead of a variable
|
---|
539 | * pointing to it. */
|
---|
540 | extern DECLIMPORT(SUPGLOBALINFOPAGE) g_SUPGlobalInfoPage;
|
---|
541 | #endif
|
---|
542 |
|
---|
543 | /**
|
---|
544 | * Gets the GIP pointer.
|
---|
545 | *
|
---|
546 | * @returns Pointer to the GIP or NULL.
|
---|
547 | */
|
---|
548 | SUPDECL(PSUPGLOBALINFOPAGE) SUPGetGIP(void);
|
---|
549 |
|
---|
550 | /** @name SUPGIP_FLAGS_XXX - SUPR3GipSetFlags flags.
|
---|
551 | * @{ */
|
---|
552 | /** Enable GIP test mode. */
|
---|
553 | #define SUPGIP_FLAGS_TESTING_ENABLE RT_BIT_32(0)
|
---|
554 | /** Valid mask of flags that can be set through the ioctl. */
|
---|
555 | #define SUPGIP_FLAGS_VALID_MASK RT_BIT_32(0)
|
---|
556 | /** GIP test mode needs to be checked (e.g. when enabled or being disabled). */
|
---|
557 | #define SUPGIP_FLAGS_TESTING RT_BIT_32(24)
|
---|
558 | /** Prepare to start GIP test mode. */
|
---|
559 | #define SUPGIP_FLAGS_TESTING_START RT_BIT_32(25)
|
---|
560 | /** Prepare to stop GIP test mode. */
|
---|
561 | #define SUPGIP_FLAGS_TESTING_STOP RT_BIT_32(26)
|
---|
562 | /** @} */
|
---|
563 |
|
---|
564 | /** @internal */
|
---|
565 | SUPDECL(uint64_t) SUPGetCpuHzFromGipForAsyncMode(PSUPGLOBALINFOPAGE pGip);
|
---|
566 | SUPDECL(bool) SUPIsTscFreqCompatible(uint64_t uCpuHz, uint64_t *puGipCpuHz, bool fRelax);
|
---|
567 | SUPDECL(bool) SUPIsTscFreqCompatibleEx(uint64_t uBaseCpuHz, uint64_t uCpuHz, bool fRelax);
|
---|
568 |
|
---|
569 |
|
---|
570 | /**
|
---|
571 | * Gets the TSC frequency of the calling CPU.
|
---|
572 | *
|
---|
573 | * @returns TSC frequency, UINT64_MAX on failure (asserted).
|
---|
574 | * @param pGip The GIP pointer.
|
---|
575 | */
|
---|
576 | DECLINLINE(uint64_t) SUPGetCpuHzFromGip(PSUPGLOBALINFOPAGE pGip)
|
---|
577 | {
|
---|
578 | if (RT_LIKELY( pGip
|
---|
579 | && pGip->u32Magic == SUPGLOBALINFOPAGE_MAGIC))
|
---|
580 | {
|
---|
581 | switch (pGip->u32Mode)
|
---|
582 | {
|
---|
583 | case SUPGIPMODE_INVARIANT_TSC:
|
---|
584 | case SUPGIPMODE_SYNC_TSC:
|
---|
585 | return pGip->aCPUs[0].u64CpuHz;
|
---|
586 | case SUPGIPMODE_ASYNC_TSC:
|
---|
587 | return SUPGetCpuHzFromGipForAsyncMode(pGip);
|
---|
588 | default: break; /* shut up gcc */
|
---|
589 | }
|
---|
590 | }
|
---|
591 | AssertFailed();
|
---|
592 | return UINT64_MAX;
|
---|
593 | }
|
---|
594 |
|
---|
595 |
|
---|
596 | /**
|
---|
597 | * Gets the TSC frequency of the specified CPU.
|
---|
598 | *
|
---|
599 | * @returns TSC frequency, UINT64_MAX on failure (asserted).
|
---|
600 | * @param pGip The GIP pointer.
|
---|
601 | * @param iCpuSet The CPU set index of the CPU in question.
|
---|
602 | */
|
---|
603 | DECLINLINE(uint64_t) SUPGetCpuHzFromGipBySetIndex(PSUPGLOBALINFOPAGE pGip, uint32_t iCpuSet)
|
---|
604 | {
|
---|
605 | if (RT_LIKELY( pGip
|
---|
606 | && pGip->u32Magic == SUPGLOBALINFOPAGE_MAGIC))
|
---|
607 | {
|
---|
608 | switch (pGip->u32Mode)
|
---|
609 | {
|
---|
610 | case SUPGIPMODE_INVARIANT_TSC:
|
---|
611 | case SUPGIPMODE_SYNC_TSC:
|
---|
612 | return pGip->aCPUs[0].u64CpuHz;
|
---|
613 | case SUPGIPMODE_ASYNC_TSC:
|
---|
614 | if (RT_LIKELY(iCpuSet < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx)))
|
---|
615 | {
|
---|
616 | uint16_t iCpu = pGip->aiCpuFromCpuSetIdx[iCpuSet];
|
---|
617 | if (RT_LIKELY(iCpu < pGip->cCpus))
|
---|
618 | return pGip->aCPUs[iCpu].u64CpuHz;
|
---|
619 | }
|
---|
620 | break;
|
---|
621 | default: break; /* shut up gcc */
|
---|
622 | }
|
---|
623 | }
|
---|
624 | AssertFailed();
|
---|
625 | return UINT64_MAX;
|
---|
626 | }
|
---|
627 |
|
---|
628 |
|
---|
629 | /**
|
---|
630 | * Gets the pointer to the per CPU data for a CPU given by its set index.
|
---|
631 | *
|
---|
632 | * @returns Pointer to the corresponding per CPU structure, or NULL if invalid.
|
---|
633 | * @param pGip The GIP pointer.
|
---|
634 | * @param iCpuSet The CPU set index of the CPU which we want.
|
---|
635 | */
|
---|
636 | DECLINLINE(PSUPGIPCPU) SUPGetGipCpuBySetIndex(PSUPGLOBALINFOPAGE pGip, uint32_t iCpuSet)
|
---|
637 | {
|
---|
638 | if (RT_LIKELY( pGip
|
---|
639 | && pGip->u32Magic == SUPGLOBALINFOPAGE_MAGIC))
|
---|
640 | {
|
---|
641 | if (RT_LIKELY(iCpuSet < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx)))
|
---|
642 | {
|
---|
643 | uint16_t iCpu = pGip->aiCpuFromCpuSetIdx[iCpuSet];
|
---|
644 | if (RT_LIKELY(iCpu < pGip->cCpus))
|
---|
645 | return &pGip->aCPUs[iCpu];
|
---|
646 | }
|
---|
647 | }
|
---|
648 | return NULL;
|
---|
649 | }
|
---|
650 |
|
---|
651 |
|
---|
652 | #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
|
---|
653 |
|
---|
654 | /** @internal */
|
---|
655 | SUPDECL(uint64_t) SUPReadTscWithDelta(PSUPGLOBALINFOPAGE pGip);
|
---|
656 |
|
---|
657 | /**
|
---|
658 | * Read the host TSC value and applies the TSC delta if appropriate.
|
---|
659 | *
|
---|
660 | * @returns the TSC value.
|
---|
661 | * @remarks Requires GIP to be initialized and valid.
|
---|
662 | */
|
---|
663 | DECLINLINE(uint64_t) SUPReadTsc(void)
|
---|
664 | {
|
---|
665 | PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
|
---|
666 | if (pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_ROUGHLY_ZERO)
|
---|
667 | return ASMReadTSC();
|
---|
668 | return SUPReadTscWithDelta(pGip);
|
---|
669 | }
|
---|
670 |
|
---|
671 | #endif /* X86 || AMD64 */
|
---|
672 |
|
---|
673 | /** @internal */
|
---|
674 | SUPDECL(uint64_t) SUPGetTscDeltaSlow(PSUPGLOBALINFOPAGE pGip);
|
---|
675 |
|
---|
676 | /**
|
---|
677 | * Gets the TSC delta for the current CPU.
|
---|
678 | *
|
---|
679 | * @returns The TSC delta value (will not return the special INT64_MAX value).
|
---|
680 | * @remarks Requires GIP to be initialized and valid.
|
---|
681 | */
|
---|
682 | DECLINLINE(int64_t) SUPGetTscDelta(void)
|
---|
683 | {
|
---|
684 | PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
|
---|
685 | if (pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_ROUGHLY_ZERO)
|
---|
686 | return 0;
|
---|
687 | return SUPGetTscDeltaSlow(pGip);
|
---|
688 | }
|
---|
689 |
|
---|
690 |
|
---|
691 | /**
|
---|
692 | * Gets the TSC delta for a given CPU.
|
---|
693 | *
|
---|
694 | * @returns The TSC delta value (will not return the special INT64_MAX value).
|
---|
695 | * @param iCpuSet The CPU set index of the CPU which TSC delta we want.
|
---|
696 | * @remarks Requires GIP to be initialized and valid.
|
---|
697 | */
|
---|
698 | DECLINLINE(int64_t) SUPGetTscDeltaByCpuSetIndex(uint32_t iCpuSet)
|
---|
699 | {
|
---|
700 | PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
|
---|
701 | if (pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_ROUGHLY_ZERO)
|
---|
702 | return 0;
|
---|
703 | if (RT_LIKELY(iCpuSet < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx)))
|
---|
704 | {
|
---|
705 | uint16_t iCpu = pGip->aiCpuFromCpuSetIdx[iCpuSet];
|
---|
706 | if (RT_LIKELY(iCpu < pGip->cCpus))
|
---|
707 | {
|
---|
708 | int64_t iTscDelta = pGip->aCPUs[iCpu].i64TSCDelta;
|
---|
709 | if (iTscDelta != INT64_MAX)
|
---|
710 | return iTscDelta;
|
---|
711 | }
|
---|
712 | }
|
---|
713 | AssertFailed();
|
---|
714 | return 0;
|
---|
715 | }
|
---|
716 |
|
---|
717 |
|
---|
718 | /**
|
---|
719 | * Checks if the TSC delta is available for a given CPU (if TSC-deltas are
|
---|
720 | * relevant).
|
---|
721 | *
|
---|
722 | * @returns true if it's okay to read the TSC, false otherwise.
|
---|
723 | *
|
---|
724 | * @param iCpuSet The CPU set index of the CPU which TSC delta we check.
|
---|
725 | * @remarks Requires GIP to be initialized and valid.
|
---|
726 | */
|
---|
727 | DECLINLINE(bool) SUPIsTscDeltaAvailableForCpuSetIndex(uint32_t iCpuSet)
|
---|
728 | {
|
---|
729 | PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
|
---|
730 | if (pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_ROUGHLY_ZERO)
|
---|
731 | return true;
|
---|
732 | if (RT_LIKELY(iCpuSet < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx)))
|
---|
733 | {
|
---|
734 | uint16_t iCpu = pGip->aiCpuFromCpuSetIdx[iCpuSet];
|
---|
735 | if (RT_LIKELY(iCpu < pGip->cCpus))
|
---|
736 | {
|
---|
737 | int64_t iTscDelta = pGip->aCPUs[iCpu].i64TSCDelta;
|
---|
738 | if (iTscDelta != INT64_MAX)
|
---|
739 | return true;
|
---|
740 | }
|
---|
741 | }
|
---|
742 | return false;
|
---|
743 | }
|
---|
744 |
|
---|
745 |
|
---|
746 | /**
|
---|
747 | * Gets the descriptive GIP mode name.
|
---|
748 | *
|
---|
749 | * @returns The name.
|
---|
750 | * @param pGip Pointer to the GIP.
|
---|
751 | */
|
---|
752 | DECLINLINE(const char *) SUPGetGIPModeName(PSUPGLOBALINFOPAGE pGip)
|
---|
753 | {
|
---|
754 | AssertReturn(pGip, NULL);
|
---|
755 | switch (pGip->u32Mode)
|
---|
756 | {
|
---|
757 | case SUPGIPMODE_INVARIANT_TSC: return "Invariant";
|
---|
758 | case SUPGIPMODE_SYNC_TSC: return "Synchronous";
|
---|
759 | case SUPGIPMODE_ASYNC_TSC: return "Asynchronous";
|
---|
760 | case SUPGIPMODE_INVALID: return "Invalid";
|
---|
761 | default: return "???";
|
---|
762 | }
|
---|
763 | }
|
---|
764 |
|
---|
765 |
|
---|
766 | /**
|
---|
767 | * Gets the descriptive TSC-delta enum name.
|
---|
768 | *
|
---|
769 | * @returns The name.
|
---|
770 | * @param pGip Pointer to the GIP.
|
---|
771 | */
|
---|
772 | DECLINLINE(const char *) SUPGetGIPTscDeltaModeName(PSUPGLOBALINFOPAGE pGip)
|
---|
773 | {
|
---|
774 | AssertReturn(pGip, NULL);
|
---|
775 | switch (pGip->enmUseTscDelta)
|
---|
776 | {
|
---|
777 | case SUPGIPUSETSCDELTA_NOT_APPLICABLE: return "Not Applicable";
|
---|
778 | case SUPGIPUSETSCDELTA_ZERO_CLAIMED: return "Zero Claimed";
|
---|
779 | case SUPGIPUSETSCDELTA_PRACTICALLY_ZERO: return "Practically Zero";
|
---|
780 | case SUPGIPUSETSCDELTA_ROUGHLY_ZERO: return "Roughly Zero";
|
---|
781 | case SUPGIPUSETSCDELTA_NOT_ZERO: return "Not Zero";
|
---|
782 | default: return "???";
|
---|
783 | }
|
---|
784 | }
|
---|
785 |
|
---|
786 |
|
---|
787 | /**
|
---|
788 | * Request for generic VMMR0Entry calls.
|
---|
789 | */
|
---|
790 | typedef struct SUPVMMR0REQHDR
|
---|
791 | {
|
---|
792 | /** The magic. (SUPVMMR0REQHDR_MAGIC) */
|
---|
793 | uint32_t u32Magic;
|
---|
794 | /** The size of the request. */
|
---|
795 | uint32_t cbReq;
|
---|
796 | } SUPVMMR0REQHDR;
|
---|
797 | /** Pointer to a ring-0 request header. */
|
---|
798 | typedef SUPVMMR0REQHDR *PSUPVMMR0REQHDR;
|
---|
799 | /** the SUPVMMR0REQHDR::u32Magic value (Ethan Iverson - The Bad Plus). */
|
---|
800 | #define SUPVMMR0REQHDR_MAGIC UINT32_C(0x19730211)
|
---|
801 |
|
---|
802 |
|
---|
803 | /** For the fast ioctl path.
|
---|
804 | * @{
|
---|
805 | */
|
---|
806 | /** @see VMMR0_DO_RAW_RUN. */
|
---|
807 | #define SUP_VMMR0_DO_RAW_RUN 0
|
---|
808 | /** @see VMMR0_DO_HM_RUN. */
|
---|
809 | #define SUP_VMMR0_DO_HM_RUN 1
|
---|
810 | /** @see VMMR0_DO_NOP */
|
---|
811 | #define SUP_VMMR0_DO_NOP 2
|
---|
812 | /** @see VMMR0_DO_NEM_RUN */
|
---|
813 | #define SUP_VMMR0_DO_NEM_RUN 3
|
---|
814 | /** @} */
|
---|
815 |
|
---|
816 | /** SUPR3QueryVTCaps capability flags
|
---|
817 | * @{
|
---|
818 | */
|
---|
819 | /** AMD-V support. */
|
---|
820 | #define SUPVTCAPS_AMD_V RT_BIT(0)
|
---|
821 | /** VT-x support. */
|
---|
822 | #define SUPVTCAPS_VT_X RT_BIT(1)
|
---|
823 | /** Nested paging is supported. */
|
---|
824 | #define SUPVTCAPS_NESTED_PAGING RT_BIT(2)
|
---|
825 | /** VT-x: Unrestricted guest execution is supported. */
|
---|
826 | #define SUPVTCAPS_VTX_UNRESTRICTED_GUEST RT_BIT(3)
|
---|
827 | /** @} */
|
---|
828 |
|
---|
829 | /**
|
---|
830 | * Request for generic FNSUPR0SERVICEREQHANDLER calls.
|
---|
831 | */
|
---|
832 | typedef struct SUPR0SERVICEREQHDR
|
---|
833 | {
|
---|
834 | /** The magic. (SUPR0SERVICEREQHDR_MAGIC) */
|
---|
835 | uint32_t u32Magic;
|
---|
836 | /** The size of the request. */
|
---|
837 | uint32_t cbReq;
|
---|
838 | } SUPR0SERVICEREQHDR;
|
---|
839 | /** Pointer to a ring-0 service request header. */
|
---|
840 | typedef SUPR0SERVICEREQHDR *PSUPR0SERVICEREQHDR;
|
---|
841 | /** the SUPVMMR0REQHDR::u32Magic value (Esbjoern Svensson - E.S.P.). */
|
---|
842 | #define SUPR0SERVICEREQHDR_MAGIC UINT32_C(0x19640416)
|
---|
843 |
|
---|
844 |
|
---|
845 | /**
|
---|
846 | * Creates a single release event semaphore.
|
---|
847 | *
|
---|
848 | * @returns VBox status code.
|
---|
849 | * @param pSession The session handle of the caller.
|
---|
850 | * @param phEvent Where to return the handle to the event semaphore.
|
---|
851 | */
|
---|
852 | SUPDECL(int) SUPSemEventCreate(PSUPDRVSESSION pSession, PSUPSEMEVENT phEvent);
|
---|
853 |
|
---|
854 | /**
|
---|
855 | * Closes a single release event semaphore handle.
|
---|
856 | *
|
---|
857 | * @returns VBox status code.
|
---|
858 | * @retval VINF_OBJECT_DESTROYED if the semaphore was destroyed.
|
---|
859 | * @retval VINF_SUCCESS if the handle was successfully closed but the semaphore
|
---|
860 | * object remained alive because of other references.
|
---|
861 | *
|
---|
862 | * @param pSession The session handle of the caller.
|
---|
863 | * @param hEvent The handle. Nil is quietly ignored.
|
---|
864 | */
|
---|
865 | SUPDECL(int) SUPSemEventClose(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent);
|
---|
866 |
|
---|
867 | /**
|
---|
868 | * Signals a single release event semaphore.
|
---|
869 | *
|
---|
870 | * @returns VBox status code.
|
---|
871 | * @param pSession The session handle of the caller.
|
---|
872 | * @param hEvent The semaphore handle.
|
---|
873 | */
|
---|
874 | SUPDECL(int) SUPSemEventSignal(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent);
|
---|
875 |
|
---|
876 | #ifdef IN_RING0
|
---|
877 | /**
|
---|
878 | * Waits on a single release event semaphore, not interruptible.
|
---|
879 | *
|
---|
880 | * @returns VBox status code.
|
---|
881 | * @param pSession The session handle of the caller.
|
---|
882 | * @param hEvent The semaphore handle.
|
---|
883 | * @param cMillies The number of milliseconds to wait.
|
---|
884 | * @remarks Not available in ring-3.
|
---|
885 | */
|
---|
886 | SUPDECL(int) SUPSemEventWait(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent, uint32_t cMillies);
|
---|
887 | #endif
|
---|
888 |
|
---|
889 | /**
|
---|
890 | * Waits on a single release event semaphore, interruptible.
|
---|
891 | *
|
---|
892 | * @returns VBox status code.
|
---|
893 | * @param pSession The session handle of the caller.
|
---|
894 | * @param hEvent The semaphore handle.
|
---|
895 | * @param cMillies The number of milliseconds to wait.
|
---|
896 | */
|
---|
897 | SUPDECL(int) SUPSemEventWaitNoResume(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent, uint32_t cMillies);
|
---|
898 |
|
---|
899 | /**
|
---|
900 | * Waits on a single release event semaphore, interruptible.
|
---|
901 | *
|
---|
902 | * @returns VBox status code.
|
---|
903 | * @param pSession The session handle of the caller.
|
---|
904 | * @param hEvent The semaphore handle.
|
---|
905 | * @param uNsTimeout The deadline given on the RTTimeNanoTS() clock.
|
---|
906 | */
|
---|
907 | SUPDECL(int) SUPSemEventWaitNsAbsIntr(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent, uint64_t uNsTimeout);
|
---|
908 |
|
---|
909 | /**
|
---|
910 | * Waits on a single release event semaphore, interruptible.
|
---|
911 | *
|
---|
912 | * @returns VBox status code.
|
---|
913 | * @param pSession The session handle of the caller.
|
---|
914 | * @param hEvent The semaphore handle.
|
---|
915 | * @param cNsTimeout The number of nanoseconds to wait.
|
---|
916 | */
|
---|
917 | SUPDECL(int) SUPSemEventWaitNsRelIntr(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent, uint64_t cNsTimeout);
|
---|
918 |
|
---|
919 | /**
|
---|
920 | * Gets the best timeout resolution that SUPSemEventWaitNsAbsIntr and
|
---|
921 | * SUPSemEventWaitNsAbsIntr can do.
|
---|
922 | *
|
---|
923 | * @returns The resolution in nanoseconds.
|
---|
924 | * @param pSession The session handle of the caller.
|
---|
925 | */
|
---|
926 | SUPDECL(uint32_t) SUPSemEventGetResolution(PSUPDRVSESSION pSession);
|
---|
927 |
|
---|
928 |
|
---|
929 | /**
|
---|
930 | * Creates a multiple release event semaphore.
|
---|
931 | *
|
---|
932 | * @returns VBox status code.
|
---|
933 | * @param pSession The session handle of the caller.
|
---|
934 | * @param phEventMulti Where to return the handle to the event semaphore.
|
---|
935 | */
|
---|
936 | SUPDECL(int) SUPSemEventMultiCreate(PSUPDRVSESSION pSession, PSUPSEMEVENTMULTI phEventMulti);
|
---|
937 |
|
---|
938 | /**
|
---|
939 | * Closes a multiple release event semaphore handle.
|
---|
940 | *
|
---|
941 | * @returns VBox status code.
|
---|
942 | * @retval VINF_OBJECT_DESTROYED if the semaphore was destroyed.
|
---|
943 | * @retval VINF_SUCCESS if the handle was successfully closed but the semaphore
|
---|
944 | * object remained alive because of other references.
|
---|
945 | *
|
---|
946 | * @param pSession The session handle of the caller.
|
---|
947 | * @param hEventMulti The handle. Nil is quietly ignored.
|
---|
948 | */
|
---|
949 | SUPDECL(int) SUPSemEventMultiClose(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti);
|
---|
950 |
|
---|
951 | /**
|
---|
952 | * Signals a multiple release event semaphore.
|
---|
953 | *
|
---|
954 | * @returns VBox status code.
|
---|
955 | * @param pSession The session handle of the caller.
|
---|
956 | * @param hEventMulti The semaphore handle.
|
---|
957 | */
|
---|
958 | SUPDECL(int) SUPSemEventMultiSignal(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti);
|
---|
959 |
|
---|
960 | /**
|
---|
961 | * Resets a multiple release event semaphore.
|
---|
962 | *
|
---|
963 | * @returns VBox status code.
|
---|
964 | * @param pSession The session handle of the caller.
|
---|
965 | * @param hEventMulti The semaphore handle.
|
---|
966 | */
|
---|
967 | SUPDECL(int) SUPSemEventMultiReset(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti);
|
---|
968 |
|
---|
969 | #ifdef IN_RING0
|
---|
970 | /**
|
---|
971 | * Waits on a multiple release event semaphore, not interruptible.
|
---|
972 | *
|
---|
973 | * @returns VBox status code.
|
---|
974 | * @param pSession The session handle of the caller.
|
---|
975 | * @param hEventMulti The semaphore handle.
|
---|
976 | * @param cMillies The number of milliseconds to wait.
|
---|
977 | * @remarks Not available in ring-3.
|
---|
978 | */
|
---|
979 | SUPDECL(int) SUPSemEventMultiWait(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti, uint32_t cMillies);
|
---|
980 | #endif
|
---|
981 |
|
---|
982 | /**
|
---|
983 | * Waits on a multiple release event semaphore, interruptible.
|
---|
984 | *
|
---|
985 | * @returns VBox status code.
|
---|
986 | * @param pSession The session handle of the caller.
|
---|
987 | * @param hEventMulti The semaphore handle.
|
---|
988 | * @param cMillies The number of milliseconds to wait.
|
---|
989 | */
|
---|
990 | SUPDECL(int) SUPSemEventMultiWaitNoResume(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti, uint32_t cMillies);
|
---|
991 |
|
---|
992 | /**
|
---|
993 | * Waits on a multiple release event semaphore, interruptible.
|
---|
994 | *
|
---|
995 | * @returns VBox status code.
|
---|
996 | * @param pSession The session handle of the caller.
|
---|
997 | * @param hEventMulti The semaphore handle.
|
---|
998 | * @param uNsTimeout The deadline given on the RTTimeNanoTS() clock.
|
---|
999 | */
|
---|
1000 | SUPDECL(int) SUPSemEventMultiWaitNsAbsIntr(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti, uint64_t uNsTimeout);
|
---|
1001 |
|
---|
1002 | /**
|
---|
1003 | * Waits on a multiple release event semaphore, interruptible.
|
---|
1004 | *
|
---|
1005 | * @returns VBox status code.
|
---|
1006 | * @param pSession The session handle of the caller.
|
---|
1007 | * @param hEventMulti The semaphore handle.
|
---|
1008 | * @param cNsTimeout The number of nanoseconds to wait.
|
---|
1009 | */
|
---|
1010 | SUPDECL(int) SUPSemEventMultiWaitNsRelIntr(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti, uint64_t cNsTimeout);
|
---|
1011 |
|
---|
1012 | /**
|
---|
1013 | * Gets the best timeout resolution that SUPSemEventMultiWaitNsAbsIntr and
|
---|
1014 | * SUPSemEventMultiWaitNsRelIntr can do.
|
---|
1015 | *
|
---|
1016 | * @returns The resolution in nanoseconds.
|
---|
1017 | * @param pSession The session handle of the caller.
|
---|
1018 | */
|
---|
1019 | SUPDECL(uint32_t) SUPSemEventMultiGetResolution(PSUPDRVSESSION pSession);
|
---|
1020 |
|
---|
1021 |
|
---|
1022 | #ifdef IN_RING3
|
---|
1023 |
|
---|
1024 | /** @defgroup grp_sup_r3 SUP Host Context Ring-3 API
|
---|
1025 | * @{
|
---|
1026 | */
|
---|
1027 |
|
---|
1028 | /**
|
---|
1029 | * Installs the support library.
|
---|
1030 | *
|
---|
1031 | * @returns VBox status code.
|
---|
1032 | */
|
---|
1033 | SUPR3DECL(int) SUPR3Install(void);
|
---|
1034 |
|
---|
1035 | /**
|
---|
1036 | * Uninstalls the support library.
|
---|
1037 | *
|
---|
1038 | * @returns VBox status code.
|
---|
1039 | */
|
---|
1040 | SUPR3DECL(int) SUPR3Uninstall(void);
|
---|
1041 |
|
---|
1042 | /**
|
---|
1043 | * Trusted main entry point.
|
---|
1044 | *
|
---|
1045 | * This is exported as "TrustedMain" by the dynamic libraries which contains the
|
---|
1046 | * "real" application binary for which the hardened stub is built. The entry
|
---|
1047 | * point is invoked upon successful initialization of the support library and
|
---|
1048 | * runtime.
|
---|
1049 | *
|
---|
1050 | * @returns main kind of exit code.
|
---|
1051 | * @param argc The argument count.
|
---|
1052 | * @param argv The argument vector.
|
---|
1053 | * @param envp The environment vector.
|
---|
1054 | */
|
---|
1055 | typedef DECLCALLBACK(int) FNSUPTRUSTEDMAIN(int argc, char **argv, char **envp);
|
---|
1056 | /** Pointer to FNSUPTRUSTEDMAIN(). */
|
---|
1057 | typedef FNSUPTRUSTEDMAIN *PFNSUPTRUSTEDMAIN;
|
---|
1058 |
|
---|
1059 | /** Which operation failed. */
|
---|
1060 | typedef enum SUPINITOP
|
---|
1061 | {
|
---|
1062 | /** Invalid. */
|
---|
1063 | kSupInitOp_Invalid = 0,
|
---|
1064 | /** Installation integrity error. */
|
---|
1065 | kSupInitOp_Integrity,
|
---|
1066 | /** Setuid related. */
|
---|
1067 | kSupInitOp_RootCheck,
|
---|
1068 | /** Driver related. */
|
---|
1069 | kSupInitOp_Driver,
|
---|
1070 | /** IPRT init related. */
|
---|
1071 | kSupInitOp_IPRT,
|
---|
1072 | /** Miscellaneous. */
|
---|
1073 | kSupInitOp_Misc,
|
---|
1074 | /** Place holder. */
|
---|
1075 | kSupInitOp_End
|
---|
1076 | } SUPINITOP;
|
---|
1077 |
|
---|
1078 | /**
|
---|
1079 | * Trusted error entry point, optional.
|
---|
1080 | *
|
---|
1081 | * This is exported as "TrustedError" by the dynamic libraries which contains
|
---|
1082 | * the "real" application binary for which the hardened stub is built. The
|
---|
1083 | * hardened main() must specify SUPSECMAIN_FLAGS_TRUSTED_ERROR when calling
|
---|
1084 | * SUPR3HardenedMain.
|
---|
1085 | *
|
---|
1086 | * @param pszWhere Where the error occurred (function name).
|
---|
1087 | * @param enmWhat Which operation went wrong.
|
---|
1088 | * @param rc The status code.
|
---|
1089 | * @param pszMsgFmt Error message format string.
|
---|
1090 | * @param va The message format arguments.
|
---|
1091 | */
|
---|
1092 | typedef DECLCALLBACK(void) FNSUPTRUSTEDERROR(const char *pszWhere, SUPINITOP enmWhat, int rc,
|
---|
1093 | const char *pszMsgFmt, va_list va) RT_IPRT_FORMAT_ATTR(4, 0);
|
---|
1094 | /** Pointer to FNSUPTRUSTEDERROR. */
|
---|
1095 | typedef FNSUPTRUSTEDERROR *PFNSUPTRUSTEDERROR;
|
---|
1096 |
|
---|
1097 | /**
|
---|
1098 | * Secure main.
|
---|
1099 | *
|
---|
1100 | * This is used for the set-user-ID-on-execute binaries on unixy systems
|
---|
1101 | * and when using the open-vboxdrv-via-root-service setup on Windows.
|
---|
1102 | *
|
---|
1103 | * This function will perform the integrity checks of the VirtualBox
|
---|
1104 | * installation, open the support driver, open the root service (later),
|
---|
1105 | * and load the DLL corresponding to \a pszProgName and execute its main
|
---|
1106 | * function.
|
---|
1107 | *
|
---|
1108 | * @returns Return code appropriate for main().
|
---|
1109 | *
|
---|
1110 | * @param pszProgName The program name. This will be used to figure out which
|
---|
1111 | * DLL/SO/DYLIB to load and execute.
|
---|
1112 | * @param fFlags Flags.
|
---|
1113 | * @param argc The argument count.
|
---|
1114 | * @param argv The argument vector.
|
---|
1115 | * @param envp The environment vector.
|
---|
1116 | */
|
---|
1117 | DECLHIDDEN(int) SUPR3HardenedMain(const char *pszProgName, uint32_t fFlags, int argc, char **argv, char **envp);
|
---|
1118 |
|
---|
1119 | /** @name SUPR3HardenedMain flags.
|
---|
1120 | * @{ */
|
---|
1121 | /** Don't open the device. (Intended for VirtualBox without -startvm.) */
|
---|
1122 | #define SUPSECMAIN_FLAGS_DONT_OPEN_DEV RT_BIT_32(0)
|
---|
1123 | /** The hardened DLL has a "TrustedError" function (see FNSUPTRUSTEDERROR). */
|
---|
1124 | #define SUPSECMAIN_FLAGS_TRUSTED_ERROR RT_BIT_32(1)
|
---|
1125 | /** Hack for making VirtualBoxVM use VirtualBox.dylib on Mac OS X. */
|
---|
1126 | #define SUPSECMAIN_FLAGS_OSX_VM_APP RT_BIT_32(2)
|
---|
1127 | /** Program binary location mask. */
|
---|
1128 | #define SUPSECMAIN_FLAGS_LOC_MASK UINT32_C(0x00000010)
|
---|
1129 | /** Default binary location is the application binary directory. Does
|
---|
1130 | * not need to be given explicitly (it's 0). */
|
---|
1131 | #define SUPSECMAIN_FLAGS_LOC_APP_BIN UINT32_C(0x00000000)
|
---|
1132 | /** The binary is located in the testcase directory instead of the
|
---|
1133 | * default application binary directory. */
|
---|
1134 | #define SUPSECMAIN_FLAGS_LOC_TESTCASE UINT32_C(0x00000010)
|
---|
1135 | /** @} */
|
---|
1136 |
|
---|
1137 | /**
|
---|
1138 | * Initializes the support library.
|
---|
1139 | *
|
---|
1140 | * Each successful call to SUPR3Init() or SUPR3InitEx must be countered by a
|
---|
1141 | * call to SUPR3Term(false).
|
---|
1142 | *
|
---|
1143 | * @returns VBox status code.
|
---|
1144 | * @param ppSession Where to store the session handle. Defaults to NULL.
|
---|
1145 | */
|
---|
1146 | SUPR3DECL(int) SUPR3Init(PSUPDRVSESSION *ppSession);
|
---|
1147 |
|
---|
1148 | /**
|
---|
1149 | * Initializes the support library, extended version.
|
---|
1150 | *
|
---|
1151 | * Each successful call to SUPR3Init() or SUPR3InitEx must be countered by a
|
---|
1152 | * call to SUPR3Term(false).
|
---|
1153 | *
|
---|
1154 | * @returns VBox status code.
|
---|
1155 | * @param fUnrestricted The desired access.
|
---|
1156 | * @param ppSession Where to store the session handle. Defaults to NULL.
|
---|
1157 | */
|
---|
1158 | SUPR3DECL(int) SUPR3InitEx(bool fUnrestricted, PSUPDRVSESSION *ppSession);
|
---|
1159 |
|
---|
1160 | /**
|
---|
1161 | * Terminates the support library.
|
---|
1162 | *
|
---|
1163 | * @returns VBox status code.
|
---|
1164 | * @param fForced Forced termination. This means to ignore the
|
---|
1165 | * init call count and just terminated.
|
---|
1166 | */
|
---|
1167 | #ifdef __cplusplus
|
---|
1168 | SUPR3DECL(int) SUPR3Term(bool fForced = false);
|
---|
1169 | #else
|
---|
1170 | SUPR3DECL(int) SUPR3Term(int fForced);
|
---|
1171 | #endif
|
---|
1172 |
|
---|
1173 | /**
|
---|
1174 | * Sets the ring-0 VM handle for use with fast IOCtls.
|
---|
1175 | *
|
---|
1176 | * @returns VBox status code.
|
---|
1177 | * @param pVMR0 The ring-0 VM handle.
|
---|
1178 | * NIL_RTR0PTR can be used to unset the handle when the
|
---|
1179 | * VM is about to be destroyed.
|
---|
1180 | */
|
---|
1181 | SUPR3DECL(int) SUPR3SetVMForFastIOCtl(PVMR0 pVMR0);
|
---|
1182 |
|
---|
1183 | /**
|
---|
1184 | * Calls the HC R0 VMM entry point.
|
---|
1185 | * See VMMR0Entry() for more details.
|
---|
1186 | *
|
---|
1187 | * @returns error code specific to uFunction.
|
---|
1188 | * @param pVMR0 Pointer to the Ring-0 (Host Context) mapping of the VM structure.
|
---|
1189 | * @param idCpu The virtual CPU ID.
|
---|
1190 | * @param uOperation Operation to execute.
|
---|
1191 | * @param pvArg Argument.
|
---|
1192 | */
|
---|
1193 | SUPR3DECL(int) SUPR3CallVMMR0(PVMR0 pVMR0, VMCPUID idCpu, unsigned uOperation, void *pvArg);
|
---|
1194 |
|
---|
1195 | /**
|
---|
1196 | * Variant of SUPR3CallVMMR0, except that this takes the fast ioclt path
|
---|
1197 | * regardsless of compile-time defaults.
|
---|
1198 | *
|
---|
1199 | * @returns VBox status code.
|
---|
1200 | * @param pVMR0 The ring-0 VM handle.
|
---|
1201 | * @param uOperation The operation; only the SUP_VMMR0_DO_* ones are valid.
|
---|
1202 | * @param idCpu The virtual CPU ID.
|
---|
1203 | */
|
---|
1204 | SUPR3DECL(int) SUPR3CallVMMR0Fast(PVMR0 pVMR0, unsigned uOperation, VMCPUID idCpu);
|
---|
1205 |
|
---|
1206 | /**
|
---|
1207 | * Calls the HC R0 VMM entry point, in a safer but slower manner than
|
---|
1208 | * SUPR3CallVMMR0. When entering using this call the R0 components can call
|
---|
1209 | * into the host kernel (i.e. use the SUPR0 and RT APIs).
|
---|
1210 | *
|
---|
1211 | * See VMMR0Entry() for more details.
|
---|
1212 | *
|
---|
1213 | * @returns error code specific to uFunction.
|
---|
1214 | * @param pVMR0 Pointer to the Ring-0 (Host Context) mapping of the VM structure.
|
---|
1215 | * @param idCpu The virtual CPU ID.
|
---|
1216 | * @param uOperation Operation to execute.
|
---|
1217 | * @param u64Arg Constant argument.
|
---|
1218 | * @param pReqHdr Pointer to a request header. Optional.
|
---|
1219 | * This will be copied in and out of kernel space. There currently is a size
|
---|
1220 | * limit on this, just below 4KB.
|
---|
1221 | */
|
---|
1222 | SUPR3DECL(int) SUPR3CallVMMR0Ex(PVMR0 pVMR0, VMCPUID idCpu, unsigned uOperation, uint64_t u64Arg, PSUPVMMR0REQHDR pReqHdr);
|
---|
1223 |
|
---|
1224 | /**
|
---|
1225 | * Calls a ring-0 service.
|
---|
1226 | *
|
---|
1227 | * The operation and the request packet is specific to the service.
|
---|
1228 | *
|
---|
1229 | * @returns error code specific to uFunction.
|
---|
1230 | * @param pszService The service name.
|
---|
1231 | * @param cchService The length of the service name.
|
---|
1232 | * @param uOperation The request number.
|
---|
1233 | * @param u64Arg Constant argument.
|
---|
1234 | * @param pReqHdr Pointer to a request header. Optional.
|
---|
1235 | * This will be copied in and out of kernel space. There currently is a size
|
---|
1236 | * limit on this, just below 4KB.
|
---|
1237 | */
|
---|
1238 | SUPR3DECL(int) SUPR3CallR0Service(const char *pszService, size_t cchService, uint32_t uOperation, uint64_t u64Arg, PSUPR0SERVICEREQHDR pReqHdr);
|
---|
1239 |
|
---|
1240 | /** Which logger. */
|
---|
1241 | typedef enum SUPLOGGER
|
---|
1242 | {
|
---|
1243 | SUPLOGGER_DEBUG = 1,
|
---|
1244 | SUPLOGGER_RELEASE
|
---|
1245 | } SUPLOGGER;
|
---|
1246 |
|
---|
1247 | /**
|
---|
1248 | * Changes the settings of the specified ring-0 logger.
|
---|
1249 | *
|
---|
1250 | * @returns VBox status code.
|
---|
1251 | * @param enmWhich Which logger.
|
---|
1252 | * @param pszFlags The flags settings.
|
---|
1253 | * @param pszGroups The groups settings.
|
---|
1254 | * @param pszDest The destination specificier.
|
---|
1255 | */
|
---|
1256 | SUPR3DECL(int) SUPR3LoggerSettings(SUPLOGGER enmWhich, const char *pszFlags, const char *pszGroups, const char *pszDest);
|
---|
1257 |
|
---|
1258 | /**
|
---|
1259 | * Creates a ring-0 logger instance.
|
---|
1260 | *
|
---|
1261 | * @returns VBox status code.
|
---|
1262 | * @param enmWhich Which logger to create.
|
---|
1263 | * @param pszFlags The flags settings.
|
---|
1264 | * @param pszGroups The groups settings.
|
---|
1265 | * @param pszDest The destination specificier.
|
---|
1266 | */
|
---|
1267 | SUPR3DECL(int) SUPR3LoggerCreate(SUPLOGGER enmWhich, const char *pszFlags, const char *pszGroups, const char *pszDest);
|
---|
1268 |
|
---|
1269 | /**
|
---|
1270 | * Destroys a ring-0 logger instance.
|
---|
1271 | *
|
---|
1272 | * @returns VBox status code.
|
---|
1273 | * @param enmWhich Which logger.
|
---|
1274 | */
|
---|
1275 | SUPR3DECL(int) SUPR3LoggerDestroy(SUPLOGGER enmWhich);
|
---|
1276 |
|
---|
1277 | /**
|
---|
1278 | * Queries the paging mode of the host OS.
|
---|
1279 | *
|
---|
1280 | * @returns The paging mode.
|
---|
1281 | */
|
---|
1282 | SUPR3DECL(SUPPAGINGMODE) SUPR3GetPagingMode(void);
|
---|
1283 |
|
---|
1284 | /**
|
---|
1285 | * Allocate zero-filled pages.
|
---|
1286 | *
|
---|
1287 | * Use this to allocate a number of pages suitable for seeding / locking.
|
---|
1288 | * Call SUPR3PageFree() to free the pages once done with them.
|
---|
1289 | *
|
---|
1290 | * @returns VBox status.
|
---|
1291 | * @param cPages Number of pages to allocate.
|
---|
1292 | * @param ppvPages Where to store the base pointer to the allocated pages.
|
---|
1293 | */
|
---|
1294 | SUPR3DECL(int) SUPR3PageAlloc(size_t cPages, void **ppvPages);
|
---|
1295 |
|
---|
1296 | /**
|
---|
1297 | * Frees pages allocated with SUPR3PageAlloc().
|
---|
1298 | *
|
---|
1299 | * @returns VBox status.
|
---|
1300 | * @param pvPages Pointer returned by SUPR3PageAlloc().
|
---|
1301 | * @param cPages Number of pages that was allocated.
|
---|
1302 | */
|
---|
1303 | SUPR3DECL(int) SUPR3PageFree(void *pvPages, size_t cPages);
|
---|
1304 |
|
---|
1305 | /**
|
---|
1306 | * Allocate non-zeroed, locked, pages with user and, optionally, kernel
|
---|
1307 | * mappings.
|
---|
1308 | *
|
---|
1309 | * Use SUPR3PageFreeEx() to free memory allocated with this function.
|
---|
1310 | *
|
---|
1311 | * @returns VBox status code.
|
---|
1312 | * @param cPages The number of pages to allocate.
|
---|
1313 | * @param fFlags Flags, reserved. Must be zero.
|
---|
1314 | * @param ppvPages Where to store the address of the user mapping.
|
---|
1315 | * @param pR0Ptr Where to store the address of the kernel mapping.
|
---|
1316 | * NULL if no kernel mapping is desired.
|
---|
1317 | * @param paPages Where to store the physical addresses of each page.
|
---|
1318 | * Optional.
|
---|
1319 | */
|
---|
1320 | SUPR3DECL(int) SUPR3PageAllocEx(size_t cPages, uint32_t fFlags, void **ppvPages, PRTR0PTR pR0Ptr, PSUPPAGE paPages);
|
---|
1321 |
|
---|
1322 | /**
|
---|
1323 | * Maps a portion of a ring-3 only allocation into kernel space.
|
---|
1324 | *
|
---|
1325 | * @returns VBox status code.
|
---|
1326 | *
|
---|
1327 | * @param pvR3 The address SUPR3PageAllocEx return.
|
---|
1328 | * @param off Offset to start mapping at. Must be page aligned.
|
---|
1329 | * @param cb Number of bytes to map. Must be page aligned.
|
---|
1330 | * @param fFlags Flags, must be zero.
|
---|
1331 | * @param pR0Ptr Where to store the address on success.
|
---|
1332 | *
|
---|
1333 | */
|
---|
1334 | SUPR3DECL(int) SUPR3PageMapKernel(void *pvR3, uint32_t off, uint32_t cb, uint32_t fFlags, PRTR0PTR pR0Ptr);
|
---|
1335 |
|
---|
1336 | /**
|
---|
1337 | * Changes the protection of
|
---|
1338 | *
|
---|
1339 | * @returns VBox status code.
|
---|
1340 | * @retval VERR_NOT_SUPPORTED if the OS doesn't allow us to change page level
|
---|
1341 | * protection. See also RTR0MemObjProtect.
|
---|
1342 | *
|
---|
1343 | * @param pvR3 The ring-3 address SUPR3PageAllocEx returned.
|
---|
1344 | * @param R0Ptr The ring-0 address SUPR3PageAllocEx returned if it
|
---|
1345 | * is desired that the corresponding ring-0 page
|
---|
1346 | * mappings should change protection as well. Pass
|
---|
1347 | * NIL_RTR0PTR if the ring-0 pages should remain
|
---|
1348 | * unaffected.
|
---|
1349 | * @param off Offset to start at which to start chagning the page
|
---|
1350 | * level protection. Must be page aligned.
|
---|
1351 | * @param cb Number of bytes to change. Must be page aligned.
|
---|
1352 | * @param fProt The new page level protection, either a combination
|
---|
1353 | * of RTMEM_PROT_READ, RTMEM_PROT_WRITE and
|
---|
1354 | * RTMEM_PROT_EXEC, or just RTMEM_PROT_NONE.
|
---|
1355 | */
|
---|
1356 | SUPR3DECL(int) SUPR3PageProtect(void *pvR3, RTR0PTR R0Ptr, uint32_t off, uint32_t cb, uint32_t fProt);
|
---|
1357 |
|
---|
1358 | /**
|
---|
1359 | * Free pages allocated by SUPR3PageAllocEx.
|
---|
1360 | *
|
---|
1361 | * @returns VBox status code.
|
---|
1362 | * @param pvPages The address of the user mapping.
|
---|
1363 | * @param cPages The number of pages.
|
---|
1364 | */
|
---|
1365 | SUPR3DECL(int) SUPR3PageFreeEx(void *pvPages, size_t cPages);
|
---|
1366 |
|
---|
1367 | /**
|
---|
1368 | * Allocated memory with page aligned memory with a contiguous and locked physical
|
---|
1369 | * memory backing below 4GB.
|
---|
1370 | *
|
---|
1371 | * @returns Pointer to the allocated memory (virtual address).
|
---|
1372 | * *pHCPhys is set to the physical address of the memory.
|
---|
1373 | * If ppvR0 isn't NULL, *ppvR0 is set to the ring-0 mapping.
|
---|
1374 | * The returned memory must be freed using SUPR3ContFree().
|
---|
1375 | * @returns NULL on failure.
|
---|
1376 | * @param cPages Number of pages to allocate.
|
---|
1377 | * @param pR0Ptr Where to store the ring-0 mapping of the allocation. (optional)
|
---|
1378 | * @param pHCPhys Where to store the physical address of the memory block.
|
---|
1379 | *
|
---|
1380 | * @remark This 2nd version of this API exists because we're not able to map the
|
---|
1381 | * ring-3 mapping executable on WIN64. This is a serious problem in regard to
|
---|
1382 | * the world switchers.
|
---|
1383 | */
|
---|
1384 | SUPR3DECL(void *) SUPR3ContAlloc(size_t cPages, PRTR0PTR pR0Ptr, PRTHCPHYS pHCPhys);
|
---|
1385 |
|
---|
1386 | /**
|
---|
1387 | * Frees memory allocated with SUPR3ContAlloc().
|
---|
1388 | *
|
---|
1389 | * @returns VBox status code.
|
---|
1390 | * @param pv Pointer to the memory block which should be freed.
|
---|
1391 | * @param cPages Number of pages to be freed.
|
---|
1392 | */
|
---|
1393 | SUPR3DECL(int) SUPR3ContFree(void *pv, size_t cPages);
|
---|
1394 |
|
---|
1395 | /**
|
---|
1396 | * Allocated non contiguous physical memory below 4GB.
|
---|
1397 | *
|
---|
1398 | * The memory isn't zeroed.
|
---|
1399 | *
|
---|
1400 | * @returns VBox status code.
|
---|
1401 | * @returns NULL on failure.
|
---|
1402 | * @param cPages Number of pages to allocate.
|
---|
1403 | * @param ppvPages Where to store the pointer to the allocated memory.
|
---|
1404 | * The pointer stored here on success must be passed to
|
---|
1405 | * SUPR3LowFree when the memory should be released.
|
---|
1406 | * @param ppvPagesR0 Where to store the ring-0 pointer to the allocated memory. optional.
|
---|
1407 | * @param paPages Where to store the physical addresses of the individual pages.
|
---|
1408 | */
|
---|
1409 | SUPR3DECL(int) SUPR3LowAlloc(size_t cPages, void **ppvPages, PRTR0PTR ppvPagesR0, PSUPPAGE paPages);
|
---|
1410 |
|
---|
1411 | /**
|
---|
1412 | * Frees memory allocated with SUPR3LowAlloc().
|
---|
1413 | *
|
---|
1414 | * @returns VBox status code.
|
---|
1415 | * @param pv Pointer to the memory block which should be freed.
|
---|
1416 | * @param cPages Number of pages that was allocated.
|
---|
1417 | */
|
---|
1418 | SUPR3DECL(int) SUPR3LowFree(void *pv, size_t cPages);
|
---|
1419 |
|
---|
1420 | /**
|
---|
1421 | * Load a module into R0 HC.
|
---|
1422 | *
|
---|
1423 | * This will verify the file integrity in a similar manner as
|
---|
1424 | * SUPR3HardenedVerifyFile before loading it.
|
---|
1425 | *
|
---|
1426 | * @returns VBox status code.
|
---|
1427 | * @param pszFilename The path to the image file.
|
---|
1428 | * @param pszModule The module name. Max 32 bytes.
|
---|
1429 | * @param ppvImageBase Where to store the image address.
|
---|
1430 | * @param pErrInfo Where to return extended error information.
|
---|
1431 | * Optional.
|
---|
1432 | */
|
---|
1433 | SUPR3DECL(int) SUPR3LoadModule(const char *pszFilename, const char *pszModule, void **ppvImageBase, PRTERRINFO pErrInfo);
|
---|
1434 |
|
---|
1435 | /**
|
---|
1436 | * Load a module into R0 HC.
|
---|
1437 | *
|
---|
1438 | * This will verify the file integrity in a similar manner as
|
---|
1439 | * SUPR3HardenedVerifyFile before loading it.
|
---|
1440 | *
|
---|
1441 | * @returns VBox status code.
|
---|
1442 | * @param pszFilename The path to the image file.
|
---|
1443 | * @param pszModule The module name. Max 32 bytes.
|
---|
1444 | * @param pszSrvReqHandler The name of the service request handler entry
|
---|
1445 | * point. See FNSUPR0SERVICEREQHANDLER.
|
---|
1446 | * @param ppvImageBase Where to store the image address.
|
---|
1447 | */
|
---|
1448 | SUPR3DECL(int) SUPR3LoadServiceModule(const char *pszFilename, const char *pszModule,
|
---|
1449 | const char *pszSrvReqHandler, void **ppvImageBase);
|
---|
1450 |
|
---|
1451 | /**
|
---|
1452 | * Frees a R0 HC module.
|
---|
1453 | *
|
---|
1454 | * @returns VBox status code.
|
---|
1455 | * @param pvImageBase The base address of the image to free.
|
---|
1456 | * @remark This will not actually 'free' the module, there are of course usage counting.
|
---|
1457 | */
|
---|
1458 | SUPR3DECL(int) SUPR3FreeModule(void *pvImageBase);
|
---|
1459 |
|
---|
1460 | /**
|
---|
1461 | * Lock down the module loader interface.
|
---|
1462 | *
|
---|
1463 | * This will lock down the module loader interface. No new modules can be
|
---|
1464 | * loaded and all loaded modules can no longer be freed.
|
---|
1465 | *
|
---|
1466 | * @returns VBox status code.
|
---|
1467 | * @param pErrInfo Where to return extended error information.
|
---|
1468 | * Optional.
|
---|
1469 | */
|
---|
1470 | SUPR3DECL(int) SUPR3LockDownLoader(PRTERRINFO pErrInfo);
|
---|
1471 |
|
---|
1472 | /**
|
---|
1473 | * Get the address of a symbol in a ring-0 module.
|
---|
1474 | *
|
---|
1475 | * @returns VBox status code.
|
---|
1476 | * @param pvImageBase The base address of the image to search.
|
---|
1477 | * @param pszSymbol Symbol name. If it's value is less than 64k it's treated like a
|
---|
1478 | * ordinal value rather than a string pointer.
|
---|
1479 | * @param ppvValue Where to store the symbol value.
|
---|
1480 | */
|
---|
1481 | SUPR3DECL(int) SUPR3GetSymbolR0(void *pvImageBase, const char *pszSymbol, void **ppvValue);
|
---|
1482 |
|
---|
1483 | /**
|
---|
1484 | * Load R0 HC VMM code.
|
---|
1485 | *
|
---|
1486 | * @returns VBox status code.
|
---|
1487 | * @deprecated Use SUPR3LoadModule(pszFilename, "VMMR0.r0", &pvImageBase)
|
---|
1488 | */
|
---|
1489 | SUPR3DECL(int) SUPR3LoadVMM(const char *pszFilename);
|
---|
1490 |
|
---|
1491 | /**
|
---|
1492 | * Unloads R0 HC VMM code.
|
---|
1493 | *
|
---|
1494 | * @returns VBox status code.
|
---|
1495 | * @deprecated Use SUPR3FreeModule().
|
---|
1496 | */
|
---|
1497 | SUPR3DECL(int) SUPR3UnloadVMM(void);
|
---|
1498 |
|
---|
1499 | /**
|
---|
1500 | * Get the physical address of the GIP.
|
---|
1501 | *
|
---|
1502 | * @returns VBox status code.
|
---|
1503 | * @param pHCPhys Where to store the physical address of the GIP.
|
---|
1504 | */
|
---|
1505 | SUPR3DECL(int) SUPR3GipGetPhys(PRTHCPHYS pHCPhys);
|
---|
1506 |
|
---|
1507 | /**
|
---|
1508 | * Initializes only the bits relevant for the SUPR3HardenedVerify* APIs.
|
---|
1509 | *
|
---|
1510 | * This is for users that don't necessarily need to initialize the whole of
|
---|
1511 | * SUPLib. There is no harm in calling this one more time.
|
---|
1512 | *
|
---|
1513 | * @returns VBox status code.
|
---|
1514 | * @remarks Currently not counted, so only call once.
|
---|
1515 | */
|
---|
1516 | SUPR3DECL(int) SUPR3HardenedVerifyInit(void);
|
---|
1517 |
|
---|
1518 | /**
|
---|
1519 | * Reverses the effect of SUPR3HardenedVerifyInit if SUPR3InitEx hasn't been
|
---|
1520 | * called.
|
---|
1521 | *
|
---|
1522 | * Ignored if the support library was initialized using SUPR3Init or
|
---|
1523 | * SUPR3InitEx.
|
---|
1524 | *
|
---|
1525 | * @returns VBox status code.
|
---|
1526 | */
|
---|
1527 | SUPR3DECL(int) SUPR3HardenedVerifyTerm(void);
|
---|
1528 |
|
---|
1529 | /**
|
---|
1530 | * Verifies the integrity of a file, and optionally opens it.
|
---|
1531 | *
|
---|
1532 | * The integrity check is for whether the file is suitable for loading into
|
---|
1533 | * the hypervisor or VM process. The integrity check may include verifying
|
---|
1534 | * the authenticode/elfsign/whatever signature of the file, which can take
|
---|
1535 | * a little while.
|
---|
1536 | *
|
---|
1537 | * @returns VBox status code. On failure it will have printed a LogRel message.
|
---|
1538 | *
|
---|
1539 | * @param pszFilename The file.
|
---|
1540 | * @param pszWhat For the LogRel on failure.
|
---|
1541 | * @param phFile Where to store the handle to the opened file. This is optional, pass NULL
|
---|
1542 | * if the file should not be opened.
|
---|
1543 | * @deprecated Write a new one.
|
---|
1544 | */
|
---|
1545 | SUPR3DECL(int) SUPR3HardenedVerifyFile(const char *pszFilename, const char *pszWhat, PRTFILE phFile);
|
---|
1546 |
|
---|
1547 | /**
|
---|
1548 | * Verifies the integrity of a the current process, including the image
|
---|
1549 | * location and that the invocation was absolute.
|
---|
1550 | *
|
---|
1551 | * This must currently be called after initializing the runtime. The intended
|
---|
1552 | * audience is set-uid-to-root applications, root services and similar.
|
---|
1553 | *
|
---|
1554 | * @returns VBox status code. On failure
|
---|
1555 | * message.
|
---|
1556 | * @param pszArgv0 The first argument to main().
|
---|
1557 | * @param fInternal Set this to @c true if this is an internal
|
---|
1558 | * VirtualBox application. Otherwise pass @c false.
|
---|
1559 | * @param pErrInfo Where to return extended error information.
|
---|
1560 | */
|
---|
1561 | SUPR3DECL(int) SUPR3HardenedVerifySelf(const char *pszArgv0, bool fInternal, PRTERRINFO pErrInfo);
|
---|
1562 |
|
---|
1563 | /**
|
---|
1564 | * Verifies the integrity of an installation directory.
|
---|
1565 | *
|
---|
1566 | * The integrity check verifies that the directory cannot be tampered with by
|
---|
1567 | * normal users on the system. On Unix this translates to root ownership and
|
---|
1568 | * no symbolic linking.
|
---|
1569 | *
|
---|
1570 | * @returns VBox status code. On failure a message will be stored in @a pszErr.
|
---|
1571 | *
|
---|
1572 | * @param pszDirPath The directory path.
|
---|
1573 | * @param fRecursive Whether the check should be recursive or
|
---|
1574 | * not. When set, all sub-directores will be checked,
|
---|
1575 | * including files (@a fCheckFiles is ignored).
|
---|
1576 | * @param fCheckFiles Whether to apply the same basic integrity check to
|
---|
1577 | * the files in the directory as the directory itself.
|
---|
1578 | * @param pErrInfo Where to return extended error information.
|
---|
1579 | * Optional.
|
---|
1580 | */
|
---|
1581 | SUPR3DECL(int) SUPR3HardenedVerifyDir(const char *pszDirPath, bool fRecursive, bool fCheckFiles, PRTERRINFO pErrInfo);
|
---|
1582 |
|
---|
1583 | /**
|
---|
1584 | * Verifies the integrity of a plug-in module.
|
---|
1585 | *
|
---|
1586 | * This is similar to SUPR3HardenedLdrLoad, except it does not load the module
|
---|
1587 | * and that the module does not have to be shipped with VirtualBox.
|
---|
1588 | *
|
---|
1589 | * @returns VBox status code. On failure a message will be stored in @a pszErr.
|
---|
1590 | *
|
---|
1591 | * @param pszFilename The filename of the plug-in module (nothing can be
|
---|
1592 | * omitted here).
|
---|
1593 | * @param pErrInfo Where to return extended error information.
|
---|
1594 | * Optional.
|
---|
1595 | */
|
---|
1596 | SUPR3DECL(int) SUPR3HardenedVerifyPlugIn(const char *pszFilename, PRTERRINFO pErrInfo);
|
---|
1597 |
|
---|
1598 | /**
|
---|
1599 | * Same as RTLdrLoad() but will verify the files it loads (hardened builds).
|
---|
1600 | *
|
---|
1601 | * Will add dll suffix if missing and try load the file.
|
---|
1602 | *
|
---|
1603 | * @returns iprt status code.
|
---|
1604 | * @param pszFilename Image filename. This must have a path.
|
---|
1605 | * @param phLdrMod Where to store the handle to the loaded module.
|
---|
1606 | * @param fFlags See RTLDRLOAD_FLAGS_XXX.
|
---|
1607 | * @param pErrInfo Where to return extended error information.
|
---|
1608 | * Optional.
|
---|
1609 | */
|
---|
1610 | SUPR3DECL(int) SUPR3HardenedLdrLoad(const char *pszFilename, PRTLDRMOD phLdrMod, uint32_t fFlags, PRTERRINFO pErrInfo);
|
---|
1611 |
|
---|
1612 | /**
|
---|
1613 | * Same as RTLdrLoadAppPriv() but it will verify the files it loads (hardened
|
---|
1614 | * builds).
|
---|
1615 | *
|
---|
1616 | * Will add dll suffix to the file if missing, then look for it in the
|
---|
1617 | * architecture dependent application directory.
|
---|
1618 | *
|
---|
1619 | * @returns iprt status code.
|
---|
1620 | * @param pszFilename Image filename.
|
---|
1621 | * @param phLdrMod Where to store the handle to the loaded module.
|
---|
1622 | * @param fFlags See RTLDRLOAD_FLAGS_XXX.
|
---|
1623 | * @param pErrInfo Where to return extended error information.
|
---|
1624 | * Optional.
|
---|
1625 | */
|
---|
1626 | SUPR3DECL(int) SUPR3HardenedLdrLoadAppPriv(const char *pszFilename, PRTLDRMOD phLdrMod, uint32_t fFlags, PRTERRINFO pErrInfo);
|
---|
1627 |
|
---|
1628 | /**
|
---|
1629 | * Same as RTLdrLoad() but will verify the files it loads (hardened builds).
|
---|
1630 | *
|
---|
1631 | * This differs from SUPR3HardenedLdrLoad() in that it can load modules from
|
---|
1632 | * extension packs and anything else safely installed on the system, provided
|
---|
1633 | * they pass the hardening tests.
|
---|
1634 | *
|
---|
1635 | * @returns iprt status code.
|
---|
1636 | * @param pszFilename The full path to the module, with extension.
|
---|
1637 | * @param phLdrMod Where to store the handle to the loaded module.
|
---|
1638 | * @param pErrInfo Where to return extended error information.
|
---|
1639 | * Optional.
|
---|
1640 | */
|
---|
1641 | SUPR3DECL(int) SUPR3HardenedLdrLoadPlugIn(const char *pszFilename, PRTLDRMOD phLdrMod, PRTERRINFO pErrInfo);
|
---|
1642 |
|
---|
1643 | /**
|
---|
1644 | * Check if the host kernel can run in VMX root mode.
|
---|
1645 | *
|
---|
1646 | * @returns VINF_SUCCESS if supported, error code indicating why if not.
|
---|
1647 | * @param ppszWhy Where to return an explanatory message on failure.
|
---|
1648 | */
|
---|
1649 | SUPR3DECL(int) SUPR3QueryVTxSupported(const char **ppszWhy);
|
---|
1650 |
|
---|
1651 | /**
|
---|
1652 | * Return VT-x/AMD-V capabilities.
|
---|
1653 | *
|
---|
1654 | * @returns VINF_SUCCESS if supported, error code indicating why if not.
|
---|
1655 | * @param pfCaps Pointer to capability dword (out).
|
---|
1656 | * @todo Intended for main, which means we need to relax the privilege requires
|
---|
1657 | * when accessing certain vboxdrv functions.
|
---|
1658 | */
|
---|
1659 | SUPR3DECL(int) SUPR3QueryVTCaps(uint32_t *pfCaps);
|
---|
1660 |
|
---|
1661 | /**
|
---|
1662 | * Open the tracer.
|
---|
1663 | *
|
---|
1664 | * @returns VBox status code.
|
---|
1665 | * @param uCookie Cookie identifying the tracer we expect to talk to.
|
---|
1666 | * @param uArg Tracer specific open argument.
|
---|
1667 | */
|
---|
1668 | SUPR3DECL(int) SUPR3TracerOpen(uint32_t uCookie, uintptr_t uArg);
|
---|
1669 |
|
---|
1670 | /**
|
---|
1671 | * Closes the tracer.
|
---|
1672 | *
|
---|
1673 | * @returns VBox status code.
|
---|
1674 | */
|
---|
1675 | SUPR3DECL(int) SUPR3TracerClose(void);
|
---|
1676 |
|
---|
1677 | /**
|
---|
1678 | * Perform an I/O request on the tracer.
|
---|
1679 | *
|
---|
1680 | * @returns VBox status.
|
---|
1681 | * @param uCmd The tracer command.
|
---|
1682 | * @param uArg The argument.
|
---|
1683 | * @param piRetVal Where to store the tracer return value.
|
---|
1684 | */
|
---|
1685 | SUPR3DECL(int) SUPR3TracerIoCtl(uintptr_t uCmd, uintptr_t uArg, int32_t *piRetVal);
|
---|
1686 |
|
---|
1687 | /**
|
---|
1688 | * Registers the user module with the tracer.
|
---|
1689 | *
|
---|
1690 | * @returns VBox status code.
|
---|
1691 | * @param hModNative Native module handle. Pass ~(uintptr_t)0 if not
|
---|
1692 | * at hand.
|
---|
1693 | * @param pszModule The module name.
|
---|
1694 | * @param pVtgHdr The VTG header.
|
---|
1695 | * @param uVtgHdrAddr The address to which the VTG header is loaded
|
---|
1696 | * in the relevant execution context.
|
---|
1697 | * @param fFlags See SUP_TRACER_UMOD_FLAGS_XXX
|
---|
1698 | */
|
---|
1699 | SUPR3DECL(int) SUPR3TracerRegisterModule(uintptr_t hModNative, const char *pszModule, struct VTGOBJHDR *pVtgHdr,
|
---|
1700 | RTUINTPTR uVtgHdrAddr, uint32_t fFlags);
|
---|
1701 |
|
---|
1702 | /**
|
---|
1703 | * Deregisters the user module.
|
---|
1704 | *
|
---|
1705 | * @returns VBox status code.
|
---|
1706 | * @param pVtgHdr The VTG header.
|
---|
1707 | */
|
---|
1708 | SUPR3DECL(int) SUPR3TracerDeregisterModule(struct VTGOBJHDR *pVtgHdr);
|
---|
1709 |
|
---|
1710 | /**
|
---|
1711 | * Fire the probe.
|
---|
1712 | *
|
---|
1713 | * @param pVtgProbeLoc The probe location record.
|
---|
1714 | * @param uArg0 Raw probe argument 0.
|
---|
1715 | * @param uArg1 Raw probe argument 1.
|
---|
1716 | * @param uArg2 Raw probe argument 2.
|
---|
1717 | * @param uArg3 Raw probe argument 3.
|
---|
1718 | * @param uArg4 Raw probe argument 4.
|
---|
1719 | */
|
---|
1720 | SUPDECL(void) SUPTracerFireProbe(struct VTGPROBELOC *pVtgProbeLoc, uintptr_t uArg0, uintptr_t uArg1, uintptr_t uArg2,
|
---|
1721 | uintptr_t uArg3, uintptr_t uArg4);
|
---|
1722 |
|
---|
1723 | /**
|
---|
1724 | * Attempts to read the value of an MSR.
|
---|
1725 | *
|
---|
1726 | * @returns VBox status code.
|
---|
1727 | * @param uMsr The MSR to read.
|
---|
1728 | * @param idCpu The CPU to read it on, NIL_RTCPUID if it doesn't
|
---|
1729 | * matter which CPU.
|
---|
1730 | * @param puValue Where to return the value.
|
---|
1731 | * @param pfGp Where to store the \#GP indicator for the read
|
---|
1732 | * operation.
|
---|
1733 | */
|
---|
1734 | SUPR3DECL(int) SUPR3MsrProberRead(uint32_t uMsr, RTCPUID idCpu, uint64_t *puValue, bool *pfGp);
|
---|
1735 |
|
---|
1736 | /**
|
---|
1737 | * Attempts to write to an MSR.
|
---|
1738 | *
|
---|
1739 | * @returns VBox status code.
|
---|
1740 | * @param uMsr The MSR to write to.
|
---|
1741 | * @param idCpu The CPU to wrtie it on, NIL_RTCPUID if it
|
---|
1742 | * doesn't matter which CPU.
|
---|
1743 | * @param uValue The value to write.
|
---|
1744 | * @param pfGp Where to store the \#GP indicator for the write
|
---|
1745 | * operation.
|
---|
1746 | */
|
---|
1747 | SUPR3DECL(int) SUPR3MsrProberWrite(uint32_t uMsr, RTCPUID idCpu, uint64_t uValue, bool *pfGp);
|
---|
1748 |
|
---|
1749 | /**
|
---|
1750 | * Attempts to modify the value of an MSR.
|
---|
1751 | *
|
---|
1752 | * @returns VBox status code.
|
---|
1753 | * @param uMsr The MSR to modify.
|
---|
1754 | * @param idCpu The CPU to modify it on, NIL_RTCPUID if it
|
---|
1755 | * doesn't matter which CPU.
|
---|
1756 | * @param fAndMask The bits to keep in the current MSR value.
|
---|
1757 | * @param fOrMask The bits to set before writing.
|
---|
1758 | * @param pResult The result buffer.
|
---|
1759 | */
|
---|
1760 | SUPR3DECL(int) SUPR3MsrProberModify(uint32_t uMsr, RTCPUID idCpu, uint64_t fAndMask, uint64_t fOrMask,
|
---|
1761 | PSUPMSRPROBERMODIFYRESULT pResult);
|
---|
1762 |
|
---|
1763 | /**
|
---|
1764 | * Attempts to modify the value of an MSR, extended version.
|
---|
1765 | *
|
---|
1766 | * @returns VBox status code.
|
---|
1767 | * @param uMsr The MSR to modify.
|
---|
1768 | * @param idCpu The CPU to modify it on, NIL_RTCPUID if it
|
---|
1769 | * doesn't matter which CPU.
|
---|
1770 | * @param fAndMask The bits to keep in the current MSR value.
|
---|
1771 | * @param fOrMask The bits to set before writing.
|
---|
1772 | * @param fFaster If set to @c true some cache/tlb invalidation is
|
---|
1773 | * skipped, otherwise behave like
|
---|
1774 | * SUPR3MsrProberModify.
|
---|
1775 | * @param pResult The result buffer.
|
---|
1776 | */
|
---|
1777 | SUPR3DECL(int) SUPR3MsrProberModifyEx(uint32_t uMsr, RTCPUID idCpu, uint64_t fAndMask, uint64_t fOrMask, bool fFaster,
|
---|
1778 | PSUPMSRPROBERMODIFYRESULT pResult);
|
---|
1779 |
|
---|
1780 | /**
|
---|
1781 | * Resume built-in keyboard on MacBook Air and Pro hosts.
|
---|
1782 | *
|
---|
1783 | * @returns VBox status code.
|
---|
1784 | */
|
---|
1785 | SUPR3DECL(int) SUPR3ResumeSuspendedKeyboards(void);
|
---|
1786 |
|
---|
1787 | /**
|
---|
1788 | * Measure the TSC-delta for the specified CPU.
|
---|
1789 | *
|
---|
1790 | * @returns VBox status code.
|
---|
1791 | * @param idCpu The CPU to measure the TSC-delta for.
|
---|
1792 | * @param fAsync Whether the measurement is asynchronous, returns
|
---|
1793 | * immediately after signalling a measurement
|
---|
1794 | * request.
|
---|
1795 | * @param fForce Whether to perform a measurement even if the
|
---|
1796 | * specified CPU has a (possibly) valid TSC delta.
|
---|
1797 | * @param cRetries Number of times to retry failed delta
|
---|
1798 | * measurements.
|
---|
1799 | * @param cMsWaitRetry Number of milliseconds to wait between retries.
|
---|
1800 | */
|
---|
1801 | SUPR3DECL(int) SUPR3TscDeltaMeasure(RTCPUID idCpu, bool fAsync, bool fForce, uint8_t cRetries, uint8_t cMsWaitRetry);
|
---|
1802 |
|
---|
1803 | /**
|
---|
1804 | * Reads the delta-adjust TSC value.
|
---|
1805 | *
|
---|
1806 | * @returns VBox status code.
|
---|
1807 | * @param puTsc Where to store the read TSC value.
|
---|
1808 | * @param pidApic Where to store the APIC ID of the CPU where the TSC
|
---|
1809 | * was read (optional, can be NULL).
|
---|
1810 | */
|
---|
1811 | SUPR3DECL(int) SUPR3ReadTsc(uint64_t *puTsc, uint16_t *pidApic);
|
---|
1812 |
|
---|
1813 | /**
|
---|
1814 | * Modifies the GIP flags.
|
---|
1815 | *
|
---|
1816 | * @returns VBox status code.
|
---|
1817 | * @param fOrMask The OR mask of the GIP flags, see SUPGIP_FLAGS_XXX.
|
---|
1818 | * @param fAndMask The AND mask of the GIP flags, see SUPGIP_FLAGS_XXX.
|
---|
1819 | */
|
---|
1820 | SUPR3DECL(int) SUPR3GipSetFlags(uint32_t fOrMask, uint32_t fAndMask);
|
---|
1821 |
|
---|
1822 | /**
|
---|
1823 | * Return processor microcode revision, if applicable.
|
---|
1824 | *
|
---|
1825 | * @returns VINF_SUCCESS if supported, error code indicating why if not.
|
---|
1826 | * @param puMicrocodeRev Pointer to microcode revision dword (out).
|
---|
1827 | */
|
---|
1828 | SUPR3DECL(int) SUPR3QueryMicrocodeRev(uint32_t *puMicrocodeRev);
|
---|
1829 |
|
---|
1830 | /** @} */
|
---|
1831 | #endif /* IN_RING3 */
|
---|
1832 |
|
---|
1833 |
|
---|
1834 | /** @name User mode module flags (SUPR3TracerRegisterModule & SUP_IOCTL_TRACER_UMOD_REG).
|
---|
1835 | * @{ */
|
---|
1836 | /** Executable image. */
|
---|
1837 | #define SUP_TRACER_UMOD_FLAGS_EXE UINT32_C(1)
|
---|
1838 | /** Shared library (DLL, DYLIB, SO, etc). */
|
---|
1839 | #define SUP_TRACER_UMOD_FLAGS_SHARED UINT32_C(2)
|
---|
1840 | /** Image type mask. */
|
---|
1841 | #define SUP_TRACER_UMOD_FLAGS_TYPE_MASK UINT32_C(3)
|
---|
1842 | /** @} */
|
---|
1843 |
|
---|
1844 |
|
---|
1845 | #ifdef IN_RING0
|
---|
1846 | /** @defgroup grp_sup_r0 SUP Host Context Ring-0 API
|
---|
1847 | * @{
|
---|
1848 | */
|
---|
1849 |
|
---|
1850 | /**
|
---|
1851 | * Security objectype.
|
---|
1852 | */
|
---|
1853 | typedef enum SUPDRVOBJTYPE
|
---|
1854 | {
|
---|
1855 | /** The usual invalid object. */
|
---|
1856 | SUPDRVOBJTYPE_INVALID = 0,
|
---|
1857 | /** A Virtual Machine instance. */
|
---|
1858 | SUPDRVOBJTYPE_VM,
|
---|
1859 | /** Internal network. */
|
---|
1860 | SUPDRVOBJTYPE_INTERNAL_NETWORK,
|
---|
1861 | /** Internal network interface. */
|
---|
1862 | SUPDRVOBJTYPE_INTERNAL_NETWORK_INTERFACE,
|
---|
1863 | /** Single release event semaphore. */
|
---|
1864 | SUPDRVOBJTYPE_SEM_EVENT,
|
---|
1865 | /** Multiple release event semaphore. */
|
---|
1866 | SUPDRVOBJTYPE_SEM_EVENT_MULTI,
|
---|
1867 | /** Raw PCI device. */
|
---|
1868 | SUPDRVOBJTYPE_RAW_PCI_DEVICE,
|
---|
1869 | /** The first invalid object type in this end. */
|
---|
1870 | SUPDRVOBJTYPE_END,
|
---|
1871 | /** The usual 32-bit type size hack. */
|
---|
1872 | SUPDRVOBJTYPE_32_BIT_HACK = 0x7ffffff
|
---|
1873 | } SUPDRVOBJTYPE;
|
---|
1874 |
|
---|
1875 | /**
|
---|
1876 | * Object destructor callback.
|
---|
1877 | * This is called for reference counted objectes when the count reaches 0.
|
---|
1878 | *
|
---|
1879 | * @param pvObj The object pointer.
|
---|
1880 | * @param pvUser1 The first user argument.
|
---|
1881 | * @param pvUser2 The second user argument.
|
---|
1882 | */
|
---|
1883 | typedef DECLCALLBACK(void) FNSUPDRVDESTRUCTOR(void *pvObj, void *pvUser1, void *pvUser2);
|
---|
1884 | /** Pointer to a FNSUPDRVDESTRUCTOR(). */
|
---|
1885 | typedef FNSUPDRVDESTRUCTOR *PFNSUPDRVDESTRUCTOR;
|
---|
1886 |
|
---|
1887 | SUPR0DECL(void *) SUPR0ObjRegister(PSUPDRVSESSION pSession, SUPDRVOBJTYPE enmType, PFNSUPDRVDESTRUCTOR pfnDestructor, void *pvUser1, void *pvUser2);
|
---|
1888 | SUPR0DECL(int) SUPR0ObjAddRef(void *pvObj, PSUPDRVSESSION pSession);
|
---|
1889 | SUPR0DECL(int) SUPR0ObjAddRefEx(void *pvObj, PSUPDRVSESSION pSession, bool fNoBlocking);
|
---|
1890 | SUPR0DECL(int) SUPR0ObjRelease(void *pvObj, PSUPDRVSESSION pSession);
|
---|
1891 | SUPR0DECL(int) SUPR0ObjVerifyAccess(void *pvObj, PSUPDRVSESSION pSession, const char *pszObjName);
|
---|
1892 |
|
---|
1893 | SUPR0DECL(PVM) SUPR0GetSessionVM(PSUPDRVSESSION pSession);
|
---|
1894 | SUPR0DECL(PGVM) SUPR0GetSessionGVM(PSUPDRVSESSION pSession);
|
---|
1895 | SUPR0DECL(int) SUPR0SetSessionVM(PSUPDRVSESSION pSession, PGVM pGVM, PVM pVM);
|
---|
1896 |
|
---|
1897 | SUPR0DECL(int) SUPR0LockMem(PSUPDRVSESSION pSession, RTR3PTR pvR3, uint32_t cPages, PRTHCPHYS paPages);
|
---|
1898 | SUPR0DECL(int) SUPR0UnlockMem(PSUPDRVSESSION pSession, RTR3PTR pvR3);
|
---|
1899 | SUPR0DECL(int) SUPR0ContAlloc(PSUPDRVSESSION pSession, uint32_t cPages, PRTR0PTR ppvR0, PRTR3PTR ppvR3, PRTHCPHYS pHCPhys);
|
---|
1900 | SUPR0DECL(int) SUPR0ContFree(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr);
|
---|
1901 | SUPR0DECL(int) SUPR0LowAlloc(PSUPDRVSESSION pSession, uint32_t cPages, PRTR0PTR ppvR0, PRTR3PTR ppvR3, PRTHCPHYS paPages);
|
---|
1902 | SUPR0DECL(int) SUPR0LowFree(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr);
|
---|
1903 | SUPR0DECL(int) SUPR0MemAlloc(PSUPDRVSESSION pSession, uint32_t cb, PRTR0PTR ppvR0, PRTR3PTR ppvR3);
|
---|
1904 | SUPR0DECL(int) SUPR0MemGetPhys(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr, PSUPPAGE paPages);
|
---|
1905 | SUPR0DECL(int) SUPR0MemFree(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr);
|
---|
1906 | SUPR0DECL(int) SUPR0PageAllocEx(PSUPDRVSESSION pSession, uint32_t cPages, uint32_t fFlags, PRTR3PTR ppvR3, PRTR0PTR ppvR0, PRTHCPHYS paPages);
|
---|
1907 | SUPR0DECL(int) SUPR0PageMapKernel(PSUPDRVSESSION pSession, RTR3PTR pvR3, uint32_t offSub, uint32_t cbSub, uint32_t fFlags, PRTR0PTR ppvR0);
|
---|
1908 | SUPR0DECL(int) SUPR0PageProtect(PSUPDRVSESSION pSession, RTR3PTR pvR3, RTR0PTR pvR0, uint32_t offSub, uint32_t cbSub, uint32_t fProt);
|
---|
1909 | SUPR0DECL(int) SUPR0PageFree(PSUPDRVSESSION pSession, RTR3PTR pvR3);
|
---|
1910 | SUPR0DECL(int) SUPR0GipMap(PSUPDRVSESSION pSession, PRTR3PTR ppGipR3, PRTHCPHYS pHCPhysGip);
|
---|
1911 | SUPR0DECL(int) SUPR0GetSvmUsability(bool fInitSvm);
|
---|
1912 | SUPR0DECL(int) SUPR0GetVmxUsability(bool *pfIsSmxModeAmbiguous);
|
---|
1913 | SUPR0DECL(int) SUPR0GetRawModeUsability(void);
|
---|
1914 | SUPR0DECL(int) SUPR0GetCurrentGdtRw(RTHCUINTPTR *pGdtRw);
|
---|
1915 | SUPR0DECL(int) SUPR0QueryVTCaps(PSUPDRVSESSION pSession, uint32_t *pfCaps);
|
---|
1916 | SUPR0DECL(int) SUPR0GipUnmap(PSUPDRVSESSION pSession);
|
---|
1917 | SUPR0DECL(int) SUPR0QueryUcodeRev(PSUPDRVSESSION pSession, uint32_t *puMicrocodeRev);
|
---|
1918 | SUPR0DECL(SUPPAGINGMODE) SUPR0GetPagingMode(void);
|
---|
1919 | SUPR0DECL(RTCCUINTREG) SUPR0ChangeCR4(RTCCUINTREG fOrMask, RTCCUINTREG fAndMask);
|
---|
1920 | SUPR0DECL(int) SUPR0EnableVTx(bool fEnable);
|
---|
1921 | SUPR0DECL(bool) SUPR0SuspendVTxOnCpu(void);
|
---|
1922 | SUPR0DECL(void) SUPR0ResumeVTxOnCpu(bool fSuspended);
|
---|
1923 | #define SUP_TSCDELTA_MEASURE_F_FORCE RT_BIT_32(0)
|
---|
1924 | #define SUP_TSCDELTA_MEASURE_F_ASYNC RT_BIT_32(1)
|
---|
1925 | #define SUP_TSCDELTA_MEASURE_F_VALID_MASK UINT32_C(0x00000003)
|
---|
1926 | SUPR0DECL(int) SUPR0TscDeltaMeasureBySetIndex(PSUPDRVSESSION pSession, uint32_t iCpuSet, uint32_t fFlags,
|
---|
1927 | RTMSINTERVAL cMsWaitRetry, RTMSINTERVAL cMsWaitThread, uint32_t cTries);
|
---|
1928 |
|
---|
1929 | SUPR0DECL(void) SUPR0BadContext(PSUPDRVSESSION pSession, const char *pszFile, uint32_t uLine, const char *pszExpr);
|
---|
1930 |
|
---|
1931 | /** Context structure returned by SUPR0IoCtlSetup for use with
|
---|
1932 | * SUPR0IoCtlPerform and cleaned up by SUPR0IoCtlCleanup. */
|
---|
1933 | typedef struct SUPR0IOCTLCTX *PSUPR0IOCTLCTX;
|
---|
1934 |
|
---|
1935 | /**
|
---|
1936 | * Sets up a I/O control context for the given handle.
|
---|
1937 | *
|
---|
1938 | * @returns VBox status code.
|
---|
1939 | * @param pSession The support driver session.
|
---|
1940 | * @param hHandle The handle.
|
---|
1941 | * @param fFlags Flag, MBZ.
|
---|
1942 | * @param ppCtx Where the context is returned.
|
---|
1943 | */
|
---|
1944 | SUPR0DECL(int) SUPR0IoCtlSetupForHandle(PSUPDRVSESSION pSession, intptr_t hHandle, uint32_t fFlags, PSUPR0IOCTLCTX *ppCtx);
|
---|
1945 |
|
---|
1946 | /**
|
---|
1947 | * Cleans up the I/O control context when done.
|
---|
1948 | *
|
---|
1949 | * This won't close the handle passed to SUPR0IoCtlSetupForHandle.
|
---|
1950 | *
|
---|
1951 | * @returns VBox status code.
|
---|
1952 | * @param pCtx The I/O control context to cleanup.
|
---|
1953 | */
|
---|
1954 | SUPR0DECL(int) SUPR0IoCtlCleanup(PSUPR0IOCTLCTX pCtx);
|
---|
1955 |
|
---|
1956 | /**
|
---|
1957 | * Performs an I/O control operation.
|
---|
1958 | *
|
---|
1959 | * @returns VBox status code.
|
---|
1960 | * @param pCtx The I/O control context returned by
|
---|
1961 | * SUPR0IoCtlSetupForHandle.
|
---|
1962 | * @param uFunction The I/O control function to perform.
|
---|
1963 | * @param pvInput Pointer to input buffer (ring-0).
|
---|
1964 | * @param pvInputUser Ring-3 pointer corresponding to @a pvInput.
|
---|
1965 | * @param cbInput The amount of input. If zero, both input pointers
|
---|
1966 | * are expected to be NULL.
|
---|
1967 | * @param pvOutput Pointer to output buffer (ring-0).
|
---|
1968 | * @param pvOutputUser Ring-3 pointer corresponding to @a pvInput.
|
---|
1969 | * @param cbOutput The amount of input. If zero, both input pointers
|
---|
1970 | * are expected to be NULL.
|
---|
1971 | * @param piNativeRc Where to return the native return code. When
|
---|
1972 | * specified the VBox status code will typically be
|
---|
1973 | * VINF_SUCCESS and the caller have to consult this for
|
---|
1974 | * the actual result of the operation. (This saves
|
---|
1975 | * pointless status code conversion.) Optional.
|
---|
1976 | *
|
---|
1977 | * @note On unix systems where there is only one set of buffers possible,
|
---|
1978 | * pass the same pointers as input and output.
|
---|
1979 | */
|
---|
1980 | SUPR0DECL(int) SUPR0IoCtlPerform(PSUPR0IOCTLCTX pCtx, uintptr_t uFunction,
|
---|
1981 | void *pvInput, RTR3PTR pvInputUser, size_t cbInput,
|
---|
1982 | void *pvOutput, RTR3PTR pvOutputUser, size_t cbOutput,
|
---|
1983 | int32_t *piNativeRc);
|
---|
1984 |
|
---|
1985 | /**
|
---|
1986 | * Writes to the debugger and/or kernel log.
|
---|
1987 | *
|
---|
1988 | * The length of the formatted message is somewhat limited, so keep things short
|
---|
1989 | * and to the point.
|
---|
1990 | *
|
---|
1991 | * @returns Number of bytes written, mabye.
|
---|
1992 | * @param pszFormat IPRT format string.
|
---|
1993 | * @param ... Arguments referenced by the format string.
|
---|
1994 | */
|
---|
1995 | SUPR0DECL(int) SUPR0Printf(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);
|
---|
1996 |
|
---|
1997 | /**
|
---|
1998 | * Returns configuration flags of the host kernel.
|
---|
1999 | *
|
---|
2000 | * @returns Combination of SUPKERNELFEATURES_XXX flags.
|
---|
2001 | */
|
---|
2002 | SUPR0DECL(uint32_t) SUPR0GetKernelFeatures(void);
|
---|
2003 |
|
---|
2004 |
|
---|
2005 | /** @name Absolute symbols
|
---|
2006 | * Take the address of these, don't try call them.
|
---|
2007 | * @{ */
|
---|
2008 | SUPR0DECL(void) SUPR0AbsIs64bit(void);
|
---|
2009 | SUPR0DECL(void) SUPR0Abs64bitKernelCS(void);
|
---|
2010 | SUPR0DECL(void) SUPR0Abs64bitKernelSS(void);
|
---|
2011 | SUPR0DECL(void) SUPR0Abs64bitKernelDS(void);
|
---|
2012 | SUPR0DECL(void) SUPR0AbsKernelCS(void);
|
---|
2013 | SUPR0DECL(void) SUPR0AbsKernelSS(void);
|
---|
2014 | SUPR0DECL(void) SUPR0AbsKernelDS(void);
|
---|
2015 | SUPR0DECL(void) SUPR0AbsKernelES(void);
|
---|
2016 | SUPR0DECL(void) SUPR0AbsKernelFS(void);
|
---|
2017 | SUPR0DECL(void) SUPR0AbsKernelGS(void);
|
---|
2018 | /** @} */
|
---|
2019 |
|
---|
2020 | /**
|
---|
2021 | * Support driver component factory.
|
---|
2022 | *
|
---|
2023 | * Component factories are registered by drivers that provides services
|
---|
2024 | * such as the host network interface filtering and access to the host
|
---|
2025 | * TCP/IP stack.
|
---|
2026 | *
|
---|
2027 | * @remark Module dependencies and making sure that a component doesn't
|
---|
2028 | * get unloaded while in use, is the sole responsibility of the
|
---|
2029 | * driver/kext/whatever implementing the component.
|
---|
2030 | */
|
---|
2031 | typedef struct SUPDRVFACTORY
|
---|
2032 | {
|
---|
2033 | /** The (unique) name of the component factory. */
|
---|
2034 | char szName[56];
|
---|
2035 | /**
|
---|
2036 | * Queries a factory interface.
|
---|
2037 | *
|
---|
2038 | * The factory interface is specific to each component and will be be
|
---|
2039 | * found in the header(s) for the component alongside its UUID.
|
---|
2040 | *
|
---|
2041 | * @returns Pointer to the factory interfaces on success, NULL on failure.
|
---|
2042 | *
|
---|
2043 | * @param pSupDrvFactory Pointer to this structure.
|
---|
2044 | * @param pSession The SUPDRV session making the query.
|
---|
2045 | * @param pszInterfaceUuid The UUID of the factory interface.
|
---|
2046 | */
|
---|
2047 | DECLR0CALLBACKMEMBER(void *, pfnQueryFactoryInterface,(struct SUPDRVFACTORY const *pSupDrvFactory, PSUPDRVSESSION pSession, const char *pszInterfaceUuid));
|
---|
2048 | } SUPDRVFACTORY;
|
---|
2049 | /** Pointer to a support driver factory. */
|
---|
2050 | typedef SUPDRVFACTORY *PSUPDRVFACTORY;
|
---|
2051 | /** Pointer to a const support driver factory. */
|
---|
2052 | typedef SUPDRVFACTORY const *PCSUPDRVFACTORY;
|
---|
2053 |
|
---|
2054 | SUPR0DECL(int) SUPR0ComponentRegisterFactory(PSUPDRVSESSION pSession, PCSUPDRVFACTORY pFactory);
|
---|
2055 | SUPR0DECL(int) SUPR0ComponentDeregisterFactory(PSUPDRVSESSION pSession, PCSUPDRVFACTORY pFactory);
|
---|
2056 | SUPR0DECL(int) SUPR0ComponentQueryFactory(PSUPDRVSESSION pSession, const char *pszName, const char *pszInterfaceUuid, void **ppvFactoryIf);
|
---|
2057 |
|
---|
2058 |
|
---|
2059 | /** @name Tracing
|
---|
2060 | * @{ */
|
---|
2061 |
|
---|
2062 | /**
|
---|
2063 | * Tracer data associated with a provider.
|
---|
2064 | */
|
---|
2065 | typedef union SUPDRVTRACERDATA
|
---|
2066 | {
|
---|
2067 | /** Generic */
|
---|
2068 | uint64_t au64[2];
|
---|
2069 |
|
---|
2070 | /** DTrace data. */
|
---|
2071 | struct
|
---|
2072 | {
|
---|
2073 | /** Provider ID. */
|
---|
2074 | uintptr_t idProvider;
|
---|
2075 | /** The number of trace points provided. */
|
---|
2076 | uint32_t volatile cProvidedProbes;
|
---|
2077 | /** Whether we've invalidated this bugger. */
|
---|
2078 | bool fZombie;
|
---|
2079 | } DTrace;
|
---|
2080 | } SUPDRVTRACERDATA;
|
---|
2081 | /** Pointer to the tracer data associated with a provider. */
|
---|
2082 | typedef SUPDRVTRACERDATA *PSUPDRVTRACERDATA;
|
---|
2083 |
|
---|
2084 | /**
|
---|
2085 | * Probe location info for ring-0.
|
---|
2086 | *
|
---|
2087 | * Since we cannot trust user tracepoint modules, we need to duplicate the probe
|
---|
2088 | * ID and enabled flag in ring-0.
|
---|
2089 | */
|
---|
2090 | typedef struct SUPDRVPROBELOC
|
---|
2091 | {
|
---|
2092 | /** The probe ID. */
|
---|
2093 | uint32_t idProbe;
|
---|
2094 | /** Whether it's enabled or not. */
|
---|
2095 | bool fEnabled;
|
---|
2096 | } SUPDRVPROBELOC;
|
---|
2097 | /** Pointer to a ring-0 probe location record. */
|
---|
2098 | typedef SUPDRVPROBELOC *PSUPDRVPROBELOC;
|
---|
2099 |
|
---|
2100 | /**
|
---|
2101 | * Probe info for ring-0.
|
---|
2102 | *
|
---|
2103 | * Since we cannot trust user tracepoint modules, we need to duplicate the
|
---|
2104 | * probe enable count.
|
---|
2105 | */
|
---|
2106 | typedef struct SUPDRVPROBEINFO
|
---|
2107 | {
|
---|
2108 | /** The number of times this probe has been enabled. */
|
---|
2109 | uint32_t volatile cEnabled;
|
---|
2110 | } SUPDRVPROBEINFO;
|
---|
2111 | /** Pointer to a ring-0 probe info record. */
|
---|
2112 | typedef SUPDRVPROBEINFO *PSUPDRVPROBEINFO;
|
---|
2113 |
|
---|
2114 | /**
|
---|
2115 | * Support driver tracepoint provider core.
|
---|
2116 | */
|
---|
2117 | typedef struct SUPDRVVDTPROVIDERCORE
|
---|
2118 | {
|
---|
2119 | /** The tracer data member. */
|
---|
2120 | SUPDRVTRACERDATA TracerData;
|
---|
2121 | /** Pointer to the provider name (a copy that's always available). */
|
---|
2122 | const char *pszName;
|
---|
2123 | /** Pointer to the module name (a copy that's always available). */
|
---|
2124 | const char *pszModName;
|
---|
2125 |
|
---|
2126 | /** The provider descriptor. */
|
---|
2127 | struct VTGDESCPROVIDER *pDesc;
|
---|
2128 | /** The VTG header. */
|
---|
2129 | struct VTGOBJHDR *pHdr;
|
---|
2130 |
|
---|
2131 | /** The size of the entries in the pvProbeLocsEn table. */
|
---|
2132 | uint8_t cbProbeLocsEn;
|
---|
2133 | /** The actual module bit count (corresponds to cbProbeLocsEn). */
|
---|
2134 | uint8_t cBits;
|
---|
2135 | /** Set if this is a Umod, otherwise clear. */
|
---|
2136 | bool fUmod;
|
---|
2137 | /** Explicit alignment padding (paranoia). */
|
---|
2138 | uint8_t abAlignment[ARCH_BITS == 32 ? 1 : 5];
|
---|
2139 |
|
---|
2140 | /** The probe locations used for descriptive purposes. */
|
---|
2141 | struct VTGPROBELOC const *paProbeLocsRO;
|
---|
2142 | /** Pointer to the probe location array where the enable flag needs
|
---|
2143 | * flipping. For kernel providers, this will always be SUPDRVPROBELOC,
|
---|
2144 | * while user providers can either be 32-bit or 64-bit. Use
|
---|
2145 | * cbProbeLocsEn to calculate the address of an entry. */
|
---|
2146 | void *pvProbeLocsEn;
|
---|
2147 | /** Pointer to the probe array containing the enabled counts. */
|
---|
2148 | uint32_t *pacProbeEnabled;
|
---|
2149 |
|
---|
2150 | /** The ring-0 probe location info for user tracepoint modules.
|
---|
2151 | * This is NULL if fUmod is false. */
|
---|
2152 | PSUPDRVPROBELOC paR0ProbeLocs;
|
---|
2153 | /** The ring-0 probe info for user tracepoint modules.
|
---|
2154 | * This is NULL if fUmod is false. */
|
---|
2155 | PSUPDRVPROBEINFO paR0Probes;
|
---|
2156 |
|
---|
2157 | } SUPDRVVDTPROVIDERCORE;
|
---|
2158 | /** Pointer to a tracepoint provider core structure. */
|
---|
2159 | typedef SUPDRVVDTPROVIDERCORE *PSUPDRVVDTPROVIDERCORE;
|
---|
2160 |
|
---|
2161 | /** Pointer to a tracer registration record. */
|
---|
2162 | typedef struct SUPDRVTRACERREG const *PCSUPDRVTRACERREG;
|
---|
2163 | /**
|
---|
2164 | * Support driver tracer registration record.
|
---|
2165 | */
|
---|
2166 | typedef struct SUPDRVTRACERREG
|
---|
2167 | {
|
---|
2168 | /** Magic value (SUPDRVTRACERREG_MAGIC). */
|
---|
2169 | uint32_t u32Magic;
|
---|
2170 | /** Version (SUPDRVTRACERREG_VERSION). */
|
---|
2171 | uint32_t u32Version;
|
---|
2172 |
|
---|
2173 | /**
|
---|
2174 | * Fire off a kernel probe.
|
---|
2175 | *
|
---|
2176 | * @param pVtgProbeLoc The probe location record.
|
---|
2177 | * @param uArg0 The first raw probe argument.
|
---|
2178 | * @param uArg1 The second raw probe argument.
|
---|
2179 | * @param uArg2 The third raw probe argument.
|
---|
2180 | * @param uArg3 The fourth raw probe argument.
|
---|
2181 | * @param uArg4 The fifth raw probe argument.
|
---|
2182 | *
|
---|
2183 | * @remarks SUPR0TracerFireProbe will do a tail jump thru this member, so
|
---|
2184 | * no extra stack frames will be added.
|
---|
2185 | * @remarks This does not take a 'this' pointer argument because it doesn't map
|
---|
2186 | * well onto VTG or DTrace.
|
---|
2187 | *
|
---|
2188 | */
|
---|
2189 | DECLR0CALLBACKMEMBER(void, pfnProbeFireKernel, (struct VTGPROBELOC *pVtgProbeLoc, uintptr_t uArg0, uintptr_t uArg1, uintptr_t uArg2,
|
---|
2190 | uintptr_t uArg3, uintptr_t uArg4));
|
---|
2191 |
|
---|
2192 | /**
|
---|
2193 | * Fire off a user-mode probe.
|
---|
2194 | *
|
---|
2195 | * @param pThis Pointer to the registration record.
|
---|
2196 | *
|
---|
2197 | * @param pVtgProbeLoc The probe location record.
|
---|
2198 | * @param pSession The user session.
|
---|
2199 | * @param pCtx The usermode context info.
|
---|
2200 | * @param pVtgHdr The VTG header (read-only).
|
---|
2201 | * @param pProbeLocRO The read-only probe location record .
|
---|
2202 | */
|
---|
2203 | DECLR0CALLBACKMEMBER(void, pfnProbeFireUser, (PCSUPDRVTRACERREG pThis, PSUPDRVSESSION pSession, PCSUPDRVTRACERUSRCTX pCtx,
|
---|
2204 | struct VTGOBJHDR const *pVtgHdr, struct VTGPROBELOC const *pProbeLocRO));
|
---|
2205 |
|
---|
2206 | /**
|
---|
2207 | * Opens up the tracer.
|
---|
2208 | *
|
---|
2209 | * @returns VBox status code.
|
---|
2210 | * @param pThis Pointer to the registration record.
|
---|
2211 | * @param pSession The session doing the opening.
|
---|
2212 | * @param uCookie A cookie (magic) unique to the tracer, so it can
|
---|
2213 | * fend off incompatible clients.
|
---|
2214 | * @param uArg Tracer specific argument.
|
---|
2215 | * @param puSessionData Pointer to the session data variable. This must be
|
---|
2216 | * set to a non-zero value on success.
|
---|
2217 | */
|
---|
2218 | DECLR0CALLBACKMEMBER(int, pfnTracerOpen, (PCSUPDRVTRACERREG pThis, PSUPDRVSESSION pSession, uint32_t uCookie, uintptr_t uArg,
|
---|
2219 | uintptr_t *puSessionData));
|
---|
2220 |
|
---|
2221 | /**
|
---|
2222 | * I/O control style tracer communication method.
|
---|
2223 | *
|
---|
2224 | *
|
---|
2225 | * @returns VBox status code.
|
---|
2226 | * @param pThis Pointer to the registration record.
|
---|
2227 | * @param pSession The session.
|
---|
2228 | * @param uSessionData The session data value.
|
---|
2229 | * @param uCmd The tracer specific command.
|
---|
2230 | * @param uArg The tracer command specific argument.
|
---|
2231 | * @param piRetVal The tracer specific return value.
|
---|
2232 | */
|
---|
2233 | DECLR0CALLBACKMEMBER(int, pfnTracerIoCtl, (PCSUPDRVTRACERREG pThis, PSUPDRVSESSION pSession, uintptr_t uSessionData,
|
---|
2234 | uintptr_t uCmd, uintptr_t uArg, int32_t *piRetVal));
|
---|
2235 |
|
---|
2236 | /**
|
---|
2237 | * Cleans up data the tracer has associated with a session.
|
---|
2238 | *
|
---|
2239 | * @param pThis Pointer to the registration record.
|
---|
2240 | * @param pSession The session handle.
|
---|
2241 | * @param uSessionData The data assoicated with the session.
|
---|
2242 | */
|
---|
2243 | DECLR0CALLBACKMEMBER(void, pfnTracerClose, (PCSUPDRVTRACERREG pThis, PSUPDRVSESSION pSession, uintptr_t uSessionData));
|
---|
2244 |
|
---|
2245 | /**
|
---|
2246 | * Registers a provider.
|
---|
2247 | *
|
---|
2248 | * @returns VBox status code.
|
---|
2249 | * @param pThis Pointer to the registration record.
|
---|
2250 | * @param pCore The provider core data.
|
---|
2251 | *
|
---|
2252 | * @todo Kernel vs. Userland providers.
|
---|
2253 | */
|
---|
2254 | DECLR0CALLBACKMEMBER(int, pfnProviderRegister, (PCSUPDRVTRACERREG pThis, PSUPDRVVDTPROVIDERCORE pCore));
|
---|
2255 |
|
---|
2256 | /**
|
---|
2257 | * Attempts to deregisters a provider.
|
---|
2258 | *
|
---|
2259 | * @returns VINF_SUCCESS or VERR_TRY_AGAIN. If the latter, the provider
|
---|
2260 | * should be made as harmless as possible before returning as the
|
---|
2261 | * VTG object and associated code will be unloaded upon return.
|
---|
2262 | *
|
---|
2263 | * @param pThis Pointer to the registration record.
|
---|
2264 | * @param pCore The provider core data.
|
---|
2265 | */
|
---|
2266 | DECLR0CALLBACKMEMBER(int, pfnProviderDeregister, (PCSUPDRVTRACERREG pThis, PSUPDRVVDTPROVIDERCORE pCore));
|
---|
2267 |
|
---|
2268 | /**
|
---|
2269 | * Make another attempt at unregister a busy provider.
|
---|
2270 | *
|
---|
2271 | * @returns VINF_SUCCESS or VERR_TRY_AGAIN.
|
---|
2272 | * @param pThis Pointer to the registration record.
|
---|
2273 | * @param pCore The provider core data.
|
---|
2274 | */
|
---|
2275 | DECLR0CALLBACKMEMBER(int, pfnProviderDeregisterZombie, (PCSUPDRVTRACERREG pThis, PSUPDRVVDTPROVIDERCORE pCore));
|
---|
2276 |
|
---|
2277 | /** End marker (SUPDRVTRACERREG_MAGIC). */
|
---|
2278 | uintptr_t uEndMagic;
|
---|
2279 | } SUPDRVTRACERREG;
|
---|
2280 |
|
---|
2281 | /** Tracer magic (Kenny Garrett). */
|
---|
2282 | #define SUPDRVTRACERREG_MAGIC UINT32_C(0x19601009)
|
---|
2283 | /** Tracer registration structure version. */
|
---|
2284 | #define SUPDRVTRACERREG_VERSION RT_MAKE_U32(0, 1)
|
---|
2285 |
|
---|
2286 | /** Pointer to a trace helper structure. */
|
---|
2287 | typedef struct SUPDRVTRACERHLP const *PCSUPDRVTRACERHLP;
|
---|
2288 | /**
|
---|
2289 | * Helper structure.
|
---|
2290 | */
|
---|
2291 | typedef struct SUPDRVTRACERHLP
|
---|
2292 | {
|
---|
2293 | /** The structure version (SUPDRVTRACERHLP_VERSION). */
|
---|
2294 | uintptr_t uVersion;
|
---|
2295 |
|
---|
2296 | /** @todo ... */
|
---|
2297 |
|
---|
2298 | /** End marker (SUPDRVTRACERHLP_VERSION) */
|
---|
2299 | uintptr_t uEndVersion;
|
---|
2300 | } SUPDRVTRACERHLP;
|
---|
2301 | /** Tracer helper structure version. */
|
---|
2302 | #define SUPDRVTRACERHLP_VERSION RT_MAKE_U32(0, 1)
|
---|
2303 |
|
---|
2304 | SUPR0DECL(int) SUPR0TracerRegisterImpl(void *hMod, PSUPDRVSESSION pSession, PCSUPDRVTRACERREG pReg, PCSUPDRVTRACERHLP *ppHlp);
|
---|
2305 | SUPR0DECL(int) SUPR0TracerDeregisterImpl(void *hMod, PSUPDRVSESSION pSession);
|
---|
2306 | SUPR0DECL(int) SUPR0TracerRegisterDrv(PSUPDRVSESSION pSession, struct VTGOBJHDR *pVtgHdr, const char *pszName);
|
---|
2307 | SUPR0DECL(void) SUPR0TracerDeregisterDrv(PSUPDRVSESSION pSession);
|
---|
2308 | SUPR0DECL(int) SUPR0TracerRegisterModule(void *hMod, struct VTGOBJHDR *pVtgHdr);
|
---|
2309 | SUPR0DECL(void) SUPR0TracerFireProbe(struct VTGPROBELOC *pVtgProbeLoc, uintptr_t uArg0, uintptr_t uArg1, uintptr_t uArg2,
|
---|
2310 | uintptr_t uArg3, uintptr_t uArg4);
|
---|
2311 | SUPR0DECL(void) SUPR0TracerUmodProbeFire(PSUPDRVSESSION pSession, PSUPDRVTRACERUSRCTX pCtx);
|
---|
2312 | /** @} */
|
---|
2313 |
|
---|
2314 |
|
---|
2315 | /**
|
---|
2316 | * Service request callback function.
|
---|
2317 | *
|
---|
2318 | * @returns VBox status code.
|
---|
2319 | * @param pSession The caller's session.
|
---|
2320 | * @param uOperation The operation identifier.
|
---|
2321 | * @param u64Arg 64-bit integer argument.
|
---|
2322 | * @param pReqHdr The request header. Input / Output. Optional.
|
---|
2323 | */
|
---|
2324 | typedef DECLCALLBACK(int) FNSUPR0SERVICEREQHANDLER(PSUPDRVSESSION pSession, uint32_t uOperation,
|
---|
2325 | uint64_t u64Arg, PSUPR0SERVICEREQHDR pReqHdr);
|
---|
2326 | /** Pointer to a FNR0SERVICEREQHANDLER(). */
|
---|
2327 | typedef R0PTRTYPE(FNSUPR0SERVICEREQHANDLER *) PFNSUPR0SERVICEREQHANDLER;
|
---|
2328 |
|
---|
2329 |
|
---|
2330 | /** @defgroup grp_sup_r0_idc The IDC Interface
|
---|
2331 | * @{
|
---|
2332 | */
|
---|
2333 |
|
---|
2334 | /** The current SUPDRV IDC version.
|
---|
2335 | * This follows the usual high word / low word rules, i.e. high word is the
|
---|
2336 | * major number and it signifies incompatible interface changes. */
|
---|
2337 | #define SUPDRV_IDC_VERSION UINT32_C(0x00010000)
|
---|
2338 |
|
---|
2339 | /**
|
---|
2340 | * Inter-Driver Communication Handle.
|
---|
2341 | */
|
---|
2342 | typedef union SUPDRVIDCHANDLE
|
---|
2343 | {
|
---|
2344 | /** Padding for opaque usage.
|
---|
2345 | * Must be greater or equal in size than the private struct. */
|
---|
2346 | void *apvPadding[4];
|
---|
2347 | #ifdef SUPDRVIDCHANDLEPRIVATE_DECLARED
|
---|
2348 | /** The private view. */
|
---|
2349 | struct SUPDRVIDCHANDLEPRIVATE s;
|
---|
2350 | #endif
|
---|
2351 | } SUPDRVIDCHANDLE;
|
---|
2352 | /** Pointer to a handle. */
|
---|
2353 | typedef SUPDRVIDCHANDLE *PSUPDRVIDCHANDLE;
|
---|
2354 |
|
---|
2355 | SUPR0DECL(int) SUPR0IdcOpen(PSUPDRVIDCHANDLE pHandle, uint32_t uReqVersion, uint32_t uMinVersion,
|
---|
2356 | uint32_t *puSessionVersion, uint32_t *puDriverVersion, uint32_t *puDriverRevision);
|
---|
2357 | SUPR0DECL(int) SUPR0IdcCall(PSUPDRVIDCHANDLE pHandle, uint32_t iReq, void *pvReq, uint32_t cbReq);
|
---|
2358 | SUPR0DECL(int) SUPR0IdcClose(PSUPDRVIDCHANDLE pHandle);
|
---|
2359 | SUPR0DECL(PSUPDRVSESSION) SUPR0IdcGetSession(PSUPDRVIDCHANDLE pHandle);
|
---|
2360 | SUPR0DECL(int) SUPR0IdcComponentRegisterFactory(PSUPDRVIDCHANDLE pHandle, PCSUPDRVFACTORY pFactory);
|
---|
2361 | SUPR0DECL(int) SUPR0IdcComponentDeregisterFactory(PSUPDRVIDCHANDLE pHandle, PCSUPDRVFACTORY pFactory);
|
---|
2362 |
|
---|
2363 | /** @} */
|
---|
2364 |
|
---|
2365 | /** @name Ring-0 module entry points.
|
---|
2366 | *
|
---|
2367 | * These can be exported by ring-0 modules SUP are told to load.
|
---|
2368 | *
|
---|
2369 | * @{ */
|
---|
2370 | DECLEXPORT(int) ModuleInit(void *hMod);
|
---|
2371 | DECLEXPORT(void) ModuleTerm(void *hMod);
|
---|
2372 | /** @} */
|
---|
2373 |
|
---|
2374 |
|
---|
2375 | /** @} */
|
---|
2376 | #endif
|
---|
2377 |
|
---|
2378 |
|
---|
2379 | /** @name Trust Anchors and Certificates
|
---|
2380 | * @{ */
|
---|
2381 |
|
---|
2382 | /**
|
---|
2383 | * Trust anchor table entry (in generated Certificates.cpp).
|
---|
2384 | */
|
---|
2385 | typedef struct SUPTAENTRY
|
---|
2386 | {
|
---|
2387 | /** Pointer to the raw bytes. */
|
---|
2388 | const unsigned char *pch;
|
---|
2389 | /** Number of bytes. */
|
---|
2390 | unsigned cb;
|
---|
2391 | } SUPTAENTRY;
|
---|
2392 | /** Pointer to a trust anchor table entry. */
|
---|
2393 | typedef SUPTAENTRY const *PCSUPTAENTRY;
|
---|
2394 |
|
---|
2395 | /** Macro for simplifying generating the trust anchor tables. */
|
---|
2396 | #define SUPTAENTRY_GEN(a_abTA) { &a_abTA[0], sizeof(a_abTA) }
|
---|
2397 |
|
---|
2398 | /** All certificates we know. */
|
---|
2399 | extern SUPTAENTRY const g_aSUPAllTAs[];
|
---|
2400 | /** Number of entries in g_aSUPAllTAs. */
|
---|
2401 | extern unsigned const g_cSUPAllTAs;
|
---|
2402 |
|
---|
2403 | /** Software publisher certificate roots (Authenticode). */
|
---|
2404 | extern SUPTAENTRY const g_aSUPSpcRootTAs[];
|
---|
2405 | /** Number of entries in g_aSUPSpcRootTAs. */
|
---|
2406 | extern unsigned const g_cSUPSpcRootTAs;
|
---|
2407 |
|
---|
2408 | /** Kernel root certificates used by Windows. */
|
---|
2409 | extern SUPTAENTRY const g_aSUPNtKernelRootTAs[];
|
---|
2410 | /** Number of entries in g_aSUPNtKernelRootTAs. */
|
---|
2411 | extern unsigned const g_cSUPNtKernelRootTAs;
|
---|
2412 |
|
---|
2413 | /** Timestamp root certificates trusted by Windows. */
|
---|
2414 | extern SUPTAENTRY const g_aSUPTimestampTAs[];
|
---|
2415 | /** Number of entries in g_aSUPTimestampTAs. */
|
---|
2416 | extern unsigned const g_cSUPTimestampTAs;
|
---|
2417 |
|
---|
2418 | /** TAs we trust (the build certificate, Oracle VirtualBox). */
|
---|
2419 | extern SUPTAENTRY const g_aSUPTrustedTAs[];
|
---|
2420 | /** Number of entries in g_aSUPTrustedTAs. */
|
---|
2421 | extern unsigned const g_cSUPTrustedTAs;
|
---|
2422 |
|
---|
2423 | /** Supplemental certificates, like cross signing certificates. */
|
---|
2424 | extern SUPTAENTRY const g_aSUPSupplementalTAs[];
|
---|
2425 | /** Number of entries in g_aSUPTrustedTAs. */
|
---|
2426 | extern unsigned const g_cSUPSupplementalTAs;
|
---|
2427 |
|
---|
2428 | /** The build certificate. */
|
---|
2429 | extern const unsigned char g_abSUPBuildCert[];
|
---|
2430 | /** The size of the build certificate. */
|
---|
2431 | extern const unsigned g_cbSUPBuildCert;
|
---|
2432 |
|
---|
2433 | /** @} */
|
---|
2434 |
|
---|
2435 |
|
---|
2436 | /** @} */
|
---|
2437 |
|
---|
2438 | RT_C_DECLS_END
|
---|
2439 |
|
---|
2440 | #endif
|
---|
2441 |
|
---|