Merge git://factorcode.org/git/factor

db4
Slava Pestov 2008-01-16 13:05:49 -05:00
commit 435152738a
4 changed files with 22 additions and 3 deletions

View File

@ -1 +1,9 @@
#include <ucontext.h>
INLINE void *ucontext_stack_pointer(void *uap)
{
ucontext_t *ucontext = (ucontext_t *)uap;
return (void *)ucontext->uc_mcontext.mc_esp;
}
#define UAP_PROGRAM_COUNTER(ucontext) (((ucontext_t *)(ucontext))->uc_mcontext.mc_eip)

View File

@ -1,2 +1,10 @@
#include <ucontext.h>
INLINE void *ucontext_stack_pointer(void *uap)
{
ucontext_t *ucontext = (ucontext_t *)uap;
return (void *)ucontext->uc_mcontext.gregs[7];
}
#define UAP_PROGRAM_COUNTER(ucontext) \
(((ucontext_t *)(ucontext))->uc_mcontext.gregs[14])

View File

@ -192,7 +192,12 @@ INLINE F_STACK_FRAME *uap_stack_pointer(void *uap)
from Factor to C is a sign of things seriously gone wrong, not just
a divide by zero or stack underflow in the listener */
if(in_code_heap_p(UAP_PROGRAM_COUNTER(uap)))
return ucontext_stack_pointer(uap);
{
F_STACK_FRAME *ptr = ucontext_stack_pointer(uap);
if(!ptr)
critical_error("Invalid uap",(CELL)uap);
return ptr;
}
else
return NULL;
}

View File

@ -41,7 +41,6 @@
#ifdef __FreeBSD__
#define FACTOR_OS_STRING "freebsd"
#include "os-freebsd.h"
#include "os-unix-ucontext.h"
#if defined(FACTOR_X86)
#include "os-freebsd-x86.32.h"
@ -64,7 +63,6 @@
#include "os-linux.h"
#if defined(FACTOR_X86)
#include "os-unix-ucontext.h"
#include "os-linux-x86-32.h"
#elif defined(FACTOR_PPC)
#include "os-unix-ucontext.h"