bug-prolog
[Top][All Lists]
Advanced

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

Support for NetBSD on PowerPC & SPARC


From: Jason Beegan
Subject: Support for NetBSD on PowerPC & SPARC
Date: Wed, 9 Jul 2003 07:28:17 +0100


I made the attached changes to gprolog-1.2.16 to add support for NetBSD on
PowerPC and SPARC.  The changes have been fully tested.

Regards,

Jason

diff -Nurab gprolog-1.2.16.orig/src/BipsPl/os_interf_c.c 
gprolog-1.2.16/src/BipsPl/os_interf_c.c
--- gprolog-1.2.16.orig/src/BipsPl/os_interf_c.c        2002-09-27 
15:20:58.000000000 +0100
+++ gprolog-1.2.16/src/BipsPl/os_interf_c.c     2003-07-09 06:25:56.000000000 
+0100
@@ -217,7 +217,7 @@
   tsig[nb_sig].atom = Create_Atom("SIGIO");
   tsig[nb_sig++].sig = SIGIO;
 #endif
-#if !defined( M_ix86_bsd ) && !defined( M_powerpc_darwin )
+#if !defined( M_ix86_bsd ) && !defined( M_powerpc_darwin ) && !defined( 
M_powerpc_bsd ) && !defined( M_sparc_bsd )
   tsig[nb_sig].atom = Create_Atom("SIGPOLL");
   tsig[nb_sig++].sig = SIGPOLL;
 #endif
diff -Nurab gprolog-1.2.16.orig/src/EnginePl/engine1.c 
gprolog-1.2.16/src/EnginePl/engine1.c
--- gprolog-1.2.16.orig/src/EnginePl/engine1.c  2002-05-07 18:45:48.000000000 
+0100
+++ gprolog-1.2.16/src/EnginePl/engine1.c       2003-07-09 06:25:56.000000000 
+0100
@@ -97,7 +97,7 @@
 
 #endif
 
-#ifdef M_sparc
+#if defined(M_sparc) && !defined(M_sparc_bsd)
   register long *rfl asm("%l2") = base_fl;
   register double *rfd asm("%l3") = base_fd;
 #endif
diff -Nurab gprolog-1.2.16.orig/src/EnginePl/gp_config.h.in 
gprolog-1.2.16/src/EnginePl/gp_config.h.in
--- gprolog-1.2.16.orig/src/EnginePl/gp_config.h.in     2002-05-03 
10:23:14.000000000 +0100
+++ gprolog-1.2.16/src/EnginePl/gp_config.h.in  2003-07-09 06:25:56.000000000 
+0100
@@ -31,7 +31,10 @@
 /* Define if you have termios.h */
 #undef HAVE_TERMIOS_H
 
-/* Define if you have termios.h */
+/* Define if you have termio.h */
+#undef HAVE_TERMIO_H
+
+/* Define if you have malloc.h */
 #undef HAVE_MALLOC_H
 
 /* Define if you have a working `mmap' system call */
@@ -148,12 +151,18 @@
 /* Define if the system is a sparc/sunos */
 #undef M_sparc_sunos
 
+/* Define if the system is a sparc/bsd */
+#undef M_sparc_bsd
+
 /* Define if the system is a powerpc/linux */
 #undef M_powerpc_linux
 
-/* Define if the system is a powerpc/bsd */
+/* Define if the system is a powerpc/darwin */
 #undef M_powerpc_darwin
 
+/* Define if the system is a powerpc/bsd */
+#undef M_powerpc_bsd
+
 
 
 /* Constant definitions */
diff -Nurab gprolog-1.2.16.orig/src/EnginePl/machine.c 
gprolog-1.2.16/src/EnginePl/machine.c
--- gprolog-1.2.16.orig/src/EnginePl/machine.c  2002-09-17 14:04:02.000000000 
+0100
+++ gprolog-1.2.16/src/EnginePl/machine.c       2003-07-09 06:25:56.000000000 
+0100
@@ -480,7 +480,7 @@
 
 static void
 SIGSEGV_Handler(int sig, siginfo_t * si)
-#elif defined(M_ix86_bsd)
+#elif defined(M_ix86_bsd) || defined(M_powerpc_bsd) || defined(M_sparc_bsd)
 
 static void
 SIGSEGV_Handler(int sig, int code, struct sigcontext *scp)
diff -Nurab gprolog-1.2.16.orig/src/EnginePl/machine.h 
gprolog-1.2.16/src/EnginePl/machine.h
--- gprolog-1.2.16.orig/src/EnginePl/machine.h  2002-05-10 17:35:26.000000000 
+0100
+++ gprolog-1.2.16/src/EnginePl/machine.h       2003-07-09 06:25:56.000000000 
+0100
@@ -125,11 +125,7 @@
 #    define M_USED_REGS            {"ebx", "ebp", 0}
 #endif
 
