[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 21:42:52 -0400
with message-id <20011001214252.A1274@unity.ncsu.edu>
and subject line POSE has replaced xcopilot
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; 2 Oct 2001 01:44:42 +0000
>From bgdarnel@tecumseh2.dyn.dhs.org Mon Oct 01 20:44:42 2001
Return-path: <bgdarnel@tecumseh2.dyn.dhs.org>
Received: from rdu26-236-070.nc.rr.com (tecumseh2.dyn.dhs.org) [66.26.236.70] (root)
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 15oEay-0005Iz-00; Mon, 01 Oct 2001 20:44:41 -0500
Received: from bgdarnel (mail@[172.16.1.35])
	by tecumseh2.dyn.dhs.org (8.9.3/8.9.3) with ESMTP id WAA24417;
	Mon, 1 Oct 2001 22:04:42 -0400
Received: from bgdarnel by bgdarnel with local (Exim 3.32 #1 (Debian))
	id 15oEaX-0000LZ-00; Mon, 01 Oct 2001 21:43:13 -0400
Date: Mon, 1 Oct 2001 21:42:52 -0400
From: Ben Darnell <ben@thoughtstream.org>
To: 18472-done@bugs.debian.org, 21966-done@bugs.debian.org,
        24740-done@bugs.debian.org, 34321-done@bugs.debian.org,
        37081-done@bugs.debian.org
Subject: POSE has replaced xcopilot
Message-ID: <20011001214252.A1274@unity.ncsu.edu>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="FL5UXtIhxfXey3p5"
Content-Disposition: inline
User-Agent: Mutt/1.3.22i
Sender: Ben Darnell <bgdarnel@tecumseh2.dyn.dhs.org>
Delivered-To: 24740-done@bugs.debian.org


--FL5UXtIhxfXey3p5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Xcopilot has been removed from the Debian distribution.  If you haven't
already, I suggest you install the pose package and use it instead of
xcopilot for your Palm emulation needs. =20

-Ben

--=20
Ben Darnell              ben@thoughtstream.org
http://thoughtstream.org
Finger bgdarnel@debian.org for PGP/GPG key 1024D/1F06E509


--FL5UXtIhxfXey3p5
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE7uRucRSRBmB8G5QkRAr64AJoD9cnx0C9YLvzsYm5/hYpTfNCW8ACeLYmO
MP4Dd5uX/DQWsnuOy2+toUs=
=lzZ2
-----END PGP SIGNATURE-----

--FL5UXtIhxfXey3p5--



Reply to: