pike.git / src / program.c

version» Context lines:

pike.git/src/program.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: program.c,v 1.722 2008/06/27 11:29:20 grubba Exp $ + || $Id: program.c,v 1.723 2008/06/28 03:25:51 mast Exp $   */      #include "global.h"   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"   #include "pike_types.h"   #include "stralloc.h"   #include "las.h"   #include "lex.h"
pike.git/src/program.c:2540:    debug_malloc_touch(Pike_compiler->fake_object);    debug_malloc_touch(Pike_compiler->fake_object->storage);       if(Pike_compiler->new_program->program)    {   #define FOO(NUMTYPE,TYPE,ARGTYPE,NAME) \    Pike_compiler->malloc_size_program->PIKE_CONCAT(num_,NAME) = \    Pike_compiler->new_program->PIKE_CONCAT(num_,NAME);   #include "program_areas.h"    +  Pike_compiler->malloc_size_program->total_size = 0;       {    INT32 line=0, off=0;    size_t len = 0;    INT32 shift = 0;    char *file=0;    char *cnt=Pike_compiler->new_program->linenumbers;       while(cnt < Pike_compiler->new_program->linenumbers +    Pike_compiler->new_program->num_linenumbers)
pike.git/src/program.c:10698:    "change_compiler_compatibility");    pop_stack();   }      #ifdef PIKE_USE_MACHINE_CODE      #ifdef HAVE_SYS_MMAN_H   #include <sys/mman.h>   #endif    - void make_program_executable(struct program *p) - { -  if (!p->num_program) return; -  if ((p->event_handler == compat_event_handler) && -  ((p->num_program * sizeof(p->program[0]) <= -  (NUM_PROG_EVENTS * sizeof(p->event_handler))))) { -  /* Only event handlers. */ -  return; -  } + #include <execinfo.h>    -  + void make_area_executable (char *start, size_t len) + {   #ifndef USE_MY_MEXEC_ALLOC    {    /* Perform page alignment. */ -  void *addr = (void *)(((size_t)p->program) & ~(page_size-1)); -  size_t len = (((char *)(p->program + p->num_program)) - ((char *)addr) + +  void *addr = (void *)(((size_t)start) & ~(page_size-1)); +  size_t l = ((start + len) - ((char *)addr) +    (page_size - 1)) & ~(page_size-1);    -  if (mprotect(addr, len, PROT_EXEC | PROT_READ | PROT_WRITE) < 0) { +  if (mprotect(addr, l, PROT_EXEC | PROT_READ | PROT_WRITE) < 0) {   #if 0    fprintf(stderr, "%p:%d: mprotect(%p, %lu, 0x%04x): errno: %d\n", -  (void *)p->program, -  (unsigned long)(p->num_program*sizeof(p->program[0])), -  addr, len, -  PROT_EXEC | PROT_READ | PROT_WRITE, -  errno); +  start, len, addr, l, PROT_EXEC | PROT_READ | PROT_WRITE, errno);   #endif /* 0 */    }    }   #endif /* !USE_MY_MEXEC_ALLOC */      #ifdef HAVE_SYNC_INSTRUCTION_MEMORY -  sync_instruction_memory(p->program, -  p->num_program*sizeof(p->program[0])); +  sync_instruction_memory(start, len);   #elif defined(FLUSH_INSTRUCTION_CACHE) -  FLUSH_INSTRUCTION_CACHE(p->program, -  p->num_program*sizeof(p->program[0])); +  FLUSH_INSTRUCTION_CACHE(start, len);   #endif /* HAVE_SYNC_INSTRUCTION_MEMORY || FLUSH_INSTRUCTION_CACHE */   } -  +  + void make_program_executable(struct program *p) + { +  if (!p->num_program) return; +  if ((p->event_handler == compat_event_handler) && +  ((p->num_program * sizeof(p->program[0]) <= +  (NUM_PROG_EVENTS * sizeof(p->event_handler))))) { +  /* Only event handlers. */ +  return; +  } +  +  make_area_executable ((char *) p->program, +  p->num_program * sizeof (p->program[0])); + }   #endif