-#elif defined(M_powerpc_linux)
-
-#    define M_USED_REGS            {"15", "20", 0}
-
-#elif defined(M_powerpc_darwin)
+#elif defined(M_powerpc_linux) || defined(M_powerpc_darwin) || 
defined(M_powerpc_bsd)
 
 #    define M_USED_REGS            {"15", "20", 0}
 
diff -Nurab gprolog-1.2.16.orig/src/EnginePl/obj_chain.c 
gprolog-1.2.16/src/EnginePl/obj_chain.c
--- gprolog-1.2.16.orig/src/EnginePl/obj_chain.c        2002-03-19 
18:24:36.000000000 +0000
+++ gprolog-1.2.16/src/EnginePl/obj_chain.c     2003-07-09 06:25:56.000000000 
+0100
@@ -207,7 +207,7 @@
 #endif
       (*p->fct_init) ();
 
-#if defined(M_powerpc_linux) || defined(M_alpha_linux) || \
+#if defined(M_powerpc_linux) || defined(M_alpha_linux) || 
defined(M_powerpc_bsd) ||\
     defined(M_mips_irix)
       p = (ObjChain *) ((long *) p + 1);
 #elif 0
diff -Nurab gprolog-1.2.16.orig/src/Ma2Asm/FromC/mach.h 
gprolog-1.2.16/src/Ma2Asm/FromC/mach.h
--- gprolog-1.2.16.orig/src/Ma2Asm/FromC/mach.h 2000-11-30 10:11:10.000000000 
+0000
+++ gprolog-1.2.16/src/Ma2Asm/FromC/mach.h      2003-07-09 06:25:56.000000000 
+0100
@@ -12,7 +12,8 @@
  *---------------------------------*/
 
 #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_ix86_linux) || defined(M_ix86_sco) || defined(M_ix86_bsd) ||\
+    defined(M_powerpc_bsd) || defined(M_sparc_bsd) || defined(__ELF__)
 
 #   define M_Asm_Symbol1(name)     #name
 #   define M_Asm_Symbol(name)      M_Asm_Symbol1(name)
@@ -66,7 +67,7 @@
 
 #    define M_Direct_Goto(lab)     {_asm {jmp M_Asm_Symbol(lab)}; return;}
 
-#elif defined(M_powerpc_linux)
+#elif defined(M_powerpc_linux) || defined(M_powerpc_bsd)
 
 #    define M_Direct_Goto(lab)     {asm("b " M_Asm_Symbol(lab)); return;}
 
diff -Nurab gprolog-1.2.16.orig/src/Ma2Asm/ix86_any.c 
gprolog-1.2.16/src/Ma2Asm/ix86_any.c
--- gprolog-1.2.16.orig/src/Ma2Asm/ix86_any.c   2002-05-07 18:45:48.000000000 
+0100
+++ gprolog-1.2.16/src/Ma2Asm/ix86_any.c        2003-07-09 06:25:56.000000000 
+0100
@@ -38,7 +38,7 @@
 
 #define MAX_C_ARGS_IN_C_CODE       32
 
-#if (defined(M_ix86_cygwin) || defined(M_ix86_bsd)) && !defined(__FreeBSD__)
+#if (defined(M_ix86_cygwin) || defined(M_ix86_bsd)) && !defined(__FreeBSD__) 
&& !defined(__NetBSD__)
 
 #define UN                         "_"
 
diff -Nurab gprolog-1.2.16.orig/src/Ma2Asm/powerpc_any.c 
gprolog-1.2.16/src/Ma2Asm/powerpc_any.c
--- gprolog-1.2.16.orig/src/Ma2Asm/powerpc_any.c        2002-05-15 
11:02:42.000000000 +0100
+++ gprolog-1.2.16/src/Ma2Asm/powerpc_any.c     2003-07-09 06:25:56.000000000 
+0100
@@ -42,7 +42,7 @@
 #define MAX_DOUBLES_IN_PRED        2048
 
 
-#ifdef M_powerpc_linux
+#if defined(M_powerpc_linux) || defined(M_powerpc_bsd)
 
 #define UN
 #define R(reg)                     #reg
@@ -186,7 +186,7 @@
 
   Label_Printf("");
   Inst_Printf(".align", "2");
-#ifdef M_powerpc_linux
+#if defined(M_powerpc_linux) || defined(M_powerpc_bsd)
   Inst_Printf(".type", "%s,@function", label);
 #endif
 
