mirror of
https://github.com/xcat2/xNBA.git
synced 2024-12-16 00:01:34 +00:00
df4b503a8c
--nulltrap to the make target at the moment.)
49 lines
2.0 KiB
C
49 lines
2.0 KiB
C
#include <stdint.h>
|
|
#include <vsprintf.h>
|
|
|
|
__attribute__ (( noreturn, section ( ".text.null_trap" ) ))
|
|
void null_function_trap ( void ) {
|
|
|
|
/* 128 bytes of NOPs; the idea of this is that if something
|
|
* dereferences a NULL pointer and overwrites us, we at least
|
|
* have some chance of still getting to execute the printf()
|
|
* statement.
|
|
*/
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
__asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
|
|
|
|
printf ( "NULL method called from %p\n",
|
|
__builtin_return_address ( 0 ) );
|
|
while ( 1 ) {}
|
|
}
|