Debian bugs information: logs for bug#24611

Tyson Dowd trd at stimpy.cs.mu.oz.au
Tue Jul 21 23:41:06 AEST 1998


This one is from the Debian bug tracking system.
I'll working on it at some stage, just thought peopel would
like to know.

_________________________________________________________________

                        Debian bug report logs - #24611
                            mercury ported to m68k
                                       
   Package: mercury; Reported by: Roman.Hodek at informatik.uni-erlangen.de;
   dated Wed, 15 Jul 1998 13:03:09 GMT; Maintainer for mercury is Tyson
   Dowd <trd at cs.mu.oz.au>.
     _________________________________________________________________
   
   Bug reassigned from package `mercory' to `mercury'. Request was from
   James Troup <james at nocrew.org> to control at bugs.debian.org. Full text
   available.
     _________________________________________________________________
   
Message received at 24611 at bugs.debian.org:

Received: (at 24611) by bugs.debian.org; 15 Jul 1998 18:11:36 +0000
Received: (qmail 14610 invoked from network); 15 Jul 1998 18:11:32 -0000
Received: from finlandia.infodrom.north.de (root at 134.106.121.3)
  by debian.novare.net with SMTP; 15 Jul 1998 18:11:32 -0000
Received: at Infodrom Oldenburg (/\##/\ Smail3.1.29.1 #29.12 Joey)
        by finlandia.Infodrom.North.DE from kuolema.Infodrom.North.DE with smtp
        id <m0ywW1e-001MvZC>; Wed, 15 Jul 98 20:11 MET DST
Received: by kuolema.Infodrom.North.DE
        id m0ywW1M-000BLEC
        (Debian Smail-3.2.0.101 1997-Dec-17 #2); Wed, 15 Jul 1998 20:11:16 +020
0 (CEST)
Message-ID: <19980715201113.E30749 at kuolema.Infodrom.North.DE>
Date: Wed, 15 Jul 1998 20:11:14 +0200
From: Martin Schulze <joey at kuolema.Infodrom.North.DE>
To: contro at bugs.debian.org, 24611 at bugs.debian.org
Subject: Re: Bug#24611: mercury ported to m68k
Reply-To: Martin Schulze <joey at infodrom.north.de>
References: <199807151256.OAA02286 at faui22c.informatik.uni-erlangen.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Mailer: Mutt 0.91.2i
In-Reply-To: <199807151256.OAA02286 at faui22c.informatik.uni-erlangen.de>; from R
oman Hodek on Wed, Jul 15, 1998 at 02:56:17PM +0200

reassign 24611 mercury
thanks

Roman Hodek wrote:
> Package: mercory

Typo.

Regards,

        Joey

--
Install joe (Joey's Own Editor)     correct: Joe's Own Editor
     _________________________________________________________________
   
   Acknowledgement sent to Martin Schulze <joey at infodrom.north.de>:
   Extra info received and forwarded to list. Full text available.
     _________________________________________________________________
   
   Information forwarded to debian-bugs-dist at lists.debian.org:
   Bug#24611; Package mercory. Full text available.
     _________________________________________________________________
   
Message received at submit at bugs.debian.org:

Received: (at submit) by bugs.debian.org; 15 Jul 1998 12:56:26 +0000
Received: (qmail 24642 invoked from network); 15 Jul 1998 12:56:24 -0000
Received: from faui21.informatik.uni-erlangen.de (root at 131.188.32.21)
  by debian.novare.net with SMTP; 15 Jul 1998 12:56:24 -0000
Received: from faui22c.informatik.uni-erlangen.de (faui22c.informatik.uni-erlan
gen.de [131.188.32.72])
        by faui21.informatik.uni-erlangen.de (8.8.8/8.1.6-FAU) with ESMTP id OA
A14722; Wed, 15 Jul 1998 14:57:13 +0200 (MET DST)
Received: (from rnhodek at localhost)
        by faui22c.informatik.uni-erlangen.de (8.8.8/8.1.6-FAU) id OAA02286; We
d, 15 Jul 1998 14:56:17 +0200 (MET DST)
Date: Wed, 15 Jul 1998 14:56:17 +0200 (MET DST)
Message-Id: <199807151256.OAA02286 at faui22c.informatik.uni-erlangen.de>
From: Roman Hodek <Roman.Hodek at informatik.uni-erlangen.de>
To: submit at bugs.debian.org
Subject: mercury ported to m68k
Reply-to: Roman.Hodek at informatik.uni-erlangen.de

Package: mercory
Version: 0.7.3-3

I've now ported mercury to m68k. A patch is below. It would be nice if
you could integrate it into the next Debian version, and also would
forward it to the upstream author(s).

Detailed listing of what I've done:

 - README.Linux: Say that it has been ported to Linux/m68k

 - runtime/faultaddr.h: New header (used only on Linux) that provides
   a macro GET_FAULT_ADDR, that extracts the fault addr of a SIGSEGV
   from the signal handler parameters.

 - runtime/memory.c: Use faultaddr.h for GET_FAULT_ADDR macro

 - boehm_gc/config.h: Add some definitions for Linux/m68k

 - boehm_gc/os_dep.c: Use faultaddr.h for GET_FAULT_ADDR macro

 - configure, configure.in: Modified test for "working struct
   sigcontext" to also use faultaddr.h; a "working sigcontext" doesn't
   mean there must be a cr2 component :-)

   Also any non-i386 Linux arch can use shared libraries (all Linux
   uses ELF).

 - debian/control: Set Architecture: to "i386 m68k" instead of "any",
   because mercury now has been ported only to those two archs.

Roman

------------------------------------------------------------------------------
diff -u --recursive --exclude-from=diff-excludes --new-file mercury-0.7.3-orig/
README.Linux mercury-0.7.3/README.Linux
--- mercury-0.7.3-orig/README.Linux     Wed Oct 15 18:10:10 1997
+++ mercury-0.7.3/README.Linux  Fri Jul 10 00:24:38 1998
@@ -1,6 +1,6 @@
-Mercury has only been ported to Linux/x86, not to Linux/Alpha
-Linux/PowerPC, Linux/m68k, etc.  Those other ports should
-not be difficult, but this file documents just the Linux/x86 port.
+Mercury has only been ported to Linux/x86 and Linux/m68k, not to
+Linux/Alpha, Linux/PowerPC, etc.  Those other ports should
+not be difficult, but this file documents just the Linux/x86 and m68k ports.

 On Linux with a.out, shared libraries are not supported.
 If you still have an old a.out system, the auto-configuration might
diff -u --recursive --exclude-from=diff-excludes --new-file mercury-0.7.3-orig/
boehm_gc/config.h mercury-0.7.3/boehm_gc/config.h
--- mercury-0.7.3-orig/boehm_gc/config.h        Fri Jun  6 18:10:34 1997
+++ mercury-0.7.3/boehm_gc/config.h     Fri Jul 10 00:47:00 1998
@@ -119,6 +119,11 @@
 #    define LINUX
 #    define mach_type_known
 # endif
+# if defined(linux) && defined(__mc68000__)
+#    define M68K
+#    define LINUX
+#    define mach_type_known
+# endif
 # if defined(__alpha) || defined(__alpha__)
 #   define ALPHA
 #   if defined(linux) || defined(__linux__)
@@ -342,6 +347,29 @@
 #      define HEURISTIC2
        extern char etext;
 #      define DATASTART ((ptr_t)(&etext))
+#   endif
+#   ifdef LINUX
+#      define OS_TYPE "LINUX"
+#      define STACKBOTTOM ((ptr_t)0xf0000000)
+#      define MPROTECT_VDB
+#       ifdef __ELF__
+#            define DYNAMIC_LOADING
+            extern char **__environ;
+#            define DATASTART ((ptr_t)(&__environ))
+                             /* hideous kludge: __environ is the first */
+                             /* word in crt0.o, and delimits the start */
+                             /* of the data segment, no matter which   */
+                             /* ld options were passed through.        */
+                             /* We could use _etext instead, but that  */
+                             /* would include .rodata, which may       */
+                             /* contain large read-only data tables    */
+                             /* that we'd rather not scan.             */
+            extern int _end;
+#           define DATAEND (&_end)
+#      else
+            extern int etext;
+#            define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
+#       endif
 #   endif
 #   ifdef SUNOS4
 #      define OS_TYPE "SUNOS4"
diff -u --recursive --exclude-from=diff-excludes --new-file mercury-0.7.3-orig/
boehm_gc/os_dep.c mercury-0.7.3/boehm_gc/os_dep.c
--- mercury-0.7.3-orig/boehm_gc/os_dep.c        Thu Jul  9 23:17:38 1998
+++ mercury-0.7.3/boehm_gc/os_dep.c     Fri Jul 10 00:59:53 1998
@@ -1395,7 +1395,8 @@
 #   endif
 # endif
 # if defined(LINUX)
-    void GC_write_fault_handler(int sig, struct sigcontext_struct sc)
+#   include "../runtime/faultaddr.h"
+    void GC_write_fault_handler(int sig, int code, struct sigcontext_struct sc
)
 #   define SIG_OK (sig == SIGSEGV)
 #   define CODE_OK TRUE
        /* Empirically c.trapno == 14, but is that useful?      */
@@ -1426,11 +1427,7 @@
        char * addr = (char *) (scp -> si_addr);
 #   endif
 #   ifdef LINUX
-#     ifdef I386
-       char * addr = (char *) (sc.cr2);
-#     else
-        char * addr = /* As of 1.3.90 there seemed to be no way to do this. */
;
-#     endif
+       char * addr = (char *) GET_FAULT_ADDR(signum, code, &sc);
 #   endif
 #   if defined(MSWIN32)
        char * addr = (char *) (exc_info -> ExceptionRecord
diff -u --recursive --exclude-from=diff-excludes --new-file mercury-0.7.3-orig/
configure mercury-0.7.3/configure
--- mercury-0.7.3-orig/configure        Thu Jul  9 23:17:37 1998
+++ mercury-0.7.3/configure     Fri Jul 10 00:09:08 1998
@@ -1745,8 +1745,9 @@
 #endif

 #include <stdio.h>
+#include "runtime/faultaddr.h"

-extern void handler(int signum, struct sigcontext_struct info);
+extern void handler(int signum, int code, struct sigcontext_struct *context);

 #define FAULT_ADDRESS ((int *)112)

@@ -1759,8 +1760,9 @@
        exit(1);
 }

-void handler(int signum, struct sigcontext_struct context) {
-       if (signum == SIGSEGV && (int *) context.cr2 == FAULT_ADDRESS) {
+void handler(int signum, int code, struct sigcontext_struct *context) {
+       void *addr = GET_FAULT_ADDR(signum, code, context);
+       if (signum == SIGSEGV && (int *)addr == FAULT_ADDRESS) {
                exit(0);
        } else {
                exit(1);
@@ -3400,7 +3402,7 @@
 USE_DLLS=no

 case "$host" in
-       i?86-*-linux|i?86-*-linux-gnu)
+       *-*-linux|*-*-linux-gnu)
                echo "$ac_t""yes" 1>&6
                EXT_FOR_SHARED_LIB=so
                ;;
diff -u --recursive --exclude-from=diff-excludes --new-file mercury-0.7.3-orig/
configure.in mercury-0.7.3/configure.in
--- mercury-0.7.3-orig/configure.in     Thu Jul  9 23:17:38 1998
+++ mercury-0.7.3/configure.in  Fri Jul 10 00:08:26 1998
@@ -345,8 +345,9 @@
 #endif

 #include <stdio.h>
+#include "runtime/faultaddr.h"

-extern void handler(int signum, struct sigcontext_struct info);
+extern void handler(int signum, int code, struct sigcontext_struct *context);

 #define FAULT_ADDRESS ((int *)112)

@@ -359,8 +360,9 @@
        exit(1);
 }

-void handler(int signum, struct sigcontext_struct context) {
-       if (signum == SIGSEGV && (int *) context.cr2 == FAULT_ADDRESS) {
+void handler(int signum, int code, struct sigcontext_struct *context) {
+       void *addr = GET_FAULT_ADDR(signum, code, context);
+       if (signum == SIGSEGV && (int *)addr == FAULT_ADDRESS) {
                exit(0);
        } else {
                exit(1);
@@ -1409,7 +1411,7 @@
 USE_DLLS=no

 case "$host" in
-       i?86-*-linux|i?86-*-linux-gnu)
+       *-*-linux|*-*-linux-gnu)
                AC_MSG_RESULT(yes)
                EXT_FOR_SHARED_LIB=so
                ;;
diff -u --recursive --exclude-from=diff-excludes --new-file mercury-0.7.3-orig/
runtime/faultaddr.h mercury-0.7.3/runtime/faultaddr.h
--- mercury-0.7.3-orig/runtime/faultaddr.h      Thu Jan  1 01:00:00 1970
+++ mercury-0.7.3/runtime/faultaddr.h   Fri Jul 10 00:15:16 1998
@@ -0,0 +1,42 @@
+/*
+ * Determine fault address from struct sigcontext on Linux
+ */
+
+#if defined(__i386__)
+
+#define GET_FAULT_ADDR(sig,code,sc) \
+    ((void *)(((struct sigcontext_struct *)(&code))->cr2))
+
+#elif defined(__mc68000__)
+
+/* GET_FAULT_ADDR is a bit complicated to implement on m68k, because the fault
+   address can't be found directly in the sigcontext. One has to look at the
+   CPU frame, and that one is different for each CPU.
+   */
+#define GET_FAULT_ADDR(sig,code,sv) \
+    ({
                                        \
+               struct sigcontext *scp = (struct sigcontext *)(sv);
\
+               int format = (scp->sc_formatvec >> 12) & 0xf;
\
+               unsigned long *framedata = (unsigned long *)(scp + 1);  \
+               unsigned long ea;
                                \
+               if (format == 0xa || format == 0xb)
                \
+                       /* 68020/030 */
                                \
+                       ea = framedata[2];
                                \
+               else if (format == 7)
                        \
+                       /* 68040 */
                                        \
+                       ea = framedata[3];
                                \
+               else if (format == 4) {
                        \
+                       /* 68060 */
                                        \
+                       ea = framedata[0];
                                \
+                       if (framedata[1] & 0x08000000)
                \
+                               /* correct addr on misaligned access */
        \
+                               ea = (ea+4095)&(~4095);
                        \
+               }
                                                \
+               (void *)ea;
                                        \
+       })
+
+#else
+
+#error No fault addr extraction on this architecture
+
+#endif
diff -u --recursive --exclude-from=diff-excludes --new-file mercury-0.7.3-orig/
runtime/memory.c mercury-0.7.3/runtime/memory.c
--- mercury-0.7.3-orig/runtime/memory.c Sat Sep  6 18:11:56 1997
+++ mercury-0.7.3/runtime/memory.c      Fri Jul 10 01:26:31 1998
@@ -140,7 +140,11 @@

 #ifdef HAVE_SIGINFO
   #if defined(HAVE_SIGCONTEXT_STRUCT)
-    static     void    complex_sighandler(int, struct sigcontext_struct);
+    #ifdef linux
+      static   void    complex_sighandler(int, int, struct sigcontext_struct);
+    #else
+      static   void    complex_sighandler(int, struct sigcontext_struct);
+    #endif
   #elif defined(HAVE_SIGINFO_T)
     static     void    complex_bushandler(int, siginfo_t *, void *);
     static     void    complex_segvhandler(int, siginfo_t *, void *);
@@ -831,6 +835,7 @@
 #endif /* not HAVE_MPROTECT || not HAVE_SIGINFO */

 #if defined(HAVE_SIGCONTEXT_STRUCT)
+#include "faultaddr.h"

 static void
 setup_signal(void)
@@ -849,9 +854,9 @@
 }

 static void
-complex_sighandler(int sig, struct sigcontext_struct sigcontext)
+complex_sighandler(int sig, int code, struct sigcontext_struct sigcontext)
 {
-       void *address = (void *) sigcontext.cr2;
+       void *address = (void *)GET_FAULT_ADDR(sig,code,&sigcontext);
   #ifdef PC_ACCESS
        void *pc_at_signal = (void *) sigcontext.PC_ACCESS;
   #endif
--- mercury-0.7.3-orig/debian/control   Thu Jul  9 23:17:38 1998
+++ mercury-0.7.3/debian/control        Wed Jul 15 14:48:28 1998
@@ -5,7 +5,7 @@
 Standards-Version: 2.4.0.0

 Package: mercury
-Architecture: any
+Architecture: i386 m68k
 Depends: ${shlibs:Depends}
 Recommends: gcc
 Description: New logic/functional programming language
     _________________________________________________________________
   
   Acknowledgement sent to Roman.Hodek at informatik.uni-erlangen.de:
   New bug report received and forwarded. Full text available.
     _________________________________________________________________
   
   Report forwarded to debian-bugs-dist at lists.debian.org:
   Bug#24611; Package mercory. Full text available.
     _________________________________________________________________
   
   
    Ian Jackson / owner at bugs.debian.org, through the Debian bug database
    
   Last modified: 12:39:02 GMT Fri 17 Jul (timestamp page available).

-- 
       Tyson Dowd           # "Bill Gates is a white persian cat and a monocle
                            # away from becoming another James Bond villan."
     trd at cs.mu.oz.au        # "No Mr Bond, I expect you to upgrade."
http://www.cs.mu.oz.au/~trd #                -- Dennis Miller and Terri Branch



More information about the developers mailing list