Sun Sep 5 07:27:14 2021 UTC ()
Apply my recent fixes that have been upstreamed (and improved):

----
r6572 | debug | 2021-08-29 17:53:05 +0100 (Sun, 29 Aug 2021) | 1 line

The ARM "permanently undefined" instructions now result in an und exception
(patch from Nick Hudson).

----
r6573 | debug | 2021-08-29 18:02:18 +0100 (Sun, 29 Aug 2021) | 1 line

Storing to memory is not allowed until the CPU has initialized completely; this
code was for ARM OpenFirmware, which is not currently in use by any machine.

----
r6576 | debug | 2021-08-30 10:23:38 +0100 (Mon, 30 Aug 2021) | 1 line

Fix for ARM carry flag update for some instructions (patch from Nick Hudson).
Also updating the NetBSD/cats installation instructions to 9.2.


(skrll)
diff -r1.73 -r1.74 pkgsrc/emulators/gxemul/Makefile
diff -r1.65 -r1.66 pkgsrc/emulators/gxemul/distinfo
diff -r0 -r1.1 pkgsrc/emulators/gxemul/patches/patch-doc_machine__cats.html
diff -r0 -r1.1 pkgsrc/emulators/gxemul/patches/patch-src_cpus_cpu__arm.c
diff -r0 -r1.1 pkgsrc/emulators/gxemul/patches/patch-src_cpus_cpu__arm__instr.c
diff -r0 -r1.1 pkgsrc/emulators/gxemul/patches/patch-src_cpus_cpu__arm__instr__dpi.c

cvs diff -r1.73 -r1.74 pkgsrc/emulators/gxemul/Makefile (expand / switch to unified diff)

--- pkgsrc/emulators/gxemul/Makefile 2021/04/24 07:31:36 1.73
+++ pkgsrc/emulators/gxemul/Makefile 2021/09/05 07:27:13 1.74
@@ -1,16 +1,17 @@ @@ -1,16 +1,17 @@
1# $NetBSD: Makefile,v 1.73 2021/04/24 07:31:36 fcambus Exp $ 1# $NetBSD: Makefile,v 1.74 2021/09/05 07:27:13 skrll Exp $
2 2
3DISTNAME= gxemul-0.7.0 3DISTNAME= gxemul-0.7.0
 4PKGREVISION= 1
4CATEGORIES= emulators 5CATEGORIES= emulators
5MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=gxemul/} 6MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=gxemul/}
6 7
7MAINTAINER= pkgsrc-users@NetBSD.org 8MAINTAINER= pkgsrc-users@NetBSD.org
8HOMEPAGE= http://gavare.se/gxemul/ 9HOMEPAGE= http://gavare.se/gxemul/
9COMMENT= Framework for full-system computer architecture emulation 10COMMENT= Framework for full-system computer architecture emulation
10LICENSE= modified-bsd 11LICENSE= modified-bsd
11 12
12USE_TOOLS+= pax 13USE_TOOLS+= pax
13 14
14USE_LANGUAGES= c 15USE_LANGUAGES= c
15HAS_CONFIGURE= yes 16HAS_CONFIGURE= yes
16BUILD_TARGET= build 17BUILD_TARGET= build

cvs diff -r1.65 -r1.66 pkgsrc/emulators/gxemul/distinfo (expand / switch to unified diff)

--- pkgsrc/emulators/gxemul/distinfo 2021/04/24 07:31:36 1.65
+++ pkgsrc/emulators/gxemul/distinfo 2021/09/05 07:27:13 1.66
@@ -1,6 +1,10 @@ @@ -1,6 +1,10 @@
1$NetBSD: distinfo,v 1.65 2021/04/24 07:31:36 fcambus Exp $ 1$NetBSD: distinfo,v 1.66 2021/09/05 07:27:13 skrll Exp $
2 2
3SHA1 (gxemul-0.7.0.tar.gz) = 3a201be34b53bc851842c5a2ded6244e217e7cca 3SHA1 (gxemul-0.7.0.tar.gz) = 3a201be34b53bc851842c5a2ded6244e217e7cca
4RMD160 (gxemul-0.7.0.tar.gz) = 590a2ab904c2999552e33da42f1724d44efb9342 4RMD160 (gxemul-0.7.0.tar.gz) = 590a2ab904c2999552e33da42f1724d44efb9342
5SHA512 (gxemul-0.7.0.tar.gz) = d977342843e903aedd9dcdf6fdab81ceb5ee1552bf3b90deb77eb59b42e5fad3a65f216ce33cf33259372ff9a10af5b1365827de949f0c61fb9859b417972c71 5SHA512 (gxemul-0.7.0.tar.gz) = d977342843e903aedd9dcdf6fdab81ceb5ee1552bf3b90deb77eb59b42e5fad3a65f216ce33cf33259372ff9a10af5b1365827de949f0c61fb9859b417972c71
6Size (gxemul-0.7.0.tar.gz) = 5985021 bytes 6Size (gxemul-0.7.0.tar.gz) = 5985021 bytes
 7SHA1 (patch-doc_machine__cats.html) = 1c67fbfe42fa86427e3ebdc6720b894123eb4672
 8SHA1 (patch-src_cpus_cpu__arm.c) = c34c78a13a65b06d8a0011a8bbb27ecaed3f4db9
 9SHA1 (patch-src_cpus_cpu__arm__instr.c) = b91c6b4de6f47de28db259dac6146f46d3f81787
 10SHA1 (patch-src_cpus_cpu__arm__instr__dpi.c) = 160d870151cd25e5393f57acbf91525b69fa41f3

