Bitdefender Hypervisor Memory Introspection
upperiface.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Bitdefender
3  * SPDX-License-Identifier: Apache-2.0
4  */
15 
16 #ifndef _UPPERIFACE_H_
17 #define _UPPERIFACE_H_
18 
19 #include "intro_types.h"
20 
21 #if !defined(INT_COMPILER_MSVC)
22 # define PRINTF_ATTRIBUTE __attribute__((format(printf, 3, 4)))
23 #else
24 # define PRINTF_ATTRIBUTE
25 #endif // !defined(INT_COMPILER_MSVC)
26 
27 //
28 // Core Functions exposed by the integrator.
29 //
30 
40 typedef INTSTATUS
43  _In_opt_ const CHAR *File,
44  _In_opt_ DWORD Line,
45  _In_z_ const CHAR *Format,
46  ...
47  );
48 
57 typedef INTSTATUS
59  _Outptr_ void **SpinLock,
60  _In_z_ PCHAR Name
61  );
62 
72 typedef INTSTATUS
74  _Inout_ _At_(*SpinLock, _Post_null_) void **SpinLock
75  );
76 
85 typedef INTSTATUS
87  _In_ void *SpinLock
88  );
89 
97 typedef INTSTATUS
99  _In_ void *SpinLock
100  );
101 
110 typedef INTSTATUS
112  _Outptr_ void **SpinLock,
113  _In_z_ PCHAR Name
114  );
115 
125 typedef INTSTATUS
127  _Inout_ _At_(*SpinLock, _Post_null_) void **SpinLock
128  );
129 
138 typedef INTSTATUS
140  _In_ void *SpinLock
141  );
142 
151 typedef INTSTATUS
153  _In_ void *SpinLock
154  );
155 
163 typedef INTSTATUS
165  _In_ void *SpinLock
166  );
167 
175 typedef INTSTATUS
177  _In_ void *SpinLock
178  );
179 
191 typedef INTSTATUS
193  _Out_ size_t *TotalHeapSize,
194  _Out_ size_t *FreeHeapSize
195  );
196 
204 typedef void
206  void
207  );
208 
214 typedef void
216  void
217  );
218 
229 typedef INTSTATUS
231  _Outptr_result_bytebuffer_(Size) void **Address,
232  _In_ size_t Size,
233  _In_ DWORD Tag
234  );
235 
246 typedef INTSTATUS
248  _Inout_ _At_(*Address, _Post_null_) void **Address,
249  _In_ DWORD Tag
250  );
251 
252 #pragma pack(push)
253 #pragma pack(8)
254 
262 typedef struct _UPPER_IFACE
263 {
269 
287 
288 #define UPPER_IFACE_VERSION_1 0x00010074
289 #define UPPER_IFACE_VERSION_1_SIZE sizeof(UPPER_IFACE)
290 
291 #define UPPER_IFACE_VERSION_LATEST UPPER_IFACE_VERSION_1
292 #define UPPER_IFACE_VERSION_LATEST_SIZE UPPER_IFACE_VERSION_1_SIZE
293 
294 #pragma pack(pop)
295 
296 #endif // _UPPERIFACE_H_
INTSTATUS(* PFUNC_HpAllocWithTagAndInfo)(void **Address, size_t Size, DWORD Tag)
Allocates a block of memory.
Definition: upperiface.h:230
#define _In_opt_
Definition: intro_sal.h:16
#define _Out_
Definition: intro_sal.h:22
PFUNC_IntQueryHeapSize QueryHeapSize
Definition: upperiface.h:283
INTSTATUS(* PFUNC_IntRwSpinLockReleaseExclusive)(void *SpinLock)
Release a spin rw-lock previously acquired in exclusive mode with UPPER_IFACE.RwSpinLockAcquireExclus...
Definition: upperiface.h:176
#define _In_
Definition: intro_sal.h:21
PFUNC_HpFreeWithTagAndInfo MemFreeWithTagAndInfo
Definition: upperiface.h:272
INTSTATUS PRINTF_ATTRIBUTE(* PFUNC_IntTracePrint)(const CHAR *File, DWORD Line, const CHAR *Format,...)
Provides print-like trace functionality for introcore.
Definition: upperiface.h:42
Interface that exposes basic services to the introspection engines.
Definition: upperiface.h:262
struct _UPPER_IFACE UPPER_IFACE
Interface that exposes basic services to the introspection engines.
PFUNC_HpAllocWithTagAndInfo MemAllocWithTagAndInfo
Definition: upperiface.h:271
DWORD Version
The version of the interface. Must match UPPER_IFACE_VERSION_1.
Definition: upperiface.h:265
Exposes the types and constants used by various Introcore APIs defined in glueiface.h.
QWORD Reserved
Definition: upperiface.h:268
INTSTATUS(* PFUNC_IntSpinLockUnInit)(void **SpinLock)
Uninits a spin lock.
Definition: upperiface.h:73
PFUNC_IntRwSpinLockAcquireShared RwSpinLockAcquireShared
Definition: upperiface.h:279
PFUNC_IntRwSpinLockReleaseShared RwSpinLockReleaseShared
Definition: upperiface.h:281
#define _Outptr_
Definition: intro_sal.h:19
INTSTATUS(* PFUNC_IntRwSpinLockAcquireShared)(void *SpinLock)
Acquires a spin rw-lock in shared mode.
Definition: upperiface.h:139
int INTSTATUS
The status data type.
Definition: introstatus.h:24
PFUNC_IntRwSpinLockAcquireExclusive RwSpinLockAcquireExclusive
Definition: upperiface.h:280
PFUNC_IntRwSpinLockUnInit RwSpinLockUnInit
Definition: upperiface.h:278
INTSTATUS(* PFUNC_IntSpinLockAcquire)(void *SpinLock)
Exclusively acquires a spin lock.
Definition: upperiface.h:86
PFUNC_IntBugCheck BugCheck
Definition: upperiface.h:284
INTSTATUS(* PFUNC_IntRwSpinLockAcquireExclusive)(void *SpinLock)
Acquires a spin rw-lock in exclusive mode.
Definition: upperiface.h:152
PFUNC_IntSpinLockAcquire SpinLockAcquire
Definition: upperiface.h:275
DWORD Size
The size of the interface.Must match UPPER_IFACE_VERSION_1_SIZE.
Definition: upperiface.h:267
INTSTATUS(* PFUNC_IntSpinLockInit)(void **SpinLock, PCHAR Name)
Initializes a spin lock.
Definition: upperiface.h:58
#define _Inout_
Definition: intro_sal.h:20
INTSTATUS(* PFUNC_IntRwSpinLockUnInit)(void **SpinLock)
Uninits a rw-spin lock.
Definition: upperiface.h:126
PFUNC_IntSpinLockRelease SpinLockRelease
Definition: upperiface.h:276
unsigned long long QWORD
Definition: intro_types.h:53
PFUNC_IntRwSpinLockInit RwSpinLockInit
Definition: upperiface.h:277
#define PRINTF_ATTRIBUTE
Definition: upperiface.h:22
void(* PFUNC_IntEnterDebugger)(void)
Breaks into the debugger.
Definition: upperiface.h:215
struct _UPPER_IFACE * PUPPER_IFACE
char * PCHAR
Definition: intro_types.h:56
#define _Outptr_result_bytebuffer_(expr)
Definition: intro_sal.h:24
INTSTATUS(* PFUNC_HpFreeWithTagAndInfo)(void **Address, DWORD Tag)
Frees a memory block previously allocated with UPPER_IFACE.MemAllocWithTagAndInfo.
Definition: upperiface.h:247
uint32_t DWORD
Definition: intro_types.h:49
PFUNC_IntEnterDebugger EnterDebugger
Definition: upperiface.h:285
INTSTATUS(* PFUNC_IntSpinLockRelease)(void *SpinLock)
Release a spin lock previously acquired with UPPER_IFACE.SpinLockAcquire.
Definition: upperiface.h:98
#define _At_(expr, arg)
Definition: intro_sal.h:23
PFUNC_IntSpinLockInit SpinLockInit
Definition: upperiface.h:273
#define _In_z_
Definition: intro_sal.h:17
INTSTATUS(* PFUNC_IntQueryHeapSize)(size_t *TotalHeapSize, size_t *FreeHeapSize)
Get the available free memory available to introcore.
Definition: upperiface.h:192
void(* PFUNC_IntBugCheck)(void)
Crashes the introspection engine.
Definition: upperiface.h:205
INTSTATUS(* PFUNC_IntRwSpinLockInit)(void **SpinLock, PCHAR Name)
Initializes a rw-spin lock.
Definition: upperiface.h:111
INTSTATUS(* PFUNC_IntRwSpinLockReleaseShared)(void *SpinLock)
Release a spin rw-lock previously acquired in shared mode with UPPER_IFACE.RwSpinLockAcquireShared.
Definition: upperiface.h:164
PFUNC_IntRwSpinLockReleaseExclusive RwSpinLockReleaseExclusive
Definition: upperiface.h:282
PFUNC_IntTracePrint TracePrint
Definition: upperiface.h:270
char CHAR
Definition: intro_types.h:56
PFUNC_IntSpinLockUnInit SpinLockUnInit
Definition: upperiface.h:274