bug-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

x86_64-bsd patches for gprolog


From: David Holland
Subject: x86_64-bsd patches for gprolog
Date: Sun, 7 Sep 2008 04:47:16 +0000
User-agent: Mutt/1.5.17 (2007-11-01)

Here's patches to add support for x86_64 on BSD systems. I've tested
this on NetBSD; it passes 'make check', except for the test in Ma2Asm,
which doesn't seem to be able to be run without fast call support
regardless of how FC is set invoking it. (I don't think this is
because of anything I did... and it doesn't look like x86_64 is
expected to have fast call support, although I might have misread.)

I didn't see anything that ought to be different between NetBSD,
FreeBSD, OpenBSD, or DragonFly, so there should be no need to
distinguish them.

Patches are against 1.3.0, which appears to be current.

The first patch makes "make check" work properly. :-)


--- src/Makefile.in.orig        2007-01-04 05:21:49.000000000 -0500
+++ src/Makefile.in     2008-09-07 00:32:35.000000000 -0400
@@ -148,10 +148,11 @@
 # --- CHECKS --- #
 
 check:
-       (cd EnginePl; make check) && \
-       (cd Ma2Asm; make check) && \
-       (cd Pl2Wam; make check) && \
-       (cd BipsPl; make check) && \
+       . ./SETVARS; \
+       (cd EnginePl; $(MAKE) check) && \
+       (cd Ma2Asm; $(MAKE) check) && \
+       (cd Pl2Wam; $(MAKE) check) && \
+       (cd BipsPl; $(MAKE) check) && \
        echo All tests succeeded
 
 
--- src/configure.in~   2007-01-04 05:21:52.000000000 -0500
+++ src/configure.in    2008-09-06 23:58:31.000000000 -0400
@@ -328,6 +328,7 @@ else
         alpha*osf*)      AC_DEFINE(M_alpha_osf);;
         alpha*linux*)    AC_DEFINE(M_alpha_linux);;
         x86_64*linux*)   AC_DEFINE(M_x86_64_linux);;
+        x86_64*bsd*)     AC_DEFINE(M_x86_64_bsd);;
         i*86*linux*)     AC_DEFINE(M_ix86_linux);;
         i*86*solaris*)   AC_DEFINE(M_ix86_solaris);;
         i*86*sco*)       AC_DEFINE(M_ix86_sco);;
--- src/configure~      2007-01-05 07:13:28.000000000 -0500
+++ src/configure       2008-09-06 23:58:51.000000000 -0400
@@ -3554,6 +3554,10 @@ _ACEOF
 #define M_x86_64_linux 1
 _ACEOF
 ;;
+        x86_64*bsd*)   cat >>confdefs.h <<\_ACEOF
+#define M_x86_64_bsd 1
+_ACEOF
+;;
         i*86*linux*)     cat >>confdefs.h <<\_ACEOF
 #define M_ix86_linux 1
 _ACEOF
--- src/Ma2Asm/FromC/mach.h~    2007-01-04 05:21:48.000000000 -0500
+++ src/Ma2Asm/FromC/mach.h     2008-09-07 00:03:37.000000000 -0400
@@ -13,7 +13,7 @@
 
 #if defined(M_sony_news) || defined(M_ultrix_dec) || defined(M_alpha_osf) ||\
     defined(M_ix86_linux) || defined(M_ix86_sco) || defined(M_ix86_bsd) ||\
-    defined(M_x86_64_linux) || \
+    defined(M_x86_64_linux) || defined(m_x86_64_bsd) || \
     defined(M_powerpc_bsd) || defined(M_sparc_bsd) || defined(__ELF__)
 
 #   define M_Asm_Symbol1(name)     #name
@@ -64,7 +64,7 @@
 
 #    define M_Direct_Goto(lab)     {_asm {jmp M_Asm_Symbol(lab)}; return;}
 
-#elif defined(M_x86_64_linux)
+#elif defined(M_x86_64)
 
 #    define M_Direct_Goto(lab)     {asm("jmp " M_Asm_Symbol(lab)); return;}
 