File Added: pkgsrc/emulators/gxemul/patches/patch-doc_machine__cats.html
$NetBSD: patch-doc_machine__cats.html,v 1.1 2021/09/05 07:27:13 skrll Exp $

--- doc/machine_cats.html.orig	2021-04-22 18:04:13.000000000 +0000
+++ doc/machine_cats.html
@@ -46,8 +46,8 @@ SUCH DAMAGE.
 
 
 <p>The CATS emulation mode is working well enough to run
-old versions of <a href="#netbsdcatsinstall">NetBSD/cats</a> and
-<a href="#openbsdcatsinstall">OpenBSD/cats</a>.</p>
+<a href="#netbsdcatsinstall">NetBSD/cats</a> and
+an old version of <a href="#openbsdcatsinstall">OpenBSD/cats</a>.</p>
 
 <p><font color="red"><small><a name="#debiancats">Debian GNU/Linux</a></small></font> could
 perhaps run in the future.
@@ -80,14 +80,14 @@ To install NetBSD/cats onto a disk image
 
 </pre>
   <li>Download the NetBSD/cats ISO image and the generic and install kernels:<pre>
-	<a href="ftp://ftp.de.netbsd.org/pub/NetBSD/iso/8.1/NetBSD-8.1-cats.iso">ftp://ftp.de.netbsd.org/pub/NetBSD/iso/8.1/NetBSD-8.1-cats.iso</a>
-	<a href="ftp://ftp.de.netbsd.org/pub/NetBSD/NetBSD-8.1/cats/binary/kernel/netbsd-GENERIC.aout.gz">ftp://ftp.de.netbsd.org/pub/NetBSD/NetBSD-8.1/cats/binary/kernel/netbsd-GENERIC.aout.gz</a>
-	<a href="ftp://ftp.de.netbsd.org/pub/NetBSD/NetBSD-8.1/cats/binary/kernel/netbsd-INSTALL.aout.gz">ftp://ftp.de.netbsd.org/pub/NetBSD/NetBSD-8.1/cats/binary/kernel/netbsd-INSTALL.aout.gz</a>
+	<a href="ftp://ftp.de.netbsd.org/pub/NetBSD/iso/9.2/NetBSD-9.2-cats.iso">ftp://ftp.de.netbsd.org/pub/NetBSD/iso/9.2/NetBSD-9.2-cats.iso</a>
+	<a href="ftp://ftp.de.netbsd.org/pub/NetBSD/NetBSD-9.2/cats/binary/kernel/netbsd-GENERIC.aout.gz">ftp://ftp.de.netbsd.org/pub/NetBSD/NetBSD-9.2/cats/binary/kernel/netbsd-GENERIC.aout.gz</a>
+	<a href="ftp://ftp.de.netbsd.org/pub/NetBSD/NetBSD-9.2/cats/binary/kernel/netbsd-INSTALL.aout.gz">ftp://ftp.de.netbsd.org/pub/NetBSD/NetBSD-9.2/cats/binary/kernel/netbsd-INSTALL.aout.gz</a>
 
 </pre>
   <p>
   <li>Start the installation like this:<pre>
-	<b>gxemul -X -E cats -d nbsd_cats.img -d NetBSD-8.1-cats.iso netbsd-INSTALL.aout.gz</b>
+	<b>gxemul -X -E cats -d nbsd_cats.img -d NetBSD-9.2-cats.iso netbsd-INSTALL.aout.gz</b>
 
 </pre>
 	and proceed like you would do if you were installing NetBSD on a real
