1 | /** @file
|
---|
2 | * CSAM - Guest OS Code Scanning and Analyis Manager.
|
---|
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_vmm_csam_h
|
---|
27 | #define ___VBox_vmm_csam_h
|
---|
28 |
|
---|
29 | #include <VBox/types.h>
|
---|
30 |
|
---|
31 | #if defined(VBOX_WITH_RAW_MODE) || defined(DOXYGEN_RUNNING)
|
---|
32 |
|
---|
33 | /** @defgroup grp_csam The Code Scanning and Analysis API
|
---|
34 | * @ingroup grp_vmm
|
---|
35 | * @{
|
---|
36 | */
|
---|
37 |
|
---|
38 | /**
|
---|
39 | * CSAM monitoring tag.
|
---|
40 | * For use with CSAMR3MonitorPage
|
---|
41 | */
|
---|
42 | typedef enum CSAMTAG
|
---|
43 | {
|
---|
44 | CSAM_TAG_INVALID = 0,
|
---|
45 | CSAM_TAG_REM,
|
---|
46 | CSAM_TAG_PATM,
|
---|
47 | CSAM_TAG_CSAM,
|
---|
48 | CSAM_TAG_32BIT_HACK = 0x7fffffff
|
---|
49 | } CSAMTAG;
|
---|
50 |
|
---|
51 |
|
---|
52 | RT_C_DECLS_BEGIN
|
---|
53 |
|
---|
54 |
|
---|
55 | /**
|
---|
56 | * Query CSAM state (enabled/disabled)
|
---|
57 | *
|
---|
58 | * @returns true / false.
|
---|
59 | * @param a_pVM The shared VM handle.
|
---|
60 | * @internal
|
---|
61 | */
|
---|
62 | #define CSAMIsEnabled(a_pVM) ((a_pVM)->fCSAMEnabled && EMIsRawRing0Enabled(a_pVM))
|
---|
63 |
|
---|
64 | VMM_INT_DECL(bool) CSAMDoesPageNeedScanning(PVM pVM, RTRCUINTPTR GCPtr);
|
---|
65 | VMM_INT_DECL(bool) CSAMIsPageScanned(PVM pVM, RTRCPTR pPage);
|
---|
66 | VMM_INT_DECL(int) CSAMMarkPage(PVM pVM, RTRCUINTPTR pPage, bool fScanned);
|
---|
67 | VMM_INT_DECL(void) CSAMMarkPossibleCodePage(PVM pVM, RTRCPTR GCPtr);
|
---|
68 | VMM_INT_DECL(int) CSAMEnableScanning(PVM pVM);
|
---|
69 | VMM_INT_DECL(int) CSAMDisableScanning(PVM pVM);
|
---|
70 | VMM_INT_DECL(int) CSAMExecFault(PVM pVM, RTRCPTR pvFault);
|
---|
71 | VMM_INT_DECL(bool) CSAMIsKnownDangerousInstr(PVM pVM, RTRCUINTPTR GCPtr);
|
---|
72 |
|
---|
73 |
|
---|
74 | #ifdef IN_RING3
|
---|
75 | /** @defgroup grp_csam_r3 The CSAM ring-3 Context API
|
---|
76 | * @{
|
---|
77 | */
|
---|
78 |
|
---|
79 | VMMR3DECL(bool) CSAMR3IsEnabled(PUVM pUVM);
|
---|
80 | VMMR3DECL(int) CSAMR3SetScanningEnabled(PUVM pUVM, bool fEnabled);
|
---|
81 |
|
---|
82 | VMMR3_INT_DECL(int) CSAMR3Init(PVM pVM);
|
---|
83 | VMMR3_INT_DECL(void) CSAMR3Relocate(PVM pVM, RTGCINTPTR offDelta);
|
---|
84 | VMMR3_INT_DECL(int) CSAMR3Term(PVM pVM);
|
---|
85 | VMMR3_INT_DECL(int) CSAMR3Reset(PVM pVM);
|
---|
86 |
|
---|
87 | VMMR3_INT_DECL(int) CSAMR3FlushPage(PVM pVM, RTRCPTR addr);
|
---|
88 | VMMR3_INT_DECL(int) CSAMR3RemovePage(PVM pVM, RTRCPTR addr);
|
---|
89 | VMMR3_INT_DECL(int) CSAMR3CheckCode(PVM pVM, RTRCPTR pInstrGC);
|
---|
90 | VMMR3_INT_DECL(int) CSAMR3CheckCodeEx(PVM pVM, PCPUMCTX pCtx, RTRCPTR pInstrGC);
|
---|
91 | VMMR3_INT_DECL(int) CSAMR3MarkCode(PVM pVM, RTRCPTR pInstr, uint32_t cbInstr, bool fScanned);
|
---|
92 | VMMR3_INT_DECL(int) CSAMR3DoPendingAction(PVM pVM, PVMCPU pVCpu);
|
---|
93 | VMMR3_INT_DECL(int) CSAMR3CheckGates(PVM pVM, uint32_t iGate, uint32_t cGates);
|
---|
94 |
|
---|
95 | VMMR3DECL(int) CSAMR3MonitorPage(PVM pVM, RTRCPTR pPageAddrGC, CSAMTAG enmTag);
|
---|
96 | VMMR3DECL(int) CSAMR3UnmonitorPage(PVM pVM, RTRCPTR pPageAddrGC, CSAMTAG enmTag);
|
---|
97 | VMMR3DECL(int) CSAMR3RecordCallAddress(PVM pVM, RTRCPTR GCPtrCall);
|
---|
98 |
|
---|
99 | /** @} */
|
---|
100 | #endif
|
---|
101 |
|
---|
102 |
|
---|
103 | /** @} */
|
---|
104 | RT_C_DECLS_END
|
---|
105 |
|
---|
106 | #endif /* VBOX_WITH_RAW_MODE */
|
---|
107 |
|
---|
108 | #endif
|
---|
109 |
|
---|