vm: fix compilation on various Unices

release
Slava Pestov 2010-03-27 09:44:20 -04:00
parent b6dfdcb909
commit 19aef06741
7 changed files with 12 additions and 7 deletions

View File

@ -6,3 +6,5 @@ extern "C" int getosreldate();
#ifndef KERN_PROC_PATHNAME
#define KERN_PROC_PATHNAME 12
#endif
#define UAP_STACK_POINTER_TYPE __register_t

View File

@ -7,4 +7,6 @@ VM_C_API int inotify_init();
VM_C_API int inotify_add_watch(int fd, const char *name, u32 mask);
VM_C_API int inotify_rm_watch(int fd, u32 wd);
#define UAP_STACK_POINTER_TYPE greg_t
}

View File

@ -15,4 +15,6 @@ void c_to_factor_toplevel(cell quot);
#define UAP_STACK_POINTER(ucontext) (((ucontext_t *)ucontext)->uc_stack.ss_sp)
#define UAP_STACK_POINTER_TYPE void*
}

View File

@ -1,8 +1,5 @@
#include <ucontext.h>
namespace factor
{
#define UAP_PROGRAM_COUNTER(uap) _UC_MACHINE_PC((ucontext_t *)uap)
#define UAP_PROGRAM_COUNTER(uap) _UC_MACHINE_PC((ucontext_t *)uap)
}
#define UAP_STACK_POINTER_TYPE __greg_t

1
vm/os-openbsd.hpp Normal file
View File

@ -0,0 +1 @@
#define UAP_STACK_POINTER_TYPE __greg_t

View File

@ -141,7 +141,7 @@ segment::~segment()
void factor_vm::dispatch_signal(void *uap, void (handler)())
{
UAP_STACK_POINTER(uap) = fix_callstack_top((stack_frame *)UAP_STACK_POINTER(uap));
UAP_STACK_POINTER(uap) = (UAP_STACK_POINTER_TYPE)fix_callstack_top((stack_frame *)UAP_STACK_POINTER(uap));
UAP_PROGRAM_COUNTER(uap) = (cell)handler;
}

View File

@ -48,6 +48,7 @@
#endif
#elif defined(__OpenBSD__)
#define FACTOR_OS_STRING "openbsd"
#include "os-openbsd.hpp"
#if defined(FACTOR_X86)
#include "os-openbsd-x86.32.hpp"
@ -58,6 +59,7 @@
#endif
#elif defined(__NetBSD__)
#define FACTOR_OS_STRING "netbsd"
#include "os-netbsd.hpp"
#if defined(FACTOR_X86)
#include "os-netbsd-x86.32.hpp"
@ -67,7 +69,6 @@
#error "Unsupported NetBSD flavor"
#endif
#include "os-netbsd.hpp"
#elif defined(linux)
#define FACTOR_OS_STRING "linux"
#include "os-linux.hpp"