pkgsrc-Changes archive

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

CVS commit: pkgsrc/emulators/gxemul



Module Name:    pkgsrc
Committed By:   gson
Date:           Wed Aug  8 13:53:48 UTC 2018

Modified Files:
        pkgsrc/emulators/gxemul: Makefile distinfo
        pkgsrc/emulators/gxemul/patches: patch-src_cpus_cpu_mips_instr.cc

Log Message:
emulators/gxemul: check for MIPS divide overflow

When emulating the MIPS DIV and DDIV instructions, check for divide
overflow instead of performing the overflowing divide on the host and
crashing the emulator.  This is needed to run recent versions of the
NetBSD test suite on an emulated MIPS system.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 pkgsrc/emulators/gxemul/Makefile
cvs rdiff -u -r1.52 -r1.53 pkgsrc/emulators/gxemul/distinfo
cvs rdiff -u -r1.2 -r1.3 \
    pkgsrc/emulators/gxemul/patches/patch-src_cpus_cpu_mips_instr.cc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/emulators/gxemul/Makefile
diff -u pkgsrc/emulators/gxemul/Makefile:1.60 pkgsrc/emulators/gxemul/Makefile:1.61
--- pkgsrc/emulators/gxemul/Makefile:1.60       Wed Jul  4 13:40:17 2018
+++ pkgsrc/emulators/gxemul/Makefile    Wed Aug  8 13:53:48 2018
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.60 2018/07/04 13:40:17 jperkin Exp $
+# $NetBSD: Makefile,v 1.61 2018/08/08 13:53:48 gson Exp $
 
 DISTNAME=      gxemul-0.6.0.1
-PKGREVISION=   6
+PKGREVISION=   7
 CATEGORIES=    emulators
 MASTER_SITES=  http://gxemul.sourceforge.net/src/
 

Index: pkgsrc/emulators/gxemul/distinfo
diff -u pkgsrc/emulators/gxemul/distinfo:1.52 pkgsrc/emulators/gxemul/distinfo:1.53
--- pkgsrc/emulators/gxemul/distinfo:1.52       Wed Mar 21 17:39:42 2018
+++ pkgsrc/emulators/gxemul/distinfo    Wed Aug  8 13:53:48 2018
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.52 2018/03/21 17:39:42 kamil Exp $
+$NetBSD: distinfo,v 1.53 2018/08/08 13:53:48 gson Exp $
 
 SHA1 (gxemul-0.6.0.1.tar.gz) = 8a9b7a6c08628c2a59a6e7e9c7c449c3826b4744
 RMD160 (gxemul-0.6.0.1.tar.gz) = 6943173d4149bfe40218715b8ed2c82b5b361e50
@@ -24,7 +24,7 @@ SHA1 (patch-src_cpus_cpu__ppc.cc) = 013a
 SHA1 (patch-src_cpus_cpu__ppc__instr.cc) = cdc664f35cdb289380bb959f1b07c95151b60eed
 SHA1 (patch-src_cpus_cpu__sh.cc) = b72eb6b670fad93198c9ee7d1bb57c0a69027a3a
 SHA1 (patch-src_cpus_cpu_mips.cc) = 0fdeed0a52b4b8a2e256e0f1084cf5a2131a6dce
-SHA1 (patch-src_cpus_cpu_mips_instr.cc) = 5166ef06cbacfd8ecb73796da6d7c511ed42728d
+SHA1 (patch-src_cpus_cpu_mips_instr.cc) = d11566336c179841b206d4777b0fdc4c482de03c
 SHA1 (patch-src_cpus_memory__alpha.cc) = 9bea508cc59aa6856928f0d6f5964f5f24ac648e
 SHA1 (patch-src_cpus_memory__mips__v2p.cc) = 2b859ffa219ded4e7c4a6a0ad3047e4c444d472d
 SHA1 (patch-src_cpus_memory__ppc.cc) = e321cc7acaa4a61fda91f46b05f10863d407ae9f