--- src/EnginePl/gp_config.h.in~        2007-01-04 05:21:49.000000000 -0500
+++ src/EnginePl/gp_config.h.in 2008-09-07 00:04:54.000000000 -0400
@@ -177,6 +177,8 @@
 /* Define if the system is a x86-64/linux */
 #undef M_x86_64_linux
 
+/* Define if the system is a x86-64/bsd */
+#undef M_x86_64_bsd
 
 
 /* Constant definitions */
--- src/EnginePl/engine1.c~     2007-01-04 05:35:13.000000000 -0500
+++ src/EnginePl/engine1.c      2008-09-07 00:09:12.000000000 -0400
@@ -100,7 +100,7 @@ Call_Compiled(CodePtr codep)
   register WamWord *rb asm("%l0") = reg_bank;
   ensure_reserved = (WamWord *) rb; /* to avoid gcc warning */
 
-#elif defined(M_x86_64_linux)
+#elif defined(M_x86_64)
 
   register WamWord *rb asm("%r12") = reg_bank;
   ensure_reserved = (WamWord *) rb; /* to avoid gcc warning */
@@ -113,7 +113,7 @@ Call_Compiled(CodePtr codep)
 #if defined(M_ix86_darwin)             /* see comment in Ma2Asm/ix86_any.c */
   asm("andl $0xfffffff0,%esp");
   asm("addl $4,%esp");
-#elif defined(M_x86_64_linux)          /* see comment in Ma2Asm/x86_64_any.c */
+#elif defined(M_x86_64)                        /* see comment in 
Ma2Asm/x86_64_any.c */
   asm("andq $0xfffffffffffffff0,%rsp");
   asm("addq $8,%rsp");
 #endif
--- src/EnginePl/engine.c~      2007-01-04 05:35:13.000000000 -0500
+++ src/EnginePl/engine.c       2008-09-07 00:10:33.000000000 -0400
@@ -455,7 +455,7 @@ Call_Prolog_Fail(void)
 {
 #ifdef M_ix86_darwin           /* see comment in Ma2Asm/ix86_any.c */
   asm("subl $4,%esp");
-#elif defined(M_x86_64_linux)  /* see comment in Ma2Asm/x86_64_any.c */
+#elif defined(M_x86_64)        /* see comment in Ma2Asm/x86_64_any.c */
   asm("subq $8,%rsp");
 #endif
   Save_Machine_Regs(p_buff_save);
@@ -475,7 +475,7 @@ Call_Prolog_Success(void)
 {
 #ifdef M_ix86_darwin           /* see comment in Ma2Asm/ix86_any.c */
   asm("subl $4,%esp");
-#elif defined(M_x86_64_linux)  /* see comment in Ma2Asm/x86_64_any.c */
+#elif defined(M_x86_64)        /* see comment in Ma2Asm/x86_64_any.c */
   asm("subq $8,%rsp");
 #endif
   Save_Machine_Regs(p_buff_save);
--- src/EnginePl/machine.c.orig 2007-01-04 05:35:13.000000000 -0500
+++ src/EnginePl/machine.c      2008-09-07 00:07:29.000000000 -0400
@@ -482,7 +482,7 @@ SIGSEGV_Handler(WamWord *addr)
 void
 SIGSEGV_Handler(int sig, int code, struct sigcontext *scp)
 
-#elif defined(M_x86_64_linux)
+#elif defined(M_x86_64_linux) || defined(M_x86_64_bsd)
 void
 SIGSEGV_Handler(int sig, siginfo_t *sip, void *scp)
 
@@ -509,7 +509,7 @@ SIGSEGV_Handler(int sig)
 
   WamWord *addr = (WamWord *) scp.cr2;
 
-#elif defined(M_x86_64_linux)
+#elif defined(M_x86_64_linux) || defined(M_x86_64_bsd)
 
   WamWord *addr = (WamWord *) sip->si_addr;
 

-- 
David A. Holland
address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]