[RXCE]
[reactos.git] / reactos / sdk / lib / gcc_ssp / gcc_ssp.c
1
2 #define FAST_FAIL_STACK_COOKIE_CHECK_FAILURE 2
3
4 /* Should be random :-/ */
5 void * __stack_chk_guard = (void*)0xf00df00d;
6
7 #if 0
8 void __stack_chk_guard_setup()
9 {
10 unsigned char * p;
11 p = (unsigned char *)&__stack_chk_guard; // *** Notice that this takes the address of __stack_chk_guard ***
12
13 /* If you have the ability to generate random numbers in your kernel then use them,
14 otherwise for 32-bit code: */
15 *p = 0x00000aff; // *** p is &__stack_chk_guard so *p writes to __stack_chk_guard rather than *__stack_chk_guard ***
16 }
17 #endif
18
19 void __stack_chk_fail()
20 {
21 /* Like __fastfail */
22 __asm__("int $0x29" : : "c"(FAST_FAIL_STACK_COOKIE_CHECK_FAILURE) : "memory");
23 }