Commit ac490444 by Alexandre Oliva Committed by Alexandre Oliva

sol2-sld-64.h (TRANSFER_FROM_TRAMPOLINE): Moved...

* config/sparc/sol2-sld-64.h (TRANSFER_FROM_TRAMPOLINE): Moved...
* config/sparc/sol2.h: ... here.

From-SVN: r31578
parent d6181b1b
2000-01-23 Alexandre Oliva <oliva@lsd.ic.unicamp.br>
* config/sparc/sol2-sld-64.h (TRANSFER_FROM_TRAMPOLINE): Moved...
* config/sparc/sol2.h: ... here.
2000-01-24 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
* basic-block.h (struct loops): New field `levels'.
......
......@@ -305,49 +305,6 @@
#endif /* ! SPARC_BI_ARCH */
/*
* Attempt to turn on access permissions for the stack.
*
* This code must be defined when compiling gcc but not when compiling
* libgcc2.a, unless we're generating code for 64 bits SPARC
*
* _SC_STACK_PROT is only defined for post 2.6, but we want this code
* to run always. 2.6 can change the stack protection but has no way to
* query it.
*
*/
#define TRANSFER_FROM_TRAMPOLINE \
static int need_enable_exec_stack; \
\
static void check_enabling(void) __attribute__ ((constructor)); \
static void check_enabling(void) \
{ \
extern long sysconf(int); \
\
int prot = (int) sysconf(515 /*_SC_STACK_PROT */); \
if (prot != 7) \
need_enable_exec_stack = 1; \
} \
\
void \
__enable_execute_stack (addr) \
void *addr; \
{ \
if (!need_enable_exec_stack) \
return; \
else { \
long size = getpagesize (); \
long mask = ~(size-1); \
char *page = (char *) (((long) addr) & mask); \
char *end = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \
\
/* 7 is PROT_READ | PROT_WRITE | PROT_EXEC */ \
if (mprotect (page, end - page, 7) < 0) \
perror ("mprotect of trampoline code"); \
} \
}
/* A C statement (sans semicolon) to output an element in the table of
global constructors. */
#undef ASM_OUTPUT_CONSTRUCTOR
......
......@@ -235,3 +235,46 @@ Boston, MA 02111-1307, USA. */
: /* no outputs */ \
: "r" (ms_flags), "r" (ms_saveret));
#endif /* sparc32 */
/*
* Attempt to turn on access permissions for the stack.
*
* This code must be defined when compiling gcc but not when compiling
* libgcc2.a, unless we're generating code for 64 bits SPARC
*
* _SC_STACK_PROT is only defined for post 2.6, but we want this code
* to run always. 2.6 can change the stack protection but has no way to
* query it.
*
*/
#define TRANSFER_FROM_TRAMPOLINE \
static int need_enable_exec_stack; \
\
static void check_enabling(void) __attribute__ ((constructor)); \
static void check_enabling(void) \
{ \
extern long sysconf(int); \
\
int prot = (int) sysconf(515 /*_SC_STACK_PROT */); \
if (prot != 7) \
need_enable_exec_stack = 1; \
} \
\
void \
__enable_execute_stack (addr) \
void *addr; \
{ \
if (!need_enable_exec_stack) \
return; \
else { \
long size = getpagesize (); \
long mask = ~(size-1); \
char *page = (char *) (((long) addr) & mask); \
char *end = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \
\
/* 7 is PROT_READ | PROT_WRITE | PROT_EXEC */ \
if (mprotect (page, end - page, 7) < 0) \
perror ("mprotect of trampoline code"); \
} \
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment