* Sync up to trunk head (r64829).
[reactos.git] / lib / sdk / runtmchk / i386 / _RTC_CheckEsp.S
1 /*
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)
6 */
7
8 #include <asm.inc>
9 .code
10
11 EXTERN __RTC_Failure:PROC
12
13 /*
14
15 This function is invoked like this:
16
17 mov esi, esp
18 // Do the actual function call
19 cmp esp, esi
20 call __RTC_CheckEsp
21
22 http://stackoverflow.com/questions/3914750/hows-rtc-checkesp-implemented
23 */
24 PUBLIC __RTC_CheckEsp
25 __RTC_CheckEsp:
26
27 /* We check if the zero flag is set, and if it is, everything is fine
28 and we return to the caller */
29 je __RTC_CheckEsp_return
30
31 push ebp
32 mov ebp, esp
33 pusha
34
35 // void _RTC_Failure(void* retaddr, int errnum);
36 push 0 // errnum
37 push dword ptr [esp + 4] // retaddr
38 call __RTC_Failure
39 add esp, 8
40
41 popa
42 pop ebp
43
44 __RTC_CheckEsp_return:
45 ret
46
47 END
48
49