pkgsrc-Changes archive

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

CVS commit: pkgsrc/emulators/ski



Module Name:    pkgsrc
Committed By:   scole
Date:           Thu Jan 23 15:59:36 UTC 2020

Modified Files:
        pkgsrc/emulators/ski: Makefile distinfo
        pkgsrc/emulators/ski/patches: patch-an

Log Message:
Fix for big endian hosts.  With this change, ski "should" be able to run on any NetBSD host as well as it does on i386.

Tested on amd64, i386, and macppc.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 pkgsrc/emulators/ski/Makefile
cvs rdiff -u -r1.7 -r1.8 pkgsrc/emulators/ski/distinfo
cvs rdiff -u -r1.3 -r1.4 pkgsrc/emulators/ski/patches/patch-an

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

Modified files:

Index: pkgsrc/emulators/ski/Makefile
diff -u pkgsrc/emulators/ski/Makefile:1.34 pkgsrc/emulators/ski/Makefile:1.35
--- pkgsrc/emulators/ski/Makefile:1.34  Sat Jan 18 23:30:50 2020
+++ pkgsrc/emulators/ski/Makefile       Thu Jan 23 15:59:36 2020
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.34 2020/01/18 23:30:50 rillig Exp $
+# $NetBSD: Makefile,v 1.35 2020/01/23 15:59:36 scole Exp $
 #
 
 DISTNAME=      ski-1.3.2
-PKGREVISION=   16
+PKGREVISION=   17
 CATEGORIES=    emulators
 MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=ski/}
 

Index: pkgsrc/emulators/ski/distinfo
diff -u pkgsrc/emulators/ski/distinfo:1.7 pkgsrc/emulators/ski/distinfo:1.8
--- pkgsrc/emulators/ski/distinfo:1.7   Sun Nov 17 23:05:19 2019
+++ pkgsrc/emulators/ski/distinfo       Thu Jan 23 15:59:36 2020
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.7 2019/11/17 23:05:19 scole Exp $
+$NetBSD: distinfo,v 1.8 2020/01/23 15:59:36 scole Exp $
 
 SHA1 (ski-1.3.2.tar.gz) = fc067041a70cf45cad6af42da7ffe5bf100d7c65
 RMD160 (ski-1.3.2.tar.gz) = 1ff739eac7b8163026d208ee9b51d134f524e73f
@@ -18,7 +18,7 @@ SHA1 (patch-aj) = c2ac0b850381d2fee3b3f7
 SHA1 (patch-ak) = 0abaa09fb172ebbc8715908f5c6f49936b22aefa
 SHA1 (patch-al) = 1911d6c8e051ab2b64055cf1c64856188268619e
 SHA1 (patch-am) = 0965936933424ab4af4d1fa3384808f4e92f9b04
-SHA1 (patch-an) = 806e93b03b5c5af8570af968706f73609484b578
+SHA1 (patch-an) = 0d84833e0e16a779c60b9152f91cf6df897af1fc
 SHA1 (patch-ao) = 8f2eabd4d8dc6ccef593a5f50d00485a905ee523
 SHA1 (patch-ap) = a98cd0aa55a002020c26fb70e5549bd16270bf39
 SHA1 (patch-src-line_separator.h) = 2c9b0c2fdace6bc59735cbeb9588aea21b19b1db

Index: pkgsrc/emulators/ski/patches/patch-an
diff -u pkgsrc/emulators/ski/patches/patch-an:1.3 pkgsrc/emulators/ski/patches/patch-an:1.4
--- pkgsrc/emulators/ski/patches/patch-an:1.3   Sun Nov 17 23:05:19 2019
+++ pkgsrc/emulators/ski/patches/patch-an       Thu Jan 23 15:59:36 2020
@@ -1,8 +1,8 @@
-$NetBSD: patch-an,v 1.3 2019/11/17 23:05:19 scole Exp $
+$NetBSD: patch-an,v 1.4 2020/01/23 15:59:36 scole Exp $
 
 --- src/netbsd/ssc-netbsd.c.orig       2010-11-04 05:01:51.000000000 +0000
