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

Bug#24740: marked as done (xcopilot can't load 3com's debug rom images)



Your message dated Mon, 1 Oct 2001 15:56:38 -0700
with message-id <20011001155638.A3274@klecker.debian.org>
and subject line Bugs close after package removal
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Darren Benham
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 19 Jul 1998 03:54:00 +0000
Received: (qmail 32070 invoked from network); 19 Jul 1998 03:54:00 -0000
Received: from nautilus.netg.se (root@194.52.205.2)
  by debian.novare.net with SMTP; 19 Jul 1998 03:54:00 -0000
Received: from twoflower.iko.pp.se (root@twoflower.iko.pp.se [194.52.205.68])
	by nautilus.netg.se (8.8.8/8.8.8/Debian/GNU) with ESMTP id FAA17442
	for <submit@bugs.debian.org>; Sun, 19 Jul 1998 05:53:57 +0200
Received: from twoflower.iko.pp.se (iko@localhost [127.0.0.1])
	by twoflower.iko.pp.se (8.9.1/8.9.1/Debian/GNU) with ESMTP id FAA02527
	for <submit@bugs.debian.org>; Sun, 19 Jul 1998 05:51:27 +0200
Message-Id: <199807190351.FAA02527@twoflower.iko.pp.se>
X-Mailer: exmh version 2.0.2 2/24/98 (debian) 
To: submit@bugs.debian.org
Subject: xcopilot can't load 3com's debug rom images
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Date: Sun, 19 Jul 1998 05:51:25 +0200
From: Anders Hammarquist <iko@iko.pp.se>

Package: xcopilot
Version: 0.6.4-1

Xcopilot will not run with the 3com debug images. With this patch that I 
hacked together, it will run both the 2.0 and 3.0 image (at least for me).

Enjoy,
/Anders

diff -urN xcopilot-v0.6.4/mc68k/memory.c xcopilot-v0.6.4.new/mc68k/memory.c
--- xcopilot-v0.6.4/mc68k/memory.c	Tue Jul 14 00:36:02 1998
+++ xcopilot-v0.6.4.new/mc68k/memory.c	Sun Jul 19 05:45:17 1998
@@ -336,12 +336,46 @@
     return rommemory + (addr >> 1);
 }
 
+static int
+verify_entrypoint(const void *rom)
+{
+    const char _bootsign[] = { 0x4e, 0xfa, 0x00, 0x00, 'b', 'o', 'o', 't',
+			       0x27, 0x10, 0xff };
+    const char _bootmask[] = { 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+			       0xff, 0xff, 0x00 };
+
+    const char *bootsign = _bootsign, *bootmask = _bootmask;
+    
+    while ((*bootsign & *bootmask) == *bootsign)
+	if ((*(char *)rom++ & *bootmask++) != *bootsign++)
+	    return 0;
+
+    return 1;
+}
+
+static const void *
+find_entrypoint(const void *rom)
+{
+    const void *entry = rom;
+
+    while (entry - rom < rom_size)
+    {
+	if (verify_entrypoint(entry))
+	    return entry;
+	else
+	    entry += 2;  /* Instructions must be word aligned */
+    }
+
+    return NULL;
+}
+
 /* This routine replaces the win_load_rom routine */
 /* It was grabbed from copilot-linux sources */
 static int load_rom(const char *dir, const char *romfile)
 {
   int i;
   char *rombuf;
+  void *resetv;
   int f;
   struct stat st;
   
@@ -375,7 +409,52 @@
   if (rommemory == (UWORD *)-1) {
     return PILOTCPU_ERROR_LOADING_ROM;
   }
-    
+  
+  /* Check if the reset vector looks plausible */
+  resetv = (void *)rommemory +
+      (ntohl(*(CPTR *)(((void *)rommemory)+4)) - rom_start);
+  
+  if (!verify_entrypoint(resetv))  
+  {
+      int offset;
+      int pageoffset;
+      void *newrom;
+
+      /* It didn't - we need to find it */
+      if (1 != ntohs(*(UWORD *)(((void *)rommemory)+0x0c)))
+      {
+	  offset = ntohl(*(CPTR *)(((void *)rommemory)+0x68)) +
+	      sram_start - rom_start;
+      }
+      else
+      {
+	  offset = resetv - find_entrypoint(rommemory);
+      }
+
+      /* Did we find it? If not, lets go with the original. */
+      if (offset != resetv)
+      {
+	  /* It may not always be page aligned... */
+	  pageoffset = ((offset-1) & ~(getpagesize() - 1)) + getpagesize();
+
+	  munmap((void *)rommemory, rom_size);
+
+	  if ((st.st_size + offset) > rom_size) rom_size <<= 1;
+
+	  newrom = mmap(0, rom_size, PROT_READ|PROT_WRITE,
+			MAP_PRIVATE|MAP_ANON, -1, 0);
+	  rommemory = (UWORD *)mmap(newrom+pageoffset, rom_size-pageoffset,
+				    PROT_READ|PROT_WRITE,
+				    MAP_FILE|MAP_PRIVATE|MAP_FIXED, f, 0);
+	  if (rommemory == (UWORD *)-1) {
+	      return PILOTCPU_ERROR_LOADING_ROM;
+	  }
+	  memcpy(((void *)rommemory)-offset, rommemory, 256);
+	  ((void *)rommemory) -= offset;
+      }
+  }
+
+#ifndef WORDS_BIGENDIAN
   for (i = 0; i < rom_size/2; i++) {
     UWORD *p;
     UBYTE *bp;
@@ -383,7 +462,8 @@
     bp = (UBYTE *)p;
     *p = (*bp << 8) | *(bp + 1);
   }
-    
+#endif
+
   close(f);
   return 0;
 }

-- 
 -- Of course I'm crazy, but that doesn't mean I'm wrong.
Anders Hammarquist   |       Mud at Kingdoms        | iko@netg.se
NetGuide Scandinavia |   telnet kingdoms.se 1812    | Fax: +46 31 50 79 39
http://www.netg.se   |                              | Tel: +46 31 50 79 40


---------------------------------------
Received: (at 24740-done) by bugs.debian.org; 1 Oct 2001 22:56:39 +0000
>From baruch@klecker.debian.org Mon Oct 01 17:56:39 2001
Return-path: <baruch@klecker.debian.org>
Received: from klecker.debian.org [198.186.203.20] (mail)
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 15oBzK-0006Pl-00; Mon, 01 Oct 2001 17:56:38 -0500
Received: from baruch by klecker.debian.org with local (Exim 3.12 1 (Debian))
	id 15oBzK-0000wE-00; Mon, 01 Oct 2001 15:56:38 -0700
Date: Mon, 1 Oct 2001 15:56:38 -0700
To: 21966-done@bugs.debian.org, 24740-done@bugs.debian.org,
	37081-done@bugs.debian.org, 18472-done@bugs.debian.org,
	34321-done@bugs.debian.org
Subject: Bugs close after package removal
Message-ID: <20011001155638.A3274@klecker.debian.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
From: Baruch Even <baruch@klecker.debian.org>
Delivered-To: 24740-done@bugs.debian.org

xcopilot was removed from unstable since it was superseded by pose.

The bugs are old and probably meaningless by now so they are closed, 
if they persist in pose, create new bug reports for pose.

Baruch



Reply to: