misc/libphysfs/platform_macosx.c
changeset 9183 4cd7c7aafea7
parent 8928 10a79d89ca31
child 10017 de822cd3df3a
equal deleted inserted replaced
9181:db48ce616531 9183:4cd7c7aafea7
    42 {
    42 {
    43     fprintf(stderr, string, expression, line, filename);
    43     fprintf(stderr, string, expression, line, filename);
    44     fflush(stderr);
    44     fflush(stderr);
    45     abort();
    45     abort();
    46 }
    46 }
       
    47 
       
    48 
       
    49 /* apparently libssp is missing from 10.4 SDK
       
    50    code from http://wiki.osdev.org/GCC_Stack_Smashing_Protector */
       
    51 void * __stack_chk_guard = NULL;
       
    52 
       
    53 void __stack_chk_guard_setup()
       
    54 {
       
    55     unsigned char * p;
       
    56     p = (unsigned char *) &__stack_chk_guard;
       
    57 
       
    58     /* If you have the ability to generate random numbers in your kernel then use them,
       
    59        otherwise for 32-bit code: *p = 0x00000aff; */
       
    60     *p = random();
       
    61 }
       
    62 
       
    63 void __attribute__((noreturn)) __stack_chk_fail()
       
    64 {
       
    65     /* put your panic function or similar in here */
       
    66     unsigned char * vid = (unsigned char *)0xB8000;
       
    67     vid[1] = 7;
       
    68     for(;;)
       
    69     vid[0]++;
       
    70 }
       
    71 
    47 #endif
    72 #endif
    48 #endif /* __APPLE__ */
    73 #endif /* __APPLE__ */
    49 
    74 
    50 
    75 
    51 /* Wrap PHYSFS_Allocator in a CFAllocator... */
    76 /* Wrap PHYSFS_Allocator in a CFAllocator... */