-+++ src/netbsd/ssc-netbsd.c    2016-05-06 14:44:42.000000000 -0400
-@@ -0,0 +1,464 @@
++++ src/netbsd/ssc-netbsd.c    2020-01-23 08:47:10.550291867 -0800
+@@ -0,0 +1,545 @@
 +/*
 + * Copyright (C) 1995-2007, Hewlett-Packard Development Company, L.P.
 + *
@@ -79,6 +79,9 @@ $NetBSD: patch-an,v 1.3 2019/11/17 23:05
 +static int fdin, fdout;
 +static struct termios saved_tios;
 +
++static void byteReverse(BYTE *, size_t);
++static void washBytes(BYTE *, size_t);
++
 +static void sigchld_handler(int sig, siginfo_t *si, void *ctx)
 +{
 +      tcsetattr(fdin, TCSANOW, &saved_tios);
@@ -222,6 +225,45 @@ $NetBSD: patch-an,v 1.3 2019/11/17 23:05
 +              intrsim = extint = YES;
 +}
 +
++static void byteReverse(BYTE *b, size_t len) {
++        BYTE tmpByte;
++        size_t start = 0;
++        size_t end = len - 1;
++
++        if ( len < 2 )
++                return;
++
++        while( start < end ) {
++                tmpByte = b[end];
++                b[end] = b[start];
++                b[start] = tmpByte;
++
++                start++;
++                end--;
++        }
++}
++
++/*
++ * reverse bytes when transfering between host & target if
++ * endianness differs.
++ * There are macros available such as FIX_BYTEORDER_* for
++ * HWORD 2 (H),  WORD 4 (W), ADDR/DWORD 8 (D),  QWORD 16 (Q)
++ * that could be used instead, but IMHO this function is more
++ * convenient for some cases
++ *
++ */
++static void washBytes(BYTE *b, size_t len) {
++#if BYTE_ORDER == BIG_ENDIAN
++      /* target little <=> host big */
++      if (!PSR_BE)
++              byteReverse(b, len);
++#else
++      /* target big <=> host little */
++      if (PSR_BE)
++              byteReverse(b, len);
++#endif
++}
++
 +void doSSC(HWORD num, REG arg0, REG arg1, REG arg2, REG arg3, REG *ret)
 +{
 +      BOOL olddt = PSR_DT;
@@ -252,6 +294,7 @@ $NetBSD: patch-an,v 1.3 2019/11/17 23:05
 +
 +      case SSC_GET_ARGS:
 +              memBBWrt(arg0, commandline, commandline_len);
++
 +              *ret = commandline_len;
 +              break;
 +
@@ -271,6 +314,16 @@ $NetBSD: patch-an,v 1.3 2019/11/17 23:05
 +              sscTime.sec  = tm->tm_sec;
 +              sscTime.msec = tp.tv_usec/1000;
 +              sscTime.wday = tm->tm_wday;
++
++              sscTime.year = FIX_BYTEORDER_W(PSR_BE, sscTime.year);
++              sscTime.mon  = FIX_BYTEORDER_W(PSR_BE, sscTime.mon);
++              sscTime.mday = FIX_BYTEORDER_W(PSR_BE, sscTime.mday);
++              sscTime.hour = FIX_BYTEORDER_W(PSR_BE, sscTime.hour);
++              sscTime.min  = FIX_BYTEORDER_W(PSR_BE, sscTime.min);
++              sscTime.sec  = FIX_BYTEORDER_W(PSR_BE, sscTime.sec);
++              sscTime.msec = FIX_BYTEORDER_W(PSR_BE, sscTime.msec);
++              sscTime.wday = FIX_BYTEORDER_W(PSR_BE, sscTime.wday);
++
 +              memBBWrtP(arg0, (BYTE *)&sscTime, sizeof(SscTime));
 +              /* no return value */
 +              break;
@@ -287,9 +340,16 @@ $NetBSD: patch-an,v 1.3 2019/11/17 23:05
 +              tv.ssc_Usec = tp.tv_usec;
 +              tz.ssc_Minuteswest = tzp.tz_minuteswest;
 +              tz.ssc_Dsttime = tzp.tz_dsttime;
++
++              tv.ssc_Sec = FIX_BYTEORDER_W(PSR_BE, tv.ssc_Sec);
++              tv.ssc_Usec = FIX_BYTEORDER_W(PSR_BE, tv.ssc_Usec);
 +              memBBWrtP(arg0, (BYTE *)&tv, sizeof(tv));
-+              if (arg1 != 0)
++
++              if (arg1 != 0) {
++                      tz.ssc_Minuteswest = FIX_BYTEORDER_W(PSR_BE, tz.ssc_Minuteswest);
++                      tz.ssc_Dsttime = FIX_BYTEORDER_W(PSR_BE, tz.ssc_Dsttime);
 +                      memBBWrtP(arg1, (BYTE *)&tz, sizeof(tz));
++              }
 +              break;
 +      }
 +
