2 * PROJECT: MSVC runtime check support library
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * PURPOSE: Provides support functions for MSVC runtime checks
5 * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
13 const char *fmt
, ...);
50 int i
, *guard1
, *guard2
;
52 /* Loop all variables in the descriptor */
53 for (i
= 0; i
< _Fd
->varCount
; i
++)
55 /* Get the 2 guards below and above the variable */
56 guard1
= (int*)((char*)_Esp
+ _Fd
->variables
[i
].addr
- sizeof(*guard1
));
57 guard2
= (int*)((char*)_Esp
+ _Fd
->variables
[i
].addr
+_Fd
->variables
[i
].size
);
59 /* Check if they contain the guard bytes */
60 if ((*guard1
!= 0xCCCCCCCC) || (*guard2
!= 0xCCCCCCCC))
72 _RTC_ALLOCA_NODE
*_AllocaList
)
74 _RTC_ALLOCA_NODE
*current
;
77 /* Process normal variables */
78 _RTC_CheckStackVars(_Esp
, _Fd
);
80 /* Process the alloca list */
81 for (current
= _AllocaList
; current
!= 0; current
= current
->next
)
83 /* Get the upper guard */
84 guard
= (int*)((char*)current
+ current
->allocaSize
- sizeof(*guard
));
86 /* Check if all guard locations are still ok */
87 if ((current
->guard1
!= 0xCCCCCCCC) ||
88 (current
->guard2
[0] != 0xCCCCCCCC) ||
89 (current
->guard2
[1] != 0xCCCCCCCC) ||
90 (current
->guard2
[2] != 0xCCCCCCCC) ||
91 (*guard
!= 0xCCCCCCCC))
101 _RTC_ALLOCA_NODE
*_PAllocaBase
,
103 _RTC_ALLOCA_NODE
**_PAllocaInfoList
)
107 /* Check if we got any allocation */
108 if ((_PAllocaBase
!= 0) &&
110 (_PAllocaInfoList
!= 0))
112 /* Mark the whole range */
113 char *guard
= (char*)_PAllocaBase
;
114 for (i
= 0; i
< _CbSize
; i
++)
119 /* Initialize the alloca base frame */
120 _PAllocaBase
->allocaSize
= _CbSize
;
122 /* Insert this frame into the alloca list */
123 _PAllocaBase
->next
= *_PAllocaInfoList
;
124 *_PAllocaInfoList
= _PAllocaBase
;