@@ -431,7 +431,7 @@
 
 
 
-#ifdef M_powerpc_linux
+#if defined(M_powerpc_linux) || defined(M_powerpc_bsd)
 
 #define STACK_OFFSET(offset)   offset * 4 - 24
 #define DBL_RET_WORDS          0
@@ -462,7 +462,7 @@
 }
 
 
-#ifdef M_powerpc_linux
+#if defined(M_powerpc_linux) || defined(M_powerpc_bsd)
 
 #define AFTER_ARG_DBL                                          \
 }
@@ -649,7 +649,7 @@
   BEFORE_ARG;
 
   Inst_Printf("addis", "%s,0," HI_UN(foreign_double+%d), r,
-#ifdef M_powerpc_linux
+#if defined(M_powerpc_linux) || defined(M_powerpc_bsd)
              index * 4
 #else
              index * 8
@@ -882,7 +882,7 @@
 void
 Dico_String_Start(int nb_consts)
 {
-#ifdef M_powerpc_linux
+#if defined(M_powerpc_linux) || defined(M_powerpc_bsd)
   Label_Printf(".section\t.rodata");
 #else
   Label_Printf(".cstring");
@@ -900,7 +900,7 @@
 Dico_String(int str_no, char *asciiz)
 {
   Label_Printf("%s%d:", STRING_PREFIX, str_no);
-#ifdef M_powerpc_linux
+#if defined(M_powerpc_linux) || defined(M_powerpc_bsd)
   Inst_Printf(".string", "%s", asciiz);
 #else
   Inst_Printf(".asciz", "%s", asciiz);
@@ -948,7 +948,7 @@
     case NONE:
       value = 1;               /* then in case ARRAY_SIZE */
     case ARRAY_SIZE:
-#ifdef M_powerpc_linux
+#if defined(M_powerpc_linux) || defined(M_powerpc_bsd)
       if (!global)
        Inst_Printf(".local", UN "%s", name);
       Inst_Printf(".comm", UN "%s,%ld,4", name, value * 4);
diff -Nurab gprolog-1.2.16.orig/src/Ma2Asm/sparc_any.c 
gprolog-1.2.16/src/Ma2Asm/sparc_any.c
--- gprolog-1.2.16.orig/src/Ma2Asm/sparc_any.c  2002-05-07 18:45:48.000000000 
+0100
+++ gprolog-1.2.16/src/Ma2Asm/sparc_any.c       2003-07-09 06:25:56.000000000 
+0100
@@ -171,7 +171,7 @@
 {
   Label_Printf("");
   Inst_Printf(".align", "4");
-#ifdef M_sparc_solaris
+#if defined(M_sparc_solaris) || defined(M_sparc_bsd)
   Inst_Printf(".type", UN "%s,#function", label);
 #endif
   Inst_Printf(".proc", "020");
@@ -915,7 +915,7 @@
       break;
 
     case INITIAL_VALUE:
-#ifdef M_sparc_solaris
+#if defined(M_sparc_solaris) || defined(M_sparc_bsd)
       Inst_Printf(".type", UN "%s,#object", name);
       Inst_Printf(".size", UN "%s,4", name);
 #endif
diff -Nurab gprolog-1.2.16.orig/src/configure.in gprolog-1.2.16/src/configure.in
--- gprolog-1.2.16.orig/src/configure.in        2002-09-19 11:57:32.000000000 
+0100
+++ gprolog-1.2.16/src/configure.in     2003-07-09 06:25:56.000000000 +0100
@@ -311,6 +311,7 @@
                mips*irix*)      AC_DEFINE(M_mips_irix);;
                sparc*sunos*)    AC_DEFINE(M_sparc_sunos);;
                sparc*solaris*)  AC_DEFINE(M_sparc_solaris);;
+               sparc*bsd*)      AC_DEFINE(M_sparc_bsd);;
                alpha*osf*)      AC_DEFINE(M_alpha_osf);;
                alpha*linux*)    AC_DEFINE(M_alpha_linux);;
                i*86*linux*)     AC_DEFINE(M_ix86_linux);;
@@ -319,6 +320,7 @@
                i*86*bsd*)       AC_DEFINE(M_ix86_bsd);;
                powerpc*linux*)  AC_DEFINE(M_powerpc_linux);;
                powerpc*darwin*) AC_DEFINE(M_powerpc_darwin);;
+               powerpc*bsd*)    AC_DEFINE(M_powerpc_bsd);;
                *86*cygwin*)     AC_DEFINE(M_ix86_cygwin);;
                *)               AC_MSG_ERROR(unsupported architecture)
        esac

reply via email to

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