]> gitweb.factorcode.org Git - factor.git/commitdiff
vm: fix compilation on various Unices
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sat, 27 Mar 2010 13:44:20 +0000 (09:44 -0400)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sat, 27 Mar 2010 13:44:20 +0000 (09:44 -0400)
vm/os-freebsd.hpp
vm/os-linux.hpp
vm/os-macosx.hpp
vm/os-netbsd.hpp
vm/os-openbsd.hpp [new file with mode: 0644]
vm/os-unix.cpp
vm/platform.hpp

index 7797a7199b9c44545aaf43e8e112a923fec5711e..177a920d87f752ddafd70c71664640d84d9d5c2b 100644 (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
index de13896b9ab555ea0f9cf29fcf11732e74df275a..6c490de2602040bed7b965d6b6fd1d0e290832f0 100644 (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
+
 }
index 0d230f48e3651c0568e6f7935ebc80596def9521..93f6574367662ee34361f36be566ecb30e6305c4 100644 (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*
+
 }
index d45b2ac1630eb74de287b6a73cbe66fb5e47c672..e79d1bf375efab975c2b8514fdda6c81c8b23ec2 100644 (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
diff --git a/vm/os-openbsd.hpp b/vm/os-openbsd.hpp
new file mode 100644 (file)
index 0000000..6a81a26
--- /dev/null
@@ -0,0 +1 @@
+#define UAP_STACK_POINTER_TYPE __greg_t
index 94d2a31839baa3ef2eba12c46592880a3bc2575c..01740a1712a03ff4f7e823f3d30e1e775dbafe39 100644 (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;
 }
 
index 2a38c911715c776a3cdda93646f0f26809681de6..a71aae1e89b5dbbb03615f28849fe5813286f4dd 100755 (executable)
@@ -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"