@@ -343,6 +403,8 @@ $NetBSD: patch-an,v 1.3 2019/11/17 23:05
 +              char *map;
 +              int i;
 +
++              *ret = 0;
++              
 +              filesize = lseek(arg0, 0LL, SEEK_END);
 +              if (filesize == -1 || arg3 > filesize) {
 +                      *ret = -1;
@@ -353,6 +415,9 @@ $NetBSD: patch-an,v 1.3 2019/11/17 23:05
 +              adr = arg2;
 +              for (i = 0; i < arg1; i++) {
 +                      memBBRd(adr, (BYTE *)&iov, sizeof(iov));
++                      washBytes((BYTE *)&iov.addr, sizeof(iov.addr));
++                      washBytes((BYTE *)&iov.len, sizeof(iov.len));
++
 +                      size += iov.len;
 +                      adr += sizeof(iov);
 +              }
@@ -370,9 +435,13 @@ $NetBSD: patch-an,v 1.3 2019/11/17 23:05
 +              ofs = 0;
 +              for (i = 0; i < arg1; i++) {
 +                      memBBRd(adr, (BYTE *)&iov, sizeof(iov));
++                      washBytes((BYTE *)&iov.addr, sizeof(iov.addr));
++                      washBytes((BYTE *)&iov.len, sizeof(iov.len));
++                      
 +                      if (ofs + iov.len >= size)
 +                              iov.len = size - ofs;
-+                      memBBWrt_opt(iov.addr, map + ofs, iov.len);
++                      memBBWrt(iov.addr, map + ofs, iov.len);
++
 +                      ofs += iov.len;
 +                      adr += sizeof(iov);
 +              }
@@ -389,11 +458,16 @@ $NetBSD: patch-an,v 1.3 2019/11/17 23:05
 +              SscReqNode *p;
 +
 +              memBBRd(arg0, (BYTE *)&stat, sizeof(stat));
++              washBytes((BYTE *)&stat.fd, sizeof(stat.fd));
++              washBytes((BYTE *)&stat.count, sizeof(stat.count));
++              
 +              *ret = -1;
 +              for (p = sscPend; p; p = p->next) {
 +                      if (p->fd == stat.fd) {
 +                              stat.count = p->count;
 +                              delSscReq(p);
++                              washBytes((BYTE *)&stat.fd, sizeof(stat.fd));
++                              washBytes((BYTE *)&stat.count, sizeof(stat.count));
 +                              memBBWrt(arg0, (BYTE *)&stat, sizeof(stat));
 +                              *ret = 0;
 +                              break;
@@ -420,6 +494,9 @@ $NetBSD: patch-an,v 1.3 2019/11/17 23:05
 +              adr = arg2;
 +              for (i = 0; i < arg1; i++) {
 +                      memBBRd(adr, (BYTE *)&iov, sizeof(iov));
++                      washBytes((BYTE *)&iov.addr, sizeof(iov.addr));
++                      washBytes((BYTE *)&iov.len, sizeof(iov.len));
++
 +                      size += iov.len;
 +                      adr += sizeof(iov);
 +              }
@@ -437,9 +514,13 @@ $NetBSD: patch-an,v 1.3 2019/11/17 23:05
 +              ofs = 0;
 +              for (i = 0; i < arg1; i++) {
 +                      memBBRd(adr, (BYTE *)&iov, sizeof(iov));
++                      washBytes((BYTE *)&iov.addr, sizeof(iov.addr));
++                      washBytes((BYTE *)&iov.len, sizeof(iov.len));
++
 +                      if (ofs + iov.len >= size)
 +                              iov.len = size - ofs;
 +                      memBBRd(iov.addr, map, iov.len);
++                      
 +                      ofs += iov.len;
 +                      adr += sizeof(iov);
 +              }



Home | Main Index | Thread Index | Old Index