Reactos
at master 126 lines 4.7 kB view raw
1/* 2 * kernelspecs.h 3 * 4 * SAL 2 annotations for kernel mode drivers 5 * 6 * This file is part of the ReactOS DDK package. 7 * 8 * Contributor: 9 * Timo Kreuzer (timo.kreuzer@reactos.org) 10 * 11 * THIS SOFTWARE IS NOT COPYRIGHTED 12 * 13 * This source code is offered for use in the public domain. You may 14 * use, modify or distribute it freely. 15 * 16 * This code is distributed in the hope that it will be useful but 17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY 18 * DISCLAIMED. This includes but is not limited to warranties of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 20 * 21 */ 22#pragma once 23 24#define KERNELSPECS_H 25 26#include "driverspecs.h" 27 28#ifdef _PREFAST_ 29 30/* Make sure we have IRQL level definitions early */ 31#define DISPATCH_LEVEL 2 32#define APC_LEVEL 1 33#define PASSIVE_LEVEL 0 34#if defined(_X86_) 35#define HIGH_LEVEL 31 36#elif defined(_AMD64_) 37#define HIGH_LEVEL 15 38#elif defined(_ARM_) 39#define HIGH_LEVEL 15 40#elif defined(_IA64_) 41#define HIGH_LEVEL 15 42#elif defined(_ARM64_) 43#define HIGH_LEVEL 15 44#endif 45 46#undef _IRQL_always_function_max_ 47#undef _IRQL_always_function_min_ 48#undef _IRQL_inout_ 49#undef _IRQL_raises_ 50#undef _IRQL_requires_ 51#undef _IRQL_requires_max_ 52#undef _IRQL_requires_min_ 53#undef _IRQL_requires_same_ 54#undef _IRQL_restores_ 55#undef _IRQL_restores_global_ 56#undef _IRQL_saves_ 57#undef _IRQL_saves_global_ 58#undef _IRQL_uses_cancel_ 59#undef _IRQL_is_cancel_ 60#undef __drv_setsIRQL 61#undef __drv_raisesIRQL 62#undef __drv_requiresIRQL 63#undef __drv_maxIRQL 64#undef __drv_minIRQL 65#undef __drv_savesIRQL 66#undef __drv_savesIRQLGlobal 67#undef __drv_restoresIRQL 68#undef __drv_restoresIRQLGlobal 69#undef __drv_minFunctionIRQL 70#undef __drv_maxFunctionIRQL 71#undef __drv_sameIRQL 72#undef __drv_useCancelIRQL 73#undef __drv_isCancelIRQL 74 75#define _IRQL_always_function_max_(irql) _Pre_ _SA_annotes1(SAL_maxFunctionIrql,irql) 76#define _IRQL_always_function_min_(irql) _Pre_ _SA_annotes1(SAL_minFunctionIrql,irql) 77#define _IRQL_inout_ _IRQL_saves_ _IRQL_restores_ 78#define _IRQL_raises_(irql) _Post_ _SA_annotes1(SAL_raiseIRQL,irql) 79#define _IRQL_requires_(irql) _Pre_ _SA_annotes1(SAL_IRQL,irql) 80#define _IRQL_requires_max_(irql) _Pre_ _SA_annotes1(SAL_maxIRQL,irql) 81#define _IRQL_requires_min_(irql) _Pre_ _SA_annotes1(SAL_minIRQL,irql) 82#define _IRQL_requires_same_ _Post_ _SA_annotes0(SAL_sameIRQL) 83#define _IRQL_restores_ _Post_ _SA_annotes0(SAL_restoreIRQL) 84#define _IRQL_restores_global_(kind,param) _Post_ _SA_annotes2(SAL_restoreIRQLGlobal, #kind, param\t) 85#define _IRQL_saves_ _Post_ _SA_annotes0(SAL_saveIRQL) 86#define _IRQL_saves_global_(kind,param) _Post_ _SA_annotes2(SAL_saveIRQLGlobal,#kind, param\t) 87#define _IRQL_uses_cancel_ _Post_ _SA_annotes0(SAL_UseCancelIrql) 88#define _IRQL_is_cancel_ _IRQL_uses_cancel_ _Releases_nonreentrant_lock_(_Global_cancel_spin_lock_) \ 89 _At_(return, _IRQL_always_function_min_(DISPATCH_LEVEL) _IRQL_requires_(DISPATCH_LEVEL)) 90#define __drv_setsIRQL(irql) _Post_ _SA_annotes1(SAL_IRQL,irql) 91#define __drv_raisesIRQL(irql) _IRQL_raises_(irql) 92#define __drv_requiresIRQL(irql) _IRQL_requires_(irql) 93#define __drv_maxIRQL(irql) _IRQL_requires_max_(irql) 94#define __drv_minIRQL(irql) _IRQL_requires_min_(irql) 95#define __drv_savesIRQL _IRQL_saves_ 96#define __drv_savesIRQLGlobal(kind,param) _IRQL_saves_global_(kind,param) 97#define __drv_restoresIRQL _IRQL_restores_ 98#define __drv_restoresIRQLGlobal(kind,param) _IRQL_restores_global_(kind,param) 99#define __drv_minFunctionIRQL(irql) _IRQL_always_function_min_(irql) 100#define __drv_maxFunctionIRQL(irql) _IRQL_always_function_max_(irql) 101#define __drv_sameIRQL _IRQL_requires_same_ 102#define __drv_useCancelIRQL _IRQL_uses_cancel_ 103#define __drv_isCancelIRQL _IRQL_is_cancel_ 104 105#ifdef __cplusplus 106extern "C" { 107#endif 108 109__ANNOTATION(SAL_IRQL(__int64);) 110__ANNOTATION(SAL_raiseIRQL(__int64);) 111__ANNOTATION(SAL_maxIRQL(__int64);) 112__ANNOTATION(SAL_minIRQL(__int64);) 113__ANNOTATION(SAL_saveIRQL(void);) 114__ANNOTATION(SAL_saveIRQLGlobal(_In_ char *, ...);) 115__ANNOTATION(SAL_restoreIRQL(void);) 116__ANNOTATION(SAL_restoreIRQLGlobal(_In_ char *, ...);) 117__ANNOTATION(SAL_minFunctionIrql(__int64);) 118__ANNOTATION(SAL_maxFunctionIrql(__int64);) 119__ANNOTATION(SAL_sameIRQL(void);) 120__ANNOTATION(SAL_UseCancelIrql(void);) 121 122#ifdef __cplusplus 123} // extern "C" 124#endif 125 126#endif /* _PREFAST_ */