https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8a68820429810dd187f64…
commit 8a68820429810dd187f64d37e47ab12f7432f410
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Sun Jun 27 11:18:49 2021 +0200
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Mon Jun 28 08:48:59 2021 +0200
[SDK] Add missing sal annotations in driverspecs.h and kernelspec.h
CORE-6706
---
sdk/include/ddk/kernelspecs.h | 4 ++
sdk/include/psdk/driverspecs.h | 157 +++++++++++++++++++++++------------------
2 files changed, 91 insertions(+), 70 deletions(-)
diff --git a/sdk/include/ddk/kernelspecs.h b/sdk/include/ddk/kernelspecs.h
index 0e3d2be3d37..46fccffc895 100644
--- a/sdk/include/ddk/kernelspecs.h
+++ b/sdk/include/ddk/kernelspecs.h
@@ -39,10 +39,13 @@
#define HIGH_LEVEL 15
#elif defined(_IA64_)
#define HIGH_LEVEL 15
+#elif defined(_ARM64_)
+#define HIGH_LEVEL 15
#endif
#undef _IRQL_always_function_max_
#undef _IRQL_always_function_min_
+#undef _IRQL_inout_
#undef _IRQL_raises_
#undef _IRQL_requires_
#undef _IRQL_requires_max_
@@ -71,6 +74,7 @@
#define _IRQL_always_function_max_(irql) _Pre_ _SA_annotes1(SAL_maxFunctionIrql,irql)
#define _IRQL_always_function_min_(irql) _Pre_ _SA_annotes1(SAL_minFunctionIrql,irql)
+#define _IRQL_inout_ _IRQL_saves_ _IRQL_restores_
#define _IRQL_raises_(irql) _Post_ _SA_annotes1(SAL_raiseIRQL,irql)
#define _IRQL_requires_(irql) _Pre_ _SA_annotes1(SAL_IRQL,irql)
#define _IRQL_requires_max_(irql) _Pre_ _SA_annotes1(SAL_maxIRQL,irql)
diff --git a/sdk/include/psdk/driverspecs.h b/sdk/include/psdk/driverspecs.h
index a15fb26e1e4..b440566d460 100644
--- a/sdk/include/psdk/driverspecs.h
+++ b/sdk/include/psdk/driverspecs.h
@@ -25,7 +25,6 @@
#define _IRQL_raises_(irql)
#define _IRQL_requires_(irql)
#define _IRQL_requires_max_(irql)
-#define _IRQL_requires_max_defined
#define _IRQL_requires_min_(irql)
#define _IRQL_requires_same_
#define _IRQL_restores_
@@ -35,6 +34,13 @@
#define _IRQL_uses_cancel_
#define __drv_setsIRQL(irql)
+#undef _IRQL_inout_
+#define _IRQL_inout_ _IRQL_saves_ _IRQL_restores_
+#define _IRQL_limited_to_(level) ASSERT(KeGetCurrentIrql() <=
level); \
+ _Analysis_assume_(KeGetCurrentIrql()
<= level);
+
+#define _Analysis_assume_section_locked_(name) __AnalysisAssumeLockedSection(name)
+#define _Analysis_assume_section_unlocked_(name)
__AnalysisAssumeUnlockedSection(name)
#define _Dispatch_type_(x) _Function_class_(x)
#define _Kernel_clear_do_init_(yesNo) _Post_
_SA_annotes1(SAL_clearDoInit,yesNo)
#define _Kernel_float_restored_ _Post_
_SA_annotes0(SAL_floatRestored)
@@ -45,7 +51,7 @@
#define _Kernel_requires_resource_held_(kind) _Pre_ _SA_annotes1(SAL_mustHold,
#kind)
#define _Kernel_requires_resource_not_held_(kind) _Pre_ _SA_annotes1(SAL_neverHold,
#kind)
#define _Kernel_acquires_resource_(kind) _Post_ _SA_annotes1(SAL_acquire,
#kind)
-#define _Landmark_(name)
+#define _Landmark_(name) _SA_annotes1(SAL_landmark, #name)
#define __drv_acquiresCancelSpinLock
_Acquires_nonreentrant_lock_(_Global_cancel_spin_lock_)
#define __drv_acquiresCriticalRegion
_Acquires_lock_(_Global_critical_region_)
#define __drv_acquiresExclusiveResource(kind) _Acquires_nonreentrant_lock_(_Curr_)
@@ -78,63 +84,67 @@
#define __drv_in_deref(annotes) _Pre_ __deref _Group_(annotes)
#define __drv_in(annotes) _Pre_ _Group_(annotes)
#define __drv_innerAcquiresGlobal(kind,param) _Post_
_SA_annotes2(SAL_acquireGlobal, #kind, param\t)
-#define __drv_innerMustHoldGlobal(kind,param)
-#define __drv_innerNeverHoldGlobal(kind,param)
-#define __drv_innerReleasesGlobal(kind,param)
-#define __drv_interlocked
-#define __drv_inTry
-#define __drv_IoGetDmaAdapter
+#define __drv_innerMustHoldGlobal(kind,param) _Pre_
_SA_annotes2(SAL_mustHoldGlobal, #kind, param\t)
+#define __drv_innerNeverHoldGlobal(kind,param) _Pre_
_SA_annotes2(SAL_neverHoldGlobal, #kind, param\t)
+#define __drv_innerReleasesGlobal(kind,param) _Post_
_SA_annotes2(SAL_releaseGlobal,#kind, param\t)
+#define __drv_interlocked _Interlocked_operand_
+#define __drv_inTry _Pre_ _SA_annotes1(SAL_inTry,__yes)
+#define __drv_IoGetDmaAdapter _Kernel_IoGetDmaAdapter_
#define __drv_isCancelIRQL _IRQL_is_cancel_
-#define __drv_isObjectPointer
-#define __drv_KMDF
-#define __drv_maxFunctionIRQL(irql)
-#define __drv_maxIRQL(irql)
-#define __drv_minFunctionIRQL(irql)
-#define __drv_minIRQL(irql)
-#define __drv_Mode_impl(x)
-#define __drv_mustHold(kind)
-#define __drv_mustHoldCancelSpinLock
-#define __drv_mustHoldCriticalRegion
-#define __drv_mustHoldGlobal(kind,param)
-#define __drv_mustHoldPriorityRegion
-#define __drv_NDIS
-#define __drv_neverHold(kind)
-#define __drv_neverHoldCancelSpinLock
-#define __drv_neverHoldCriticalRegion
-#define __drv_neverHoldGlobal(kind,param)
-#define __drv_neverHoldPriorityRegion
-#define __drv_nonConstant
-#define __drv_notInTry
-#define __drv_notPointer
-#define __drv_out_deref(annotes)
-#define __drv_out(annotes)
-#define __drv_preferredFunction(func,why)
-#define __drv_raisesIRQL(irql)
-#define __drv_releasesCancelSpinLock
-#define __drv_releasesCriticalRegion
-#define __drv_releasesExclusiveResource(kind)
-#define __drv_releasesExclusiveResourceGlobal(kind,param)
-#define __drv_releasesPriorityRegion
-#define __drv_releasesResource(kind)
-#define __drv_releasesResourceGlobal(kind,param)
-#define __drv_reportError(why)
-#define __drv_requiresIRQL(irql)
-#define __drv_restoresIRQL
-#define __drv_restoresIRQLGlobal(kind,param)
-#define __drv_ret(annotes)
-#define __drv_sameIRQL
-#define __drv_savesIRQL
-#define __drv_savesIRQLGlobal(kind,param)
-#define __drv_strictType(typename,mode)
-#define __drv_strictTypeMatch(mode)
-#define __drv_unit(p)
-#define __drv_useCancelIRQL
-#define __drv_valueIs(arglist)
-#define __drv_WDM
-#define __drv_when(cond,annotes)
-#define __internal_kernel_driver
-#define __kernel_code
-#define __kernel_driver
+#define __drv_isObjectPointer _Points_to_data_
+#define __drv_KMDF __drv_Mode_impl(KMDF)
+#define __drv_maxFunctionIRQL(irql) _IRQL_always_function_max_(irql)
+#define __drv_maxIRQL(irql) _IRQL_requires_max_(irql)
+#define __drv_minFunctionIRQL(irql) _IRQL_always_function_min_(irql)
+#define __drv_minIRQL(irql) _IRQL_requires_min_(irql)
+#define __drv_Mode_impl(x) _Landmark_(x) __inline void
__GENSYM(__SAL_dummy_)(void){}
+#define __drv_mustHold(kind)
_When_(!_Arg_comp_(#kind,"Memory"), _Requires_lock_held_(_Curr_)) \
+
_When_(_Arg_comp_(#kind,"Memory"), _Kernel_requires_resource_held_(kind))
+#define __drv_mustHoldCancelSpinLock
_Requires_lock_held_(_Global_cancel_spin_lock_)
+#define __drv_mustHoldCriticalRegion
_Requires_lock_held_(_Global_critical_region_)
+#define __drv_mustHoldGlobal(kind,param) _Requires_lock_held_(param)
+#define __drv_mustHoldPriorityRegion
_Requires_lock_held_(_Global_priority_region_)
+#define __drv_NDIS __drv_Mode_impl(NDIS)
+#define __drv_neverHold(kind) _Requires_lock_not_held_(_Curr_)
+#define __drv_neverHoldCancelSpinLock
_Requires_lock_not_held_(_Global_cancel_spin_lock_)
+#define __drv_neverHoldCriticalRegion
_Requires_lock_not_held_(_Global_critical_region_)
+#define __drv_neverHoldGlobal(kind,param) _Requires_lock_not_held_(param)
+#define __drv_neverHoldPriorityRegion
_Requires_lock_not_held_(_Global_priority_region_)
+#define __drv_nonConstant _Notliteral_
+#define __drv_notInTry _Pre_ _SA_annotes1(SAL_inTry,__no)
+#define __drv_notPointer _Pre_
_SA_annotes1(SAL_mayBePointer,__no)
+#define __drv_out_deref(annotes) _Post_ __deref _Group_(annotes)
+#define __drv_out(annotes) _Post_ _Group_(annotes)
+#define __drv_preferredFunction(func,why) _Pre_
_SA_annotes2(SAL_preferredFunction, func, why)
+#define __drv_raisesIRQL _IRQL_raises_
+#define __drv_releasesCancelSpinLock
_Releases_nonreentrant_lock_(_Global_cancel_spin_lock_)
+#define __drv_releasesCriticalRegion
_Releases_lock_(_Global_critical_region_)
+#define __drv_releasesExclusiveResource(kind) _Releases_nonreentrant_lock_(_Curr_)
+#define __drv_releasesExclusiveResourceGlobal(kind, param)
_Releases_nonreentrant_lock_(param)
+#define __drv_releasesPriorityRegion
_Releases_lock_(_Global_priority_region_)
+#define __drv_releasesResource(kind) _Releases_lock_(_Curr_)
+#define __drv_releasesResourceGlobal(kind, param) _Releases_lock_(param)
+#define __drv_reportError(why) _Pre_ _SA_annotes1(SAL_error,why)
+#define __drv_requiresIRQL(irql) _IRQL_requires_(irql)
+#define __drv_restoresIRQL _IRQL_restores_
+#define __drv_restoresIRQLGlobal(kind,param) _IRQL_restores_global_(kind,param)
+#define __drv_ret(annotes) _At_(return,annotes)
+#define __drv_sameIRQL _IRQL_requires_same_
+#define __drv_savesIRQL _IRQL_saves_
+#define __drv_savesIRQLGlobal(kind,param) _IRQL_saves_global_(kind,param)
+#define __drv_strictType(typename,mode) _Pre_ _SA_annotes2(SAL_strictType,
typename, mode)
+#define __drv_strictTypeMatch(mode) _Pre_
_SA_annotes1(SAL_strictTypeMatch,mode)
+#define __drv_unit(p) typedef int ___drv_unit_##p
__GENSYM(__prefast_flag_kernel_driver_mode);
+#define __drv_useCancelIRQL _IRQL_uses_cancel_
+#define __drv_valueIs(arglist) _Post_
_SA_annotes1(SAL_return,arglist)
+#define __drv_WDM __drv_Mode_impl(WDM)
+#define __drv_when(cond, annotes) _When_(cond, annotes)
+#define __internal_kernel_driver
_Analysis_mode_(_Analysis_internal_kernel_driver_) \
+
_Analysis_mode_(_Analysis_local_leak_checks_)
+#define __kernel_code
_Analysis_mode_(_Analysis_code_type_kernel_code_) \
+
_Analysis_mode_(_Analysis_local_leak_checks_)
+#define __kernel_driver
_Analysis_mode_(_Analysis_code_type_kernel_driver_) \
+
_Analysis_mode_(_Analysis_local_leak_checks_)
#define __prefast_operator_new_null \
void* __cdecl operator new(size_t size) throw(); \
void* __cdecl operator new[](size_t size) throw(); \
@@ -143,13 +153,15 @@
void* __cdecl operator new(size_t size) throw(std::bad_alloc); \
void* __cdecl operator new[](size_t size) throw(std::bad_alloc); \
_Analysis_mode_(_Analysis_operator_new_throw_)
-#define __user_code
-#define __user_driver
-#define ___drv_unit_internal_kernel_driver
-#define ___drv_unit_kernel_code
-#define ___drv_unit_kernel_driver
-#define ___drv_unit_user_code
-#define ___drv_unit_user_driver
+#define __user_code
_Analysis_mode_(_Analysis_code_type_user_code_) \
+
_Analysis_mode_(_Analysis_local_leak_checks_)
+#define __user_driver
_Analysis_mode_(_Analysis_code_type_user_driver_) \
+
_Analysis_mode_(_Analysis_local_leak_checks_)
+#define ___drv_unit_internal_kernel_driver
_SA_annotes0(SAL_internal_kernel_driver)
+#define ___drv_unit_kernel_code _SA_annotes0(SAL_kernel)
_SA_annotes0(SAL_nodriver)
+#define ___drv_unit_kernel_driver _SA_annotes0(SAL_kernel)
_SA_annotes0(SAL_driver)
+#define ___drv_unit_user_code _SA_annotes0(SAL_nokernel)
_SA_annotes0(SAL_nodriver)
+#define ___drv_unit_user_driver _SA_annotes0(SAL_nokernel)
_SA_annotes0(SAL_driver)
#define __drv_typeConst 0
#define __drv_typeCond 1
@@ -160,6 +172,10 @@
extern "C" {
#endif
+extern int _Global_priority_region_;
+__inline __nothrow void __AnalysisAssumeLockedSection(__In_impl_ char *p);
+__inline __nothrow void __AnalysisAssumeUnlockedSection(__In_impl_ char *p);
+
__ANNOTATION(SAL_neverHold(_In_ char *);)
__ANNOTATION(SAL_neverHoldGlobal(__In_impl_ char *, ...);)
__ANNOTATION(SAL_acquire(_In_ char *);)
@@ -168,7 +184,6 @@ __ANNOTATION(SAL_floatUsed(void);)
__ANNOTATION(SAL_floatSaved(void);)
__ANNOTATION(SAL_floatRestored(void);)
__ANNOTATION(SAL_clearDoInit(enum __SAL_YesNo);)
-__ANNOTATION(SAL_maxIRQL(__int64);)
__ANNOTATION(SAL_IsAliased(void);)
__ANNOTATION(SAL_NeedsRelease(enum __SAL_YesNo);)
__ANNOTATION(SAL_mustHold(_In_ char *);)
@@ -192,10 +207,10 @@ __ANNOTATION(SAL_error2(__In_impl_ __AuToQuOtE char *, __In_impl_
__int64);)
__ANNOTATION(SAL_IsFormatString(__In_impl_ char *);)
__ANNOTATION(SAL_completionType(__In_impl_ __AuToQuOtE char *);)
__ANNOTATION(SAL_callbackType(__In_impl_ __AuToQuOtE char *);)
-//__PRIMOP(int, _Holds_resource_(__In_impl_ __deferTypecheck char *,__In_impl_ char *);)
-//__PRIMOP(int, _Holds_resource_global_(__In_impl_ char *, ...);)
-//__PRIMOP(int, _Is_kernel_(void);)
-//__PRIMOP(int, _Is_driver_(void);)
+__PRIMOP(int, _Holds_resource_(__In_impl_ __deferTypecheck char *,__In_impl_ char *);)
+__PRIMOP(int, _Holds_resource_global_(__In_impl_ char *, ...);)
+__PRIMOP(int, _Is_kernel_(void);)
+__PRIMOP(int, _Is_driver_(void);)
#ifdef __cplusplus
}
@@ -204,6 +219,8 @@ __ANNOTATION(SAL_callbackType(__In_impl_ __AuToQuOtE char *);)
#else
/* Dummys */
+#define _Analysis_assume_section_locked_(name)
+#define _Analysis_assume_section_unlocked_(name)
#define _Dispatch_type_(type)
#define _IRQL_always_function_max_(irql)
#define _IRQL_always_function_min_(irql)