@@ -96,11 +96,8 @@ To install NetBSD/cats onto a disk image
 
 <p>Note that there may be some long delays during bootup.
 
-<p>(NOTE: Older versions of NetBSD could install via FTP in older versions
-of GXemul. Right now, that seems to not be possible, resulting in ethernet
-timeouts etc. Whether it is due to bit rot in the emulator, or due to NetBSD
-having changed over time, has not been debugged.
-If you want to try an FTP install anyway, 
+<p>(NOTE: It may also be possible to install via FTP, but this is slow and
+sometimes unstable. If you want to try an FTP install anyway, 
 start the install without <tt>-d xxxxx.iso</tt> and use
 IPv4 address 10.0.0.1, gateway/default route 10.0.0.254, netmask 
 255.0.0.0, and nameserver 10.0.0.254, when asked to configure the network.)

File Added: pkgsrc/emulators/gxemul/patches/patch-src_cpus_cpu__arm.c
$NetBSD: patch-src_cpus_cpu__arm.c,v 1.1 2021/09/05 07:27:13 skrll Exp $

--- src/cpus/cpu_arm.c.orig	2021-09-05 05:56:14.113306233 +0000
+++ src/cpus/cpu_arm.c
@@ -158,13 +158,17 @@ int arm_cpu_new(struct cpu *cpu, struct 
 		cpu->cd.arm.coproc[14] = arm_coproc_xscale_14;
 
 	/*
-	 *  NOTE/TODO: Ugly hack for OpenFirmware emulation:
+	 *  OLD: Ugly hack for OpenFirmware emulation:
+	 *
+	 *  Move this to the end of corresponding machine initialization
+	 *  code.
+	 *
+	 *	if (cpu->machine->prom_emulation) {
+	 *		cpu->cd.arm.of_emul_addr = cpu->machine->physical_ram_in_mb
+	 *		    * 1048576 - 8;
+	 *		store_32bit_word(cpu, cpu->cd.arm.of_emul_addr, 0xef8c64be);
+	 *	}
 	 */
-	if (cpu->machine->prom_emulation) {
-		cpu->cd.arm.of_emul_addr = cpu->machine->physical_ram_in_mb
-		    * 1048576 - 8;
-		store_32bit_word(cpu, cpu->cd.arm.of_emul_addr, 0xef8c64be);
-	}
 
 	cpu->cd.arm.flags = cpu->cd.arm.cpsr >> 28;
 

File Added: pkgsrc/emulators/gxemul/patches/patch-src_cpus_cpu__arm__instr.c
$NetBSD: patch-src_cpus_cpu__arm__instr.c,v 1.1 2021/09/05 07:27:13 skrll Exp $

--- src/cpus/cpu_arm_instr.c.orig	2021-04-22 18:04:18.000000000 +0000
+++ src/cpus/cpu_arm_instr.c
@@ -3534,6 +3534,9 @@ X(to_be_translated)
 				int lsb = (iword >> 7) & 31;
 				int width = 1 + ((iword >> 16) & 31);
 				ic->arg[2] = (width << 16) + lsb;
+			} else if ((iword & 0x07f000f0) == 0x07f000f0) {
+				ic->f = cond_instr(und);
+				ic->arg[0] = addr & 0xfff;
 			} else {
 				if (!cpu->translation_readahead)
 					fatal("unimplemented special non-loadstore encoding!\n");

File Added: pkgsrc/emulators/gxemul/patches/patch-src_cpus_cpu__arm__instr__dpi.c
$NetBSD: patch-src_cpus_cpu__arm__instr__dpi.c,v 1.1 2021/09/05 07:27:13 skrll Exp $

--- src/cpus/cpu_arm_instr_dpi.c.orig	2021-04-22 18:04:18.000000000 +0000
+++ src/cpus/cpu_arm_instr_dpi.c
@@ -255,7 +255,7 @@ void A__NAME(struct cpu *cpu, struct arm
 
 #if defined(A__CMP) || defined(A__RSB) || defined(A__SUB) || \
     defined(A__RSC) || defined(A__SBC)
-	if ((uint32_t)a >= (uint32_t)b)
+	if (c32 == c64)
 		cpu->cd.arm.flags |= ARM_F_C;
 #else
 #if defined(A__ADC) || defined(A__ADD) || defined(A__CMN)