Index: pkgsrc/emulators/gxemul/patches/patch-src_cpus_cpu_mips_instr.cc
diff -u pkgsrc/emulators/gxemul/patches/patch-src_cpus_cpu_mips_instr.cc:1.2 pkgsrc/emulators/gxemul/patches/patch-src_cpus_cpu_mips_instr.cc:1.3
--- pkgsrc/emulators/gxemul/patches/patch-src_cpus_cpu_mips_instr.cc:1.2        Wed Mar 21 17:39:42 2018
+++ pkgsrc/emulators/gxemul/patches/patch-src_cpus_cpu_mips_instr.cc    Wed Aug  8 13:53:48 2018
@@ -1,4 +1,9 @@
-$NetBSD: patch-src_cpus_cpu_mips_instr.cc,v 1.2 2018/03/21 17:39:42 kamil Exp $
+$NetBSD: patch-src_cpus_cpu_mips_instr.cc,v 1.3 2018/08/08 13:53:48 gson Exp $
+
+When emulating the MIPS DIV and DDIV instructions, check for divide
+overflow instead of performing the overflowing divide on the host and
+crashing the emulator.  This is needed to run recent versions of the
+NetBSD test suite on an emulated MIPS system.
 
 implement trap with immediate instructions present in MIPS32.
 
@@ -6,7 +11,25 @@ Fix C++11 literals.
 
 --- src/cpus/cpu_mips_instr.cc.orig    2014-08-17 08:45:15.000000000 +0000
 +++ src/cpus/cpu_mips_instr.cc
-@@ -1461,6 +1461,92 @@ X(tne)
+@@ -1262,6 +1262,8 @@ X(div)
+       int32_t res, rem;
+       if (b == 0)
+               res = 0, rem = a;
++      else if (a == (int32_t)0x80000000U && b == -1)
++              res = 0, rem = 0;
+       else
+               res = a / b, rem = a - b*res;
+       cpu->cd.mips.lo = (int32_t)res;
+@@ -1284,6 +1286,8 @@ X(ddiv)
+       int64_t res, rem;
+       if (b == 0)
+               res = 0;
++      else if (a == (int64_t)0x8000000000000000ULL && b == -1)
++              res = 0;
+       else
+               res = a / b;
+       rem = a - b*res;
+@@ -1461,6 +1465,92 @@ X(tne)
        }
  }
  
@@ -99,7 +122,7 @@ Fix C++11 literals.
  
  /*
   *  3-register arithmetic instructions:
-@@ -3983,7 +4069,7 @@ X(to_be_translated)
+@@ -3983,7 +4073,7 @@ X(to_be_translated)
                if (cpu->delay_slot) {
                        if (!cpu->translation_readahead)
                                fatal("TODO: branch in delay slot (=%i)? (3);"
@@ -108,7 +131,7 @@ Fix C++11 literals.
                                    cpu->delay_slot, (uint64_t)addr, iword);
                        goto bad;
                }
-@@ -4446,6 +4532,37 @@ X(to_be_translated)
+@@ -4446,6 +4536,37 @@ X(to_be_translated)
                        }
                        break;
  
@@ -146,7 +169,7 @@ Fix C++11 literals.
                default:if (!cpu->translation_readahead)
                                fatal("UNIMPLEMENTED regimm rt=%i\n", rt);
                        goto bad;
-@@ -4753,7 +4870,7 @@ X(to_be_translated)
+@@ -4753,7 +4874,7 @@ X(to_be_translated)
                if (!has_warned && !cpu->translation_readahead) {
                        fatal("[ WARNING/NOTE: attempt to execute a 64-bit"
                            " instruction on an emulated 32-bit processor; "
@@ -155,7 +178,7 @@ Fix C++11 literals.
                        has_warned = 1;
                }
                if (cpu->translation_readahead)
-@@ -4770,4 +4887,3 @@ X(to_be_translated)
+@@ -4770,4 +4891,3 @@ X(to_be_translated)
  #include "cpu_dyntrans.cc" 
  #undef        DYNTRANS_TO_BE_TRANSLATED_TAIL
  }



Home | Main Index | Thread Index | Old Index