VirtualBox

Changeset 44385 in vbox for trunk/include/VBox


Ignore:
Timestamp:
Jan 25, 2013 6:00:16 PM (12 years ago)
Author:
vboxsync
Message:

CSAM: PVM -> PUVM for main interfaces, visibility cleanup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/csam.h

    r44373 r44385  
    44
    55/*
    6  * Copyright (C) 2006-2010 Oracle Corporation
     6 * Copyright (C) 2006-2013 Oracle Corporation
    77 *
    88 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3535
    3636/**
    37  * CSAM monitoring tag
     37 * CSAM monitoring tag.
    3838 * For use with CSAMR3MonitorPage
    3939 */
     
    5252
    5353/**
    54  * Check if this page needs to be analysed by CSAM.
    55  *
    56  * This function should only be called for supervisor pages and
    57  * only when CSAM is enabled. Leaving these selection criteria
    58  * to the caller simplifies the interface (PTE passing).
    59  *
    60  * Note the the page has not yet been synced, so the TLB trick
    61  * (which wasn't ever active anyway) cannot be applied.
    62  *
    63  * @returns true if the page should be marked not present because
    64  *          CSAM want need to scan it.
    65  * @returns false if the page was already scanned.
    66  * @param   pVM         The VM to operate on.
    67  * @param   GCPtr       GC pointer of page table entry
    68  */
    69 VMMDECL(bool) CSAMDoesPageNeedScanning(PVM pVM, RTRCUINTPTR GCPtr);
    70 
    71 /**
    72  * Check if this page was previously scanned by CSAM
    73  *
    74  * @returns true -> scanned, false -> not scanned
    75  * @param   pVM         The VM to operate on.
    76  * @param   pPage       GC page address
    77  */
    78 VMMDECL(bool) CSAMIsPageScanned(PVM pVM, RTRCPTR pPage);
    79 
    80 /**
    81  * Mark a page as scanned/not scanned
    82  *
    83  * @note: we always mark it as scanned, even if we haven't completely done so
    84  *
    85  * @returns VBox status code.
    86  * @param   pVM         The VM to operate on.
    87  * @param   pPage       GC page address (not necessarily aligned)
    88  * @param   fScanned    Mark as scanned or not scanned
    89  *
    90  */
    91 VMMDECL(int) CSAMMarkPage(PVM pVM, RTRCUINTPTR pPage, bool fScanned);
    92 
    93 
    94 /**
    95  * Remember a possible code page for later inspection
    96  *
    97  * @returns VBox status code.
    98  * @param   pVM         The VM to operate on.
    99  * @param   GCPtr       GC pointer of page
    100  */
    101 VMMDECL(void) CSAMMarkPossibleCodePage(PVM pVM, RTRCPTR GCPtr);
    102 
    103 /**
    10454 * Query CSAM state (enabled/disabled)
    10555 *
    106  * @returns 0 - disabled, 1 - enabled
    107  * @param   pVM         The VM to operate on.
     56 * @returns true / false.
     57 * @param   a_pVM         The shared VM handle.
     58 * @internal
    10859 */
    109 #define CSAMIsEnabled(pVM) (pVM->fCSAMEnabled && EMIsRawRing0Enabled(pVM))
     60#define CSAMIsEnabled(a_pVM) ((a_pVM)->fCSAMEnabled && EMIsRawRing0Enabled(a_pVM))
    11061
    111 /**
    112  * Turn on code scanning
    113  *
    114  * @returns VBox status code. (trap handled or not)
    115  * @param   pVM         The VM to operate on.
    116  */
    117 VMMDECL(int) CSAMEnableScanning(PVM pVM);
    118 
    119 /**
    120  * Turn off code scanning
    121  *
    122  * @returns VBox status code. (trap handled or not)
    123  * @param   pVM         The VM to operate on.
    124  */
    125 VMMDECL(int) CSAMDisableScanning(PVM pVM);
    126 
    127 
    128 /**
    129  * Check if this page needs to be analysed by CSAM
    130  *
    131  * @returns 0 - disabled, 1 - enabled
    132  * @param   pVM         The VM to operate on.
    133  * @param   pvFault     Fault address
    134  */
    135 VMMDECL(int) CSAMExecFault(PVM pVM, RTRCPTR pvFault);
    136 
    137 /**
    138  * Check if we've scanned this instruction before. If true, then we can emulate
    139  * it instead of returning to ring 3.
    140  *
    141  * @returns boolean
    142  * @param   pVM         The VM to operate on.
    143  * @param   GCPtr       GC pointer of page table entry
    144  */
    145 VMMDECL(bool) CSAMIsKnownDangerousInstr(PVM pVM, RTRCUINTPTR GCPtr);
     62VMM_INT_DECL(bool)      CSAMDoesPageNeedScanning(PVM pVM, RTRCUINTPTR GCPtr);
     63VMM_INT_DECL(bool)      CSAMIsPageScanned(PVM pVM, RTRCPTR pPage);
     64VMM_INT_DECL(int)       CSAMMarkPage(PVM pVM, RTRCUINTPTR pPage, bool fScanned);
     65VMM_INT_DECL(void)      CSAMMarkPossibleCodePage(PVM pVM, RTRCPTR GCPtr);
     66VMM_INT_DECL(int)       CSAMEnableScanning(PVM pVM);
     67VMM_INT_DECL(int)       CSAMDisableScanning(PVM pVM);
     68VMM_INT_DECL(int)       CSAMExecFault(PVM pVM, RTRCPTR pvFault);
     69VMM_INT_DECL(bool)      CSAMIsKnownDangerousInstr(PVM pVM, RTRCUINTPTR GCPtr);
    14670
    14771
     
    15276 */
    15377
    154 VMMR3DECL(bool) CSAMR3IsEnabled(PUVM pUVM);
     78VMMR3DECL(bool)         CSAMR3IsEnabled(PUVM pUVM);
     79VMMR3DECL(int)          CSAMR3SetScanningEnabled(PUVM pUVM, bool fEnabled);
    15580
    156 /**
    157  * Initializes the csam.
    158  *
    159  * @returns VBox status code.
    160  * @param   pVM         The VM to operate on.
    161  */
    162 VMMR3DECL(int) CSAMR3Init(PVM pVM);
     81VMMR3_INT_DECL(int)     CSAMR3Init(PVM pVM);
     82VMMR3_INT_DECL(void)    CSAMR3Relocate(PVM pVM, RTGCINTPTR offDelta);
     83VMMR3_INT_DECL(int)     CSAMR3Term(PVM pVM);
     84VMMR3_INT_DECL(int)     CSAMR3Reset(PVM pVM);
    16385
    164 /**
    165  * Applies relocations to data and code managed by this
    166  * component. This function will be called at init and
    167  * whenever the VMM need to relocate it self inside the GC.
    168  *
    169  * The csam will update the addresses used by the switcher.
    170  *
    171  * @param   pVM      The VM.
    172  * @param   offDelta Relocation delta.
    173  */
    174 VMMR3DECL(void) CSAMR3Relocate(PVM pVM, RTGCINTPTR offDelta);
     86VMMR3_INT_DECL(int)     CSAMR3FlushPage(PVM pVM, RTRCPTR addr);
     87VMMR3_INT_DECL(int)     CSAMR3RemovePage(PVM pVM, RTRCPTR addr);
     88VMMR3_INT_DECL(int)     CSAMR3CheckCode(PVM pVM, RTRCPTR pInstrGC);
     89VMMR3_INT_DECL(int)     CSAMR3CheckCodeEx(PVM pVM, PCPUMCTXCORE pCtxCore, RTRCPTR pInstrGC);
     90VMMR3_INT_DECL(int)     CSAMR3MarkCode(PVM pVM, RTRCPTR pInstr, uint32_t cbInstr, bool fScanned);
     91VMMR3_INT_DECL(int)     CSAMR3DoPendingAction(PVM pVM, PVMCPU pVCpu);
     92VMMR3_INT_DECL(int)     CSAMR3CheckGates(PVM pVM, uint32_t iGate, uint32_t cGates);
    17593
    176 /**
    177  * Terminates the csam.
    178  *
    179  * Termination means cleaning up and freeing all resources,
    180  * the VM it self is at this point powered off or suspended.
    181  *
    182  * @returns VBox status code.
    183  * @param   pVM         The VM to operate on.
    184  */
    185 VMMR3DECL(int) CSAMR3Term(PVM pVM);
    186 
    187 /**
    188  * CSAM reset callback.
    189  *
    190  * @returns VBox status code.
    191  * @param   pVM     The VM which is reset.
    192  */
    193 VMMR3DECL(int) CSAMR3Reset(PVM pVM);
    194 
    195 
    196 /**
    197  * Notify CSAM of a page flush
    198  *
    199  * @returns VBox status code
    200  * @param   pVM         The VM to operate on.
    201  * @param   addr        GC address of the page to flush
    202  */
    203 VMMR3DECL(int) CSAMR3FlushPage(PVM pVM, RTRCPTR addr);
    204 
    205 /**
    206  * Remove a CSAM monitored page. Use with care!
    207  *
    208  * @returns VBox status code
    209  * @param   pVM         The VM to operate on.
    210  * @param   addr        GC address of the page to flush
    211  */
    212 VMMR3DECL(int) CSAMR3RemovePage(PVM pVM, RTRCPTR addr);
    213 
    214 /**
    215  * Scan and analyse code
    216  *
    217  * @returns VBox status code.
    218  * @param   pVM         The VM to operate on.
    219  * @param   pCtxCore    CPU context
    220  * @param   pInstrGC    Instruction pointer
    221  */
    222 VMMR3DECL(int) CSAMR3CheckCodeEx(PVM pVM, PCPUMCTXCORE pCtxCore, RTRCPTR pInstrGC);
    223 
    224 /**
    225  * Scan and analyse code
    226  *
    227  * @returns VBox status code.
    228  * @param   pVM         The VM to operate on.
    229  * @param   pInstrGC    Instruction pointer (0:32 virtual address)
    230  */
    231 VMMR3DECL(int) CSAMR3CheckCode(PVM pVM, RTRCPTR pInstrGC);
    232 
    233 /**
    234  * Mark an instruction in a page as scanned/not scanned
    235  *
    236  * @returns VBox status code.
    237  * @param   pVM         The VM to operate on.
    238  * @param   pInstr      Instruction pointer
    239  * @param   cbInstr      Instruction size
    240  * @param   fScanned    Mark as scanned or not
    241  */
    242 VMMR3DECL(int) CSAMR3MarkCode(PVM pVM, RTRCPTR pInstr, uint32_t cbInstr, bool fScanned);
    243 
    244 /**
    245  * Perform any pending actions
    246  *
    247  * @returns VBox status code.
    248  * @param   pVM         The VM to operate on.
    249  * @param   pVCpu       The VMCPU to operate on.
    250  */
    251 VMMR3DECL(int) CSAMR3DoPendingAction(PVM pVM, PVMCPU pVCpu);
    252 
    253 /**
    254  * Monitors a code page (if not already monitored)
    255  *
    256  * @returns VBox status code
    257  * @param   pVM         The VM to operate on.
    258  * @param   pPageAddrGC The page to monitor
    259  * @param   enmTag      Monitor tag
    260  */
    261 VMMR3DECL(int) CSAMR3MonitorPage(PVM pVM, RTRCPTR pPageAddrGC, CSAMTAG enmTag);
    262 
    263 /**
    264  * Unmonitors a code page
    265  *
    266  * @returns VBox status code
    267  * @param   pVM         The VM to operate on.
    268  * @param   pPageAddrGC The page to monitor
    269  * @param   enmTag      Monitor tag
    270  */
    271 VMMR3DECL(int) CSAMR3UnmonitorPage(PVM pVM, RTRCPTR pPageAddrGC, CSAMTAG enmTag);
    272 
    273 /**
    274  * Analyse interrupt and trap gates
    275  *
    276  * @returns VBox status code.
    277  * @param   pVM         The VM to operate on.
    278  * @param   iGate       Start gate
    279  * @param   cGates      Number of gates to check
    280  */
    281 VMMR3DECL(int) CSAMR3CheckGates(PVM pVM, uint32_t iGate, uint32_t cGates);
    282 
    283 /**
    284  * Record previous call instruction addresses
    285  *
    286  * @returns VBox status code.
    287  * @param   pVM         The VM to operate on.
    288  * @param   GCPtrCall   Call address
    289  */
    290 VMMR3DECL(int) CSAMR3RecordCallAddress(PVM pVM, RTRCPTR GCPtrCall);
     94VMMR3DECL(int)          CSAMR3MonitorPage(PVM pVM, RTRCPTR pPageAddrGC, CSAMTAG enmTag);
     95VMMR3DECL(int)          CSAMR3UnmonitorPage(PVM pVM, RTRCPTR pPageAddrGC, CSAMTAG enmTag);
     96VMMR3DECL(int)          CSAMR3RecordCallAddress(PVM pVM, RTRCPTR GCPtrCall);
    29197
    29298/** @} */
     
    298104
    299105#endif
     106
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette