GNU PROLOG with UTF8 support
Macros | Functions | Variables
stacks_sigsegv.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <errno.h>
#include <fcntl.h>
#include <ctype.h>
#include <string.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "gp_config.h"
#include "engine_pl.h"
Include dependency graph for stacks_sigsegv.c:

Macros

#define M_MAGIC1   0x12345678
 
#define M_MAGIC2   0xdeadbeef
 
#define MAX_SIGSEGV_HANDLER   10
 
#define ERR_STACKS_ALLOCATION   "Memory allocation fault"
 
#define ERR_CANNOT_OPEN_DEV0   "Cannot open /dev/zero : %s"
 
#define ERR_CANNOT_UNMAP   "unmap failed : %s"
 
#define ERR_CANNOT_FREE   "VirtualFree failed : %" PL_FMT_u
 
#define ERR_CANNOT_PROTECT   "VirtualProtect failed : %" PL_FMT_u
 
#define ERR_STACK_OVERFLOW_ENV   "%s stack overflow (size: %d Kb, reached: %d Kb, environment variable used: %s)"
 
#define ERR_STACK_OVERFLOW_NO_ENV   "%s stack overflow (size: %d Kb, reached: %d Kb - fixed size)"
 
#define Round_Up(x, y)   (((x) + (y) - 1) / (y) * (y))
 
#define Round_Down(x, y)   ((x) / (y) * (y))
 

Functions

static void Install_SIGSEGV_Handler (void)
 
static void SIGSEGV_Handler ()
 
static void Handle_Bad_Address (void *bad_addr)
 
static int Default_SIGSEGV_Handler (void *bad_addr)
 
static char * Stack_Overflow_Err_Msg (int stk_nb)
 
static void * Virtual_Mem_Alloc (void *addr, int length)
 
static void Virtual_Mem_Protect (void *addr, int length)
 
void Pl_Allocate_Stacks (void)
 
static LONG WINAPI Win32_Exception_Handler (LPEXCEPTION_POINTERS ei)
 
void Pl_Push_SIGSEGV_Handler (SegvHdlr handler)
 
void Pl_Pop_SIGSEGV_Handler (void)
 

Variables

static int page_size
 
static SegvHdlr tbl_handler [MAX_SIGSEGV_HANDLER]
 
static int nb_handler = 0
 

Macro Definition Documentation

#define ERR_CANNOT_FREE   "VirtualFree failed : %" PL_FMT_u
#define ERR_CANNOT_OPEN_DEV0   "Cannot open /dev/zero : %s"
#define ERR_CANNOT_PROTECT   "VirtualProtect failed : %" PL_FMT_u
#define ERR_CANNOT_UNMAP   "unmap failed : %s"
#define ERR_STACK_OVERFLOW_ENV   "%s stack overflow (size: %d Kb, reached: %d Kb, environment variable used: %s)"
#define ERR_STACK_OVERFLOW_NO_ENV   "%s stack overflow (size: %d Kb, reached: %d Kb - fixed size)"
#define ERR_STACKS_ALLOCATION   "Memory allocation fault"
#define M_MAGIC1   0x12345678
#define M_MAGIC2   0xdeadbeef
#define MAX_SIGSEGV_HANDLER   10
#define Round_Down (   x,
  y 
)    ((x) / (y) * (y))
#define Round_Up (   x,
  y 
)    (((x) + (y) - 1) / (y) * (y))

Function Documentation

static int Default_SIGSEGV_Handler ( void *  bad_addr)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void Handle_Bad_Address ( void *  bad_addr)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void Install_SIGSEGV_Handler ( void  )
static

Here is the call graph for this function:

Here is the caller graph for this function:

void Pl_Allocate_Stacks ( void  )

Here is the caller graph for this function:

void Pl_Pop_SIGSEGV_Handler ( void  )

Here is the caller graph for this function:

void Pl_Push_SIGSEGV_Handler ( SegvHdlr  handler)

Here is the call graph for this function:

Here is the caller graph for this function:

static void SIGSEGV_Handler ( )
static

Here is the caller graph for this function:

static char * Stack_Overflow_Err_Msg ( int  stk_nb)
static

Here is the caller graph for this function:

static void* Virtual_Mem_Alloc ( void *  addr,
int  length 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void Virtual_Mem_Protect ( void *  addr,
int  length 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static LONG WINAPI Win32_Exception_Handler ( LPEXCEPTION_POINTERS  ei)
static

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

int nb_handler = 0
static
int page_size
static
SegvHdlr tbl_handler[MAX_SIGSEGV_HANDLER]
static