badjump.c revision 9bea4c13fca0e3bb4b719dcb3ed63d47d479294e
1#include "tests/sys_mman.h"
2
3int main ( void )
4{
5#if defined(__powerpc64__) || defined(_AIX)
6   /* on ppc64-linux, a function pointer points to a function
7      descriptor, not to the function's entry point.  Hence to get
8      uniform behaviour on all supported targets - a jump to an
9      unmapped page - the following is needed. */
10   unsigned long long int fake_fndescr[3];
11   fake_fndescr[0] = (unsigned long long int)get_unmapped_page();
12   fake_fndescr[1] = 0;
13   fake_fndescr[2] = 0;
14   return ((int(*)(void)) fake_fndescr) ();
15#else
16   char* p = get_unmapped_page();
17   return ((int(*)(void)) p) ();
18#endif
19}
20
21