summaryrefslogtreecommitdiff
path: root/emulators/hercules/patches
diff options
context:
space:
mode:
authorryoon <ryoon>2011-05-01 23:28:57 +0000
committerryoon <ryoon>2011-05-01 23:28:57 +0000
commit5068c80074e7d9837a5e5e408e2c3e9c6f749836 (patch)
treefd23058c9cc71fa63c20a082d5dcd6c79c1eb4eb /emulators/hercules/patches
parent0cb04922ee2879adb439bcb0bf5d16e00ba49a07 (diff)
downloadpkgsrc-5068c80074e7d9837a5e5e408e2c3e9c6f749836.tar.gz
Update to 3.07
Fix PR pkg/44894 Changelog is to long. See CHANGES file in tar ball.
Diffstat (limited to 'emulators/hercules/patches')
-rw-r--r--emulators/hercules/patches/patch-Makefile.in69
-rw-r--r--emulators/hercules/patches/patch-aa74
-rw-r--r--emulators/hercules/patches/patch-ab30
-rw-r--r--emulators/hercules/patches/patch-ad16
-rw-r--r--emulators/hercules/patches/patch-ae58
-rw-r--r--emulators/hercules/patches/patch-af30
-rw-r--r--emulators/hercules/patches/patch-ag13
-rw-r--r--emulators/hercules/patches/patch-ah20
-rw-r--r--emulators/hercules/patches/patch-aj49
-rw-r--r--emulators/hercules/patches/patch-ak18
-rw-r--r--emulators/hercules/patches/patch-al18
-rw-r--r--emulators/hercules/patches/patch-am20
-rw-r--r--emulators/hercules/patches/patch-an103
-rw-r--r--emulators/hercules/patches/patch-ao16
-rw-r--r--emulators/hercules/patches/patch-ap378
-rw-r--r--emulators/hercules/patches/patch-aq15
-rw-r--r--emulators/hercules/patches/patch-ar17
-rw-r--r--emulators/hercules/patches/patch-as224
-rw-r--r--emulators/hercules/patches/patch-at15
-rw-r--r--emulators/hercules/patches/patch-au15
-rw-r--r--emulators/hercules/patches/patch-av15
-rw-r--r--emulators/hercules/patches/patch-aw15
-rw-r--r--emulators/hercules/patches/patch-configure15
-rw-r--r--emulators/hercules/patches/patch-crypto_Makefile.in15
-rw-r--r--emulators/hercules/patches/patch-decNumber_Makefile.in15
-rw-r--r--emulators/hercules/patches/patch-hercifc.h16
-rw-r--r--emulators/hercules/patches/patch-hostopts.h28
-rw-r--r--emulators/hercules/patches/patch-hstructs.h30
-rw-r--r--emulators/hercules/patches/patch-scsitape.c24
-rw-r--r--emulators/hercules/patches/patch-tapecopy.c63
-rw-r--r--emulators/hercules/patches/patch-tapedev.h (renamed from emulators/hercules/patches/patch-ac)43
31 files changed, 290 insertions, 1187 deletions
diff --git a/emulators/hercules/patches/patch-Makefile.in b/emulators/hercules/patches/patch-Makefile.in
new file mode 100644
index 00000000000..d4e1ab124f8
--- /dev/null
+++ b/emulators/hercules/patches/patch-Makefile.in
@@ -0,0 +1,69 @@
+$NetBSD: patch-Makefile.in,v 1.1 2011/05/01 23:28:58 ryoon Exp $
+
+* Fix build. Use devel/libltdl instead of internal libltdl.
+
+--- Makefile.in.orig 2010-03-07 12:04:49.000000000 +0000
++++ Makefile.in
+@@ -304,13 +304,13 @@ libherct_la_OBJECTS = $(am_libherct_la_O
+ libhercu_la_DEPENDENCIES = $(am__DEPENDENCIES_1) libhercs.la
+ am__libhercu_la_SOURCES_DIST = version.c hscutl.c hscutl2.c codepage.c \
+ logger.c logmsg.c hdl.c hostinfo.c hsocket.c memrchr.c \
+- parser.c pttrace.c fthreads.c fishhang.c ltdl.c
++ parser.c pttrace.c fthreads.c fishhang.c
+ am__objects_5 = fthreads.lo
+ @BUILD_FTHREADS_TRUE@am__objects_8 = $(am__objects_5)
+ am__objects_6 = fishhang.lo
+ @BUILD_FISHHANG_TRUE@@BUILD_FTHREADS_TRUE@am__objects_9 = \
+ @BUILD_FISHHANG_TRUE@@BUILD_FTHREADS_TRUE@ $(am__objects_6)
+-@OPTION_DYNAMIC_LOAD_TRUE@am__objects_10 = ltdl.lo
++@OPTION_DYNAMIC_LOAD_TRUE@am__objects_10 =
+ am_libhercu_la_OBJECTS = version.lo hscutl.lo hscutl2.lo codepage.lo \
+ logger.lo logmsg.lo hdl.lo hostinfo.lo hsocket.lo memrchr.lo \
+ parser.lo pttrace.lo $(am__objects_8) $(am__objects_9) \
+@@ -614,7 +614,7 @@ AUTOMAKE_OPTIONS = foreign 1.5
+ ACLOCAL_AMFLAGS = -I m4
+ lns = @LN_S@
+ SUBDIRS = decNumber m4 po util html man . crypto
+-LDADD = @LTLIBICONV@ @LTLIBINTL@ @LIBS@
++LDADD = @LTLIBICONV@ @LTLIBINTL@ @LIBS@ -lltdl
+ AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/decNumber
+ @BUILD_HERCIFC_FALSE@HERCIFC =
+ @BUILD_HERCIFC_TRUE@HERCIFC = hercifc
+@@ -687,7 +687,7 @@ dyndev_SRC = commadpt.c \
+ @OPTION_DYNAMIC_LOAD_FALSE@DYNSRC = $(dyndev_SRC)
+ @OPTION_DYNAMIC_LOAD_TRUE@DYNSRC =
+ @OPTION_DYNAMIC_LOAD_FALSE@LTDL =
+-@OPTION_DYNAMIC_LOAD_TRUE@LTDL = ltdl.c
++@OPTION_DYNAMIC_LOAD_TRUE@LTDL =
+ @OPTION_DYNAMIC_LOAD_FALSE@DYNMOD_LD_FLAGS =
+ @OPTION_DYNAMIC_LOAD_TRUE@DYNMOD_LD_FLAGS = -module \
+ @OPTION_DYNAMIC_LOAD_TRUE@ -no-undefined \
+@@ -914,7 +914,6 @@ EXTRA_libherc_la_SOURCES = $(fthreads_SR
+ $(dynamic_SRC) \
+ $(extra_SRC) \
+ $(dyndev_SRC) \
+- ltdl.c
+
+ libherc_la_LDFLAGS = $(LIB_LD_FLAGS)
+ libherc_la_LIBADD = libhercs.la \
+@@ -1166,7 +1165,6 @@ noinst_HEADERS = fishhang.h \
+ hdl.h \
+ crypto.h \
+ sockdev.h \
+- ltdl.h \
+ herc_getopt.h \
+ service.h \
+ chsc.h \
+@@ -2047,9 +2045,9 @@ tar: dist
+ install-exec-local:
+
+ install-exec-hook:
+-@BUILD_SHARED_TRUE@ rm -f $(DESTDIR)$(libdir)/libherc*.a
+-@BUILD_SHARED_TRUE@ rm -f $(DESTDIR)$(modexecdir)/dyn*.a
+-@BUILD_SHARED_TRUE@ rm -f $(DESTDIR)$(modexecdir)/hdt*.a
++#@BUILD_SHARED_TRUE@ rm -f $(DESTDIR)$(libdir)/libherc*.a
++#@BUILD_SHARED_TRUE@ rm -f $(DESTDIR)$(modexecdir)/dyn*.a
++#@BUILD_SHARED_TRUE@ rm -f $(DESTDIR)$(modexecdir)/hdt*.a
+ @BUILD_SHARED_FALSE@ rm -f $(DESTDIR)$(libdir)/libherc*
+ #
+ # NOTE : symbolic links point to FINAL destination (not to staged install)
diff --git a/emulators/hercules/patches/patch-aa b/emulators/hercules/patches/patch-aa
deleted file mode 100644
index cf549bdc0fe..00000000000
--- a/emulators/hercules/patches/patch-aa
+++ /dev/null
@@ -1,74 +0,0 @@
-$NetBSD: patch-aa,v 1.8 2010/01/17 08:00:47 dholland Exp $
-
---- makefile.orig 2001-02-11 03:21:58.000000000 +0000
-+++ makefile
-@@ -8,11 +8,11 @@ VERSION = 2.11
- # besides /usr/bin. The $PREFIX (which defaults to nothing) can be
- # overridden in the make command line, as in "PREFIX=/foo make install"
- # (the directory is only used when installing).
--DESTDIR = $(PREFIX)/usr/bin
-+INSTALLDIR = $(DESTDIR)$(PREFIX)/bin
-
- # Standard flags for all architectures
- CFLAGS = -Wall -fomit-frame-pointer -DVERSION=$(VERSION) -DNO_BYTESWAP_H
--LFLAGS = -lpthread
-+LFLAGS = ${PTHREAD_LDFLAGS} ${PTHREAD_LIBS}
-
- # Add default flags for Pentium compilations
- ifndef HOST_ARCH
-@@ -21,26 +21,28 @@ endif
-
- # Handle host architecture if specified
- ifeq ($(HOST_ARCH),i386)
--CFLAGS += -O3 -malign-double -DNO_ASM_BYTESWAP
--endif
-+CFLAGS += -O3 -DNO_ASM_BYTESWAP
-+else
- ifeq ($(HOST_ARCH),i586)
--CFLAGS += -O3 -malign-double -march=pentium
--endif
-+CFLAGS += -O3
-+else
- ifeq ($(HOST_ARCH),i686)
--CFLAGS += -O3 -malign-double -march=pentiumpro
--endif
-+CFLAGS += -O3
-+else
- ifeq ($(HOST_ARCH),alpha)
- CFLAGS += -O2 -DNO_ASM_BYTESWAP
--endif
--ifeq ($(HOST_ARCH),other)
-+else
- CFLAGS += -O3 -DNO_ASM_BYTESWAP
--endif
-+endif # alpha
-+endif # i686
-+endif # i586
-+endif # i386
-
- # Uncomment these lines for NetBSD, with either the unproven-pthreads
- # or pth packages
--#CFLAGS += -I/usr/pkg/pthreads/include -I/usr/pkg/include
--#LFLAGS += -L/usr/pkg/pthreads/lib -R/usr/pkg/pthreads
--#LFLAGS += -L/usr/pkg/lib -R/usr/pkg/pthreads/lib
-+CFLAGS += -I${PREFIX}/include
-+LFLAGS += -L${PREFIX}/lib -R${PREFIX}/lib
-+LFLAGS += -L${PREFIX}/lib
-
- # Reverse the comments below to disable Compressed CKD Dasd support
- #CFLAGS += -DNO_CCKD
-@@ -224,9 +226,9 @@ tar: clean
- (cd ..; tar cvzf hercules-$(VERSION).tar.gz hercules-$(VERSION))
-
- install: $(EXEFILES)
-- cp $(EXEFILES) $(DESTDIR)
-- cp dasdlist $(DESTDIR)
-- chown root $(DESTDIR)/hercifc
-- chmod 0751 $(DESTDIR)/hercifc
-- chmod +s $(DESTDIR)/hercifc
-+ cp $(EXEFILES) $(INSTALLDIR)
-+ cp dasdlist $(INSTALLDIR)
-+ #chown root $(INSTALLDIR)/hercifc
-+ #chmod 0751 $(INSTALLDIR)/hercifc
-+ #chmod +s $(INSTALLDIR)/hercifc
- rm hercifc
diff --git a/emulators/hercules/patches/patch-ab b/emulators/hercules/patches/patch-ab
deleted file mode 100644
index 9619d8ed0e7..00000000000
--- a/emulators/hercules/patches/patch-ab
+++ /dev/null
@@ -1,30 +0,0 @@
-$NetBSD: patch-ab,v 1.1.1.1 2001/02/19 12:35:21 agc Exp $
-
-Linux tape handling.
-
---- tapedev.c 2001/02/19 11:50:37 1.1
-+++ tapedev.c 2001/02/19 11:57:16
-@@ -1149,7 +1149,11 @@
- dev->filename, strerror(errno));
- return 0;
- }
-+#if (defined(BSD) && BSD >= 199306)
-+ stat = (stblk.mt_dsreg << 16) | stblk.mt_erreg;
-+#else
- stat = stblk.mt_gstat;
-+#endif
-
- /* Display tape status */
- if (dev->ccwtrace || dev->ccwstep)
-@@ -1240,7 +1244,11 @@
- }
-
- /* Intervention required if no tape is mounted */
-+#if (defined(BSD) && BSD >= 199306)
-+ if (GMT_DR_OPEN(((stblk.mt_dsreg << 16) | stblk.mt_erreg)))
-+#else
- if (GMT_DR_OPEN(stblk.mt_gstat))
-+#endif
- {
- dev->sense[0] = SENSE_IR;
- dev->sense[1] = SENSE1_TAPE_TUB;
diff --git a/emulators/hercules/patches/patch-ad b/emulators/hercules/patches/patch-ad
deleted file mode 100644
index 114010fb88f..00000000000
--- a/emulators/hercules/patches/patch-ad
+++ /dev/null
@@ -1,16 +0,0 @@
-$NetBSD: patch-ad,v 1.2 2005/12/09 10:46:43 joerg Exp $
-
---- hercifc.c.orig 2001-01-28 18:05:40.000000000 +0000
-+++ hercifc.c
-@@ -64,7 +64,11 @@ struct sockaddr_in *sin;
- sin = (struct sockaddr_in*)
- (oper == SIOCSIFADDR ? &ifreq.ifr_addr
- :oper == SIOCSIFDSTADDR ? &ifreq.ifr_dstaddr
-+#if defined(__NetBSD__) || defined(__DragonFly__)
-+ :oper == SIOCSIFNETMASK ? &ifreq.ifr_broadaddr
-+#else
- :oper == SIOCSIFNETMASK ? &ifreq.ifr_netmask
-+#endif
- :NULL);
-
- /* Store the IP address into the structure */
diff --git a/emulators/hercules/patches/patch-ae b/emulators/hercules/patches/patch-ae
deleted file mode 100644
index d1b98f85d49..00000000000
--- a/emulators/hercules/patches/patch-ae
+++ /dev/null
@@ -1,58 +0,0 @@
-$NetBSD: patch-ae,v 1.1.1.1 2001/02/19 12:35:21 agc Exp $
-
-Linux tape handling.
-
---- tapecopy.c 2001/02/19 12:10:13 1.1
-+++ tapecopy.c 2001/02/19 12:14:00
-@@ -113,6 +113,7 @@
- {
- int rc; /* Return code */
- struct mtget stblk; /* Area for MTIOCGET ioctl */
-+long gstat;
-
- rc = ioctl (devfd, MTIOCGET, (char*)&stblk);
- if (rc < 0)
-@@ -122,10 +123,15 @@
- return -1;
- }
-
-- print_status (devname, stblk.mt_gstat);
-+#if (defined(BSD) && BSD >= 199306)
-+ gstat = (stblk.mt_dsreg << 16) | stblk.mt_erreg;
-+#else
-+ gstat = stblk.mt_gstat;
-+#endif
-+ print_status (devname, gstat);
-
-- if (GMT_EOD(stblk.mt_gstat)) return 1;
-- if (GMT_EOT(stblk.mt_gstat)) return 1;
-+ if (GMT_EOD(gstat)) return 1;
-+ if (GMT_EOT(gstat)) return 1;
-
- return 0;
- } /* end function print_status */
-@@ -152,6 +158,7 @@
- long density; /* Tape density code */
- BYTE labelrec[81]; /* Standard label (ASCIIZ) */
- AWSTAPE_BLKHDR awshdr; /* AWSTAPE block header */
-+long gstat;
-
- /* The first argument is the tape device name */
- if (argc > 1 && argv[1] != NULL && strlen(argv[1]) > 5
-@@ -209,9 +216,14 @@
- else
- printf ("%s tape density code: 0x%lX\n", devname, density);
-
-- if (stblk.mt_gstat != 0)
-+#if (defined(BSD) && BSD >= 199306)
-+ gstat = (stblk.mt_dsreg << 16) | stblk.mt_erreg;
-+#else
-+ gstat = stblk.mt_gstat;
-+#endif
-+ if (gstat != 0)
- {
-- print_status (devname, stblk.mt_gstat);
-+ print_status (devname, gstat);
- }
-
- /* Set the tape device to process variable length blocks */
diff --git a/emulators/hercules/patches/patch-af b/emulators/hercules/patches/patch-af
deleted file mode 100644
index 19d73caae3d..00000000000
--- a/emulators/hercules/patches/patch-af
+++ /dev/null
@@ -1,30 +0,0 @@
-$NetBSD: patch-af,v 1.1 2001/02/22 11:34:59 agc Exp $
-
-> From Wofgang Solfrank (ws@tools.de)
-> What I discovered was a problem in ckddasd.c, where there are two lseeks
-> with an offset of -(CKDDASD_RECHDR_SIZE). Now CKDDASD_RECHDR_SIZE is
-> defined (in hercules.h) as sizeof(CKDDASD_RECHDR), which happens to be
-> an unsigned int. Since the offset in the lseek (and in the ckd_lseek
-> that is used as an interface routine to it) is of type off_t, i.e. 64-bit,
-> the unsigned is zero-extended to 64 bits, and thus the sign is lost.
-
---- ckddasd.c 2001/02/22 10:54:55 1.1
-+++ ckddasd.c 2001/02/22 10:55:26
-@@ -1663,7 +1663,7 @@
- }
-
- /* Backspace over end of track marker */
-- rc = ckd_lseek (dev, dev->fd, -(CKDDASD_RECHDR_SIZE), SEEK_CUR);
-+ rc = ckd_lseek (dev, dev->fd, (int) -(CKDDASD_RECHDR_SIZE), SEEK_CUR);
- if (rc == -1)
- {
- /* Handle seek error condition */
-@@ -1813,7 +1813,7 @@
- }
-
- /* Backspace over end of track marker */
-- rc = ckd_lseek (dev, dev->fd, -(CKDDASD_RECHDR_SIZE), SEEK_CUR);
-+ rc = ckd_lseek (dev, dev->fd, (int) -(CKDDASD_RECHDR_SIZE), SEEK_CUR);
- if (rc == -1)
- {
- /* Handle seek error condition */
diff --git a/emulators/hercules/patches/patch-ag b/emulators/hercules/patches/patch-ag
deleted file mode 100644
index a4dca77392d..00000000000
--- a/emulators/hercules/patches/patch-ag
+++ /dev/null
@@ -1,13 +0,0 @@
-$NetBSD: patch-ag,v 1.2 2004/05/29 23:32:19 kristerw Exp $
-
---- cpu.c.orig Sat Feb 10 11:48:23 2001
-+++ cpu.c Sun May 30 01:10:44 2004
-@@ -743,7 +743,7 @@
- {
- #define CPU_PRIORITY 15 /* CPU thread priority */
-
--#ifndef WIN32
-+#if 0
- /* Set CPU thread priority */
- if (setpriority(PRIO_PROCESS, 0, CPU_PRIORITY))
- logmsg ("HHC621I CPU thread set priority failed: %s\n",
diff --git a/emulators/hercules/patches/patch-ah b/emulators/hercules/patches/patch-ah
deleted file mode 100644
index df0474a03f5..00000000000
--- a/emulators/hercules/patches/patch-ah
+++ /dev/null
@@ -1,20 +0,0 @@
-$NetBSD: patch-ah,v 1.2 2004/06/13 14:03:28 agc Exp $
-
-Silence some compiler warnings
-
---- featall.h 2004/06/13 13:54:33 1.1
-+++ featall.h 2004/06/13 13:55:55
-@@ -20,11 +20,11 @@
- #define OPTION_NO_INLINE_DAT /* Performance option */
- #undef OPTION_NO_INLINE_VSTORE /* Performance option */
- #undef OPTION_NO_LINUX_INTERRUPT_PATCH /* Linux performance */
--#undef OPTION_FOOTPRINT_BUFFER 256 /* Size must be a power of 2 */
-+#undef OPTION_FOOTPRINT_BUFFER /* (256) Size must be a power of 2 */
- #undef OPTION_INSTRUCTION_COUNTING /* First use trace and count */
- #define OPTION_CKD_KEY_TRACING /* Trace CKD search keys */
- #define OPTION_NO_DEVICE_THREAD /* Separate threads for I/O */
--#undef OPTION_CMPSC_DEBUGLVL 3 /* 1=Exp 2=Comp 3=Both debug */
-+#undef OPTION_CMPSC_DEBUGLVL /* (3) 1=Exp 2=Comp 3=Both debug */
-
- #define FEATURE_ALD_FORMAT 0
-
diff --git a/emulators/hercules/patches/patch-aj b/emulators/hercules/patches/patch-aj
deleted file mode 100644
index c9545cb36eb..00000000000
--- a/emulators/hercules/patches/patch-aj
+++ /dev/null
@@ -1,49 +0,0 @@
-$NetBSD: patch-aj,v 1.2 2010/01/17 08:00:47 dholland Exp $
-
-Patch from Wofgang Solfrank:
-
-"Change the timeout value from 1 usec to 10 msec in the timer thread.
-At least with unproven-pthreads, the comment above that is wrong
-when stating that a 1 usec timeout would be stretched to the next
-system clock tick."
-
-Also, patch out no-longer-supported gcc language extensions.
-
---- timer.c.orig 2001-02-08 20:02:41.000000000 +0000
-+++ timer.c
-@@ -190,7 +190,7 @@ struct timeval tv;
-
- /* Decrement the CPU timer if the CPU is running */
- if(regs->cpustate == CPUSTATE_STARTED && (S64)diff > 0)
-- (S64)regs->ptimer -= (S64)diff;
-+ regs->ptimer = (S64)regs->ptimer - (S64)diff;
-
- /* Set interrupt flag if the CPU timer is negative */
- if ((S64)regs->ptimer < 0)
-@@ -207,7 +207,7 @@ struct timeval tv;
- {
- /* Decrement the CPU timer if the CPU is running */
- if( (S64)diff > 0)
-- (S64)regs->guestregs->ptimer -= (S64)diff;
-+ regs->guestregs->ptimer = (S64)regs->guestregs->ptimer - (S64)diff;
-
- /* Set interrupt flag if the CPU timer is negative */
- if ((S64)regs->guestregs->ptimer < 0)
-@@ -319,7 +319,7 @@ struct timeval tv;
- /* Calculate instructions/millisecond for this CPU */
- regs->mipsrate =
- (regs->instcount - regs->prevcount) / msecctr;
-- regs->siosrate = regs->siocount;
-+ regs->siosrate = regs->siocount * 1000 / msecctr;
-
- /* Save the instruction counter */
- regs->prevcount = regs->instcount;
-@@ -336,7 +336,7 @@ struct timeval tv;
- /* Sleep for one system clock tick by specifying a one-microsecond
- delay, which will get stretched out to the next clock tick */
- tv.tv_sec = 0;
-- tv.tv_usec = 1;
-+ tv.tv_usec = 10000;
- select (0, NULL, NULL, NULL, &tv);
-
- } /* end while */
diff --git a/emulators/hercules/patches/patch-ak b/emulators/hercules/patches/patch-ak
deleted file mode 100644
index 1517dd688fa..00000000000
--- a/emulators/hercules/patches/patch-ak
+++ /dev/null
@@ -1,18 +0,0 @@
-$NetBSD: patch-ak,v 1.2 2004/06/13 14:03:28 agc Exp $
-
-Patch from Wolfgang Solfrank:
-
-Disabling the O_SYNC option when opening printer or punch.
-
-
---- printer.c.orig Sun Jan 28 18:05:41 2001
-+++ printer.c Fri Mar 23 16:01:53 2001
-@@ -149,7 +149,7 @@
- if (dev->fd < 0 && !IS_CCW_SENSE(code))
- {
- rc = open (dev->filename,
-- O_WRONLY | O_CREAT | O_TRUNC | O_SYNC,
-+ O_WRONLY | O_CREAT | O_TRUNC,
- S_IRUSR | S_IWUSR | S_IRGRP);
- if (rc < 0)
- {
diff --git a/emulators/hercules/patches/patch-al b/emulators/hercules/patches/patch-al
deleted file mode 100644
index d0d46903ffa..00000000000
--- a/emulators/hercules/patches/patch-al
+++ /dev/null
@@ -1,18 +0,0 @@
-$NetBSD: patch-al,v 1.1 2001/03/23 16:20:56 agc Exp $
-
-Patch from Wolfgang Solfrank:
-
-A minor correction to the computation of the SIO rate.
-
---- console.c.orig Sun Feb 11 03:52:30 2001
-+++ console.c Fri Mar 23 16:01:53 2001
-@@ -1257,7 +1257,8 @@
- } /* end for(dev) */
-
- /* Wait for a file descriptor to become ready */
--#ifdef WIN32
-+#ifndef __notdef__
-+/*#ifdef WIN32*/
- {
- struct timeval tv={0,500000}; /* half a second */
- rc = select ( maxfd+1, &readset, NULL, NULL, &tv );
diff --git a/emulators/hercules/patches/patch-am b/emulators/hercules/patches/patch-am
deleted file mode 100644
index b73123135e7..00000000000
--- a/emulators/hercules/patches/patch-am
+++ /dev/null
@@ -1,20 +0,0 @@
-$NetBSD: patch-am,v 1.1 2001/03/23 16:20:56 agc Exp $
-
-Patch from Wolfgang Solfrank:
-
-Disabling the O_SYNC option when opening printer or punch.
-
---- cardpch.c.orig Sun Jan 28 18:05:38 2001
-+++ cardpch.c Fri Mar 23 16:01:53 2001
-@@ -155,9 +155,9 @@
- {
- rc = open (dev->filename,
- #ifdef WIN32
-- O_WRONLY | O_CREAT | O_TRUNC | O_SYNC | O_BINARY,
-+ O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
- #else /* WIN32 */
-- O_WRONLY | O_CREAT | O_TRUNC | O_SYNC,
-+ O_WRONLY | O_CREAT | O_TRUNC,
- #endif /* WIN32 */
- S_IRUSR | S_IWUSR | S_IRGRP);
- if (rc < 0)
diff --git a/emulators/hercules/patches/patch-an b/emulators/hercules/patches/patch-an
deleted file mode 100644
index 359d946d54d..00000000000
--- a/emulators/hercules/patches/patch-an
+++ /dev/null
@@ -1,103 +0,0 @@
-$NetBSD: patch-an,v 1.2 2010/01/17 08:00:47 dholland Exp $
-
- - regparm is only for i386
- - patch out gcc language extensions that are no longer supported
-
---- features.h.orig 2001-02-01 22:56:32.000000000 +0000
-+++ features.h
-@@ -48,6 +48,7 @@
- #undef ET
- #undef RADR
- #undef GR_A
-+#undef GR_Ax
- #undef VADR
- #undef GREG
- #undef CREG
-@@ -70,8 +71,13 @@
-
- #define ARCH_MODE ARCH_370
-
-+#ifdef __i386__
- #define DEF_INST(_name) \
- __attribute__ ((regparm(3))) void s370_ ## _name (BYTE inst[], int execflag, REGS *regs)
-+#else
-+#define DEF_INST(_name) \
-+void s370_ ## _name (BYTE inst[], int execflag, REGS *regs)
-+#endif
-
- #define ARCH_DEP(_name) \
- s370_ ## _name
-@@ -104,6 +110,7 @@ s370_ ## _name
- #define CR(_r) CR_L(_r)
- #define GR(_r) GR_L(_r)
- #define GR_A(_r, _regs) ((_regs)->GR_L((_r)))
-+#define GR_Ax(_r, _regs, _val) (((_regs)->GR_L((_r))) = (_val))
- #define MONCODE MC_L
- #define TEA EA_L
- #define ET ET_L
-@@ -129,8 +136,13 @@ s370_ ## _name
-
- #define ARCH_MODE ARCH_390
-
-+#ifdef __i386__
- #define DEF_INST(_name) \
- __attribute__ ((regparm(3))) void s390_ ## _name (BYTE inst[], int execflag, REGS *regs)
-+#else
-+#define DEF_INST(_name) \
-+void s390_ ## _name (BYTE inst[], int execflag, REGS *regs)
-+#endif
-
- #define ARCH_DEP(_name) \
- s390_ ## _name
-@@ -163,6 +175,7 @@ s390_ ## _name
- #define CR(_r) CR_L(_r)
- #define GR(_r) GR_L(_r)
- #define GR_A(_r, _regs) ((_regs)->GR_L((_r)))
-+#define GR_Ax(_r, _regs, _val) (((_regs)->GR_L((_r))) = (_val))
- #define MONCODE MC_L
- #define TEA EA_L
- #define ET ET_L
-@@ -211,8 +224,13 @@ s390_ ## _name
- #define SSEVENT_BIT ASCE_X
- #define SSGROUP_BIT ASCE_G
-
-+#ifdef __i386__
- #define DEF_INST(_name) \
- __attribute__ ((regparm(3))) void z900_ ## _name (BYTE inst[], int execflag, REGS *regs)
-+#else
-+#define DEF_INST(_name) \
-+void z900_ ## _name (BYTE inst[], int execflag, REGS *regs)
-+#endif
-
- #define ARCH_DEP(_name) \
- z900_ ## _name
-@@ -223,6 +241,7 @@ z900_ ## _name
- #define CR(_r) CR_G(_r)
- #define GR(_r) GR_G(_r)
- #define GR_A(_r, _regs) ((_regs)->psw.amode64 ? (_regs)->GR_G((_r)) : (_regs)->GR_L((_r)))
-+#define GR_Ax(_r, _regs, _val) ((_regs)->psw.amode64 ? ((_regs)->GR_G((_r)) = (_val)) : ((_regs)->GR_L((_r)) = (_val)))
- #define MONCODE MC_G
- #define TEA EA_G
- #define ET ET_G
-@@ -267,8 +286,13 @@ z900_ ## _name
- #define SSEVENT_BIT ASCE_X
- #define SSGROUP_BIT ASCE_G
-
-+#ifdef __i386__
- #define DEF_INST(_name) \
- __attribute__ ((regparm(3))) void z964_ ## _name (BYTE inst[], int execflag, REGS *regs)
-+#else
-+#define DEF_INST(_name) \
-+void z964_ ## _name (BYTE inst[], int execflag, REGS *regs)
-+#endif
-
- #define ARCH_DEP(_name) \
- z964_ ## _name
-@@ -279,6 +303,7 @@ z964_ ## _name
- #define CR(_r) CR_G(_r)
- #define GR(_r) GR_G(_r)
- #define GR_A(_r, _regs) ((_regs)->psw.amode64 ? (_regs)->GR_G((_r)) : (_regs)->GR_L((_r)))
-+#define GR_Ax(_r, _regs, _val) ((_regs)->psw.amode64 ? ((_regs)->GR_G((_r)) = (_val)) : ((_regs)->GR_L((_r)) = (_val)))
- #define MONCODE MC_G
- #define TEA EA_G
- #define ET ET_G
diff --git a/emulators/hercules/patches/patch-ao b/emulators/hercules/patches/patch-ao
deleted file mode 100644
index 688e7cbf57f..00000000000
--- a/emulators/hercules/patches/patch-ao
+++ /dev/null
@@ -1,16 +0,0 @@
-$NetBSD: patch-ao,v 1.1 2001/05/11 11:17:40 dmcmahill Exp $
-
-regparm is only for i386
-
---- opcode.h.orig Sat Feb 10 08:46:27 2001
-+++ opcode.h Tue May 8 18:48:56 2001
-@@ -70,5 +70,9 @@
-
-
-+#ifdef __i386__
- typedef __attribute__ ((regparm(3))) void (*zz_func) (BYTE inst[], int execflag, REGS *regs);
-+#else
-+typedef void (*zz_func) (BYTE inst[], int execflag, REGS *regs);
-+#endif
-
- extern zz_func opcode_table[][GEN_MAXARCH];
diff --git a/emulators/hercules/patches/patch-ap b/emulators/hercules/patches/patch-ap
deleted file mode 100644
index 0454ccccdb3..00000000000
--- a/emulators/hercules/patches/patch-ap
+++ /dev/null
@@ -1,378 +0,0 @@
-$NetBSD: patch-ap,v 1.1 2010/01/17 08:00:47 dholland Exp $
-
-Patch out gcc language extensions that are no longer supported.
-
---- general.c.orig 2001-02-08 20:02:40.000000000 +0000
-+++ general.c
-@@ -96,7 +96,7 @@ U32 n;
- RX(inst, execflag, regs, r1, b2, effective_addr2);
-
- /* Load 2 bytes from operand address */
-- (S32)n = (S16)ARCH_DEP(vfetch2) ( effective_addr2, b2, regs );
-+ n = (S32)(S16)ARCH_DEP(vfetch2) ( effective_addr2, b2, regs );
-
- /* Add signed operands and set condition code */
- regs->psw.cc =
-@@ -124,7 +124,7 @@ U32 n;
-
- RI(inst, execflag, regs, r1, opcd, n2);
-
-- (S32)n = (S16)n2;
-+ n = (S32)(S16)n2;
-
- /* Add signed operands and set condition code */
- regs->psw.cc =
-@@ -682,7 +682,7 @@ S32 i, j;
- j = (r3 & 1) ? (S32)regs->GR_L(r3) : (S32)regs->GR_L(r3+1);
-
- /* Add the increment value to the R1 register */
-- (S32)regs->GR_L(r1) += i;
-+ regs->GR_L(r1) = (S32)regs->GR_L(r1) + i;
-
- /* Branch if result compares high */
- if ( (S32)regs->GR_L(r1) > j )
-@@ -710,7 +710,7 @@ S32 i, j;
- j = (r3 & 1) ? (S32)regs->GR_L(r3) : (S32)regs->GR_L(r3+1);
-
- /* Add the increment value to the R1 register */
-- (S32)regs->GR_L(r1) += i;
-+ regs->GR_L(r1) = (S32)regs->GR_L(r1) + i;
-
- /* Branch if result compares low or equal */
- if ( (S32)regs->GR_L(r1) <= j )
-@@ -809,7 +809,7 @@ int i,j;
- j = (r3 & 1) ? (S32)regs->GR_L(r3) : (S32)regs->GR_L(r3+1);
-
- /* Add the increment value to the R1 register */
-- (S32)regs->GR_L(r1) += i;
-+ regs->GR_L(r1) = (S32)regs->GR_L(r1) + i;
-
- /* Branch if result compares high */
- if ( (S32)regs->GR_L(r1) > j )
-@@ -839,7 +839,7 @@ int i,j;
- j = (r3 & 1) ? (S32)regs->GR_L(r3) : (S32)regs->GR_L(r3+1);
-
- /* Add the increment value to the R1 register */
-- (S32)regs->GR_L(r1) += i;
-+ regs->GR_L(r1) = (S32)regs->GR_L(r1) + i;
-
- /* Branch if result compares low or equal */
- if ( (S32)regs->GR_L(r1) <= j )
-@@ -924,7 +924,7 @@ U64 dreg;
- regs->GR_L(r1) = dreg;
-
- /* Update the operand address and length registers */
-- GR_A(r2, regs) = addr2;
-+ GR_Ax(r2, regs, addr2);
- regs->GR_L(r2+1) = len;
-
- /* Set condition code 0 or 3 */
-@@ -1127,7 +1127,7 @@ U32 n;
- the physical CPU on a spinlock */
- if(regs->psw.cc && sysblk.numcpu > 1 && sysblk.brdcstncpu == 0)
- usleep(1L);
--#endif MAX_CPU_ENGINES > 1
-+#endif /* MAX_CPU_ENGINES > 1 */
-
- #if defined(_FEATURE_SIE)
- if(regs->sie_state && (regs->siebk->ic[0] & SIE_IC0_CS1))
-@@ -1193,7 +1193,7 @@ U32 n1, n2;
- the physical CPU on a spinlock */
- if(regs->psw.cc && sysblk.numcpu > 1 && sysblk.brdcstncpu == 0)
- usleep(1L);
--#endif MAX_CPU_ENGINES > 1
-+#endif /* MAX_CPU_ENGINES > 1 */
-
- #if defined(_FEATURE_SIE)
- if(regs->sie_state && (regs->siebk->ic[0] & SIE_IC0_CDS1))
-@@ -1216,7 +1216,7 @@ U32 n;
- RX(inst, execflag, regs, r1, b2, effective_addr2);
-
- /* Load rightmost 2 bytes of comparand from operand address */
-- (S32)n = (S16)ARCH_DEP(vfetch2) ( effective_addr2, b2, regs );
-+ n = (S32)(S16)ARCH_DEP(vfetch2) ( effective_addr2, b2, regs );
-
- /* Compare signed operands and set condition code */
- regs->psw.cc =
-@@ -1552,10 +1552,10 @@ BYTE pad;
- } /* end for(i) */
-
- /* Update the registers */
-- GR_A(r1, regs) = addr1;
-- GR_A(r1+1, regs) = len1;
-- GR_A(r3, regs) = addr2;
-- GR_A(r3+1, regs) = len2;
-+ GR_Ax(r1, regs, addr1);
-+ GR_Ax(r1+1, regs, len1);
-+ GR_Ax(r3, regs, addr2);
-+ GR_Ax(r3+1, regs, len2);
-
- regs->psw.cc = cc;
-
-@@ -1634,8 +1634,8 @@ BYTE termchar;
- } /* end for(i) */
-
- /* Set R1 and R2 to point to current character of each operand */
-- GR_A(r1, regs) = addr1;
-- GR_A(r2, regs) = addr2;
-+ GR_Ax(r1, regs, addr1);
-+ GR_Ax(r2, regs, addr2);
-
- /* Set condition code */
- regs->psw.cc = cc;
-@@ -1776,8 +1776,8 @@ S32 remlen1, remlen2;
- if (cc < 2)
- {
- /* Update R1 and R2 to point to the equal substring */
-- GR_A(r1, regs) = eqaddr1;
-- GR_A(r2, regs) = eqaddr2;
-+ GR_Ax(r1, regs, eqaddr1);
-+ GR_Ax(r2, regs, eqaddr2);
-
- /* Set R1+1 and R2+1 to length remaining in each
- operand after the start of the substring */
-@@ -1787,8 +1787,8 @@ S32 remlen1, remlen2;
- else
- {
- /* Update R1 and R2 to point to next bytes to compare */
-- GR_A(r1, regs) = addr1;
-- GR_A(r2, regs) = addr2;
-+ GR_Ax(r1, regs, addr1);
-+ GR_Ax(r2, regs, addr2);
-
- /* Set R1+1 and R2+1 to remaining operand lengths */
- regs->GR_L(r1+1) = (GREG)len1;
-@@ -1914,9 +1914,9 @@ BYTE utf[4];
- len2 = nlen2;
-
- /* Update the registers */
-- GR_A(r1, regs) = addr1;
-+ GR_Ax(r1, regs, addr1);
- regs->GR_L(r1+1) = len1;
-- GR_A(r2, regs) = addr2;
-+ GR_Ax(r2, regs, addr2);
- regs->GR_L(r2+1) = len2;
-
- } /* end for(i) */
-@@ -2069,9 +2069,9 @@ BYTE utf[4];
- len2 -= n + 1;
-
- /* Update the registers */
-- GR_A(r1, regs) = addr1;
-+ GR_Ax(r1, regs, addr1);
- regs->GR_L(r1+1) = len1;
-- GR_A(r2, regs) = addr2;
-+ GR_Ax(r2, regs, addr2);
- regs->GR_L(r2+1) = len2;
-
- } /* end for(i) */
-@@ -2153,7 +2153,7 @@ BYTE sbyte;
- /* Result is negative if sign is X'B' or X'D' */
- if (d == 0x0B || d == 0x0D)
- {
-- (S64)dreg = -((S64)dreg);
-+ dreg = (U64) -((S64)dreg);
- }
-
- /* Store low-order 32 bits of result into R1 register */
-@@ -2678,7 +2678,7 @@ VADR effective_addr2;
- RX(inst, execflag, regs, r1, b2, effective_addr2);
-
- /* Load operand address into register */
-- GR_A(r1, regs) = effective_addr2;
-+ GR_Ax(r1, regs, effective_addr2);
- }
-
-
-@@ -2695,7 +2695,7 @@ VADR effective_addr2;
- RX(inst, execflag, regs, r1, b2, effective_addr2);
-
- /* Load operand address into register */
-- GR_A(r1, regs) = effective_addr2;
-+ GR_Ax(r1, regs, effective_addr2);
-
- /* Load corresponding value into access register */
- if ( PRIMARY_SPACE_MODE(&(regs->psw)) )
-@@ -2749,7 +2749,7 @@ int r1, r2;
- }
-
- /* Load complement of second operand and set condition code */
-- (S32)regs->GR_L(r1) = -((S32)regs->GR_L(r2));
-+ regs->GR_L(r1) = (U32) -((S32)regs->GR_L(r2));
-
- regs->psw.cc = (S32)regs->GR_L(r1) < 0 ? 1 :
- (S32)regs->GR_L(r1) > 0 ? 2 : 0;
-@@ -2768,7 +2768,7 @@ VADR effective_addr2;
- RX(inst, execflag, regs, r1, b2, effective_addr2);
-
- /* Load rightmost 2 bytes of register from operand address */
-- (S32)regs->GR_L(r1) = (S16)ARCH_DEP(vfetch2) ( effective_addr2, b2, regs );
-+ regs->GR_L(r1) = (S32)(S16)ARCH_DEP(vfetch2) ( effective_addr2, b2, regs );
- }
-
-
-@@ -2785,7 +2785,7 @@ U16 i2;
- RI(inst, execflag, regs, r1, opcd, i2);
-
- /* Load operand into register */
-- (S32)regs->GR_L(r1) = (S16)i2;
-+ regs->GR_L(r1) = (S32)(S16)i2;
-
- }
- #endif /*defined(FEATURE_IMMEDIATE_AND_RELATIVE)*/
-@@ -2835,7 +2835,7 @@ int r1, r2;
- RR(inst, execflag, regs, r1, r2);
-
- /* Load negative value of second operand and set cc */
-- (S32)regs->GR_L(r1) = (S32)regs->GR_L(r2) > 0 ?
-+ regs->GR_L(r1) = (S32)regs->GR_L(r2) > 0 ?
- -((S32)regs->GR_L(r2)) :
- (S32)regs->GR_L(r2);
-
-@@ -2863,7 +2863,7 @@ int r1, r2;
- }
-
- /* Load positive value of second operand and set cc */
-- (S32)regs->GR_L(r1) = (S32)regs->GR_L(r2) < 0 ?
-+ regs->GR_L(r1) = (S32)regs->GR_L(r2) < 0 ?
- -((S32)regs->GR_L(r2)) :
- (S32)regs->GR_L(r2);
-
-@@ -3020,8 +3020,8 @@ BYTE pad;
- || (n <= addr2
- && (addr1 > addr2 || addr1 <= n)))
- {
-- GR_A(r1, regs) = addr1;
-- GR_A(r2, regs) = addr2;
-+ GR_Ax(r1, regs, addr1);
-+ GR_Ax(r2, regs, addr2);
- regs->psw.cc = 3;
- logmsg ("MVCL destructive overlap\n");
- logmsg ("R%2.2d=%8.8X R%2.2d=%8.8X "
-@@ -3056,8 +3056,8 @@ BYTE pad;
- len1--;
-
- /* Update the registers */
-- GR_A(r1, regs) = addr1;
-- GR_A(r2, regs) = addr2;
-+ GR_Ax(r1, regs, addr1);
-+ GR_Ax(r2, regs, addr2);
- regs->GR_LA24(r1+1) = len1;
- regs->GR_LA24(r2+1) = len2;
-
-@@ -3142,10 +3142,10 @@ BYTE pad;
- len1--;
-
- /* Update the registers */
-- GR_A(r1, regs) = addr1;
-- GR_A(r1+1, regs) = len1;
-- GR_A(r3, regs) = addr2;
-- GR_A(r3+1, regs) = len2;
-+ GR_Ax(r1, regs, addr1);
-+ GR_Ax(r1+1, regs, len1);
-+ GR_Ax(r3, regs, addr2);
-+ GR_Ax(r3+1, regs, len2);
-
- } /* end for(i) */
-
-@@ -3282,8 +3282,8 @@ BYTE termchar;
- } /* end for(i) */
-
- /* Set R1 and R2 to point to next character of each operand */
-- GR_A(r1, regs) = addr1;
-- GR_A(r2, regs) = addr2;
-+ GR_Ax(r1, regs, addr1);
-+ GR_Ax(r2, regs, addr2);
-
- /* Set condition code 3 */
- regs->psw.cc = 3;
-@@ -3480,7 +3480,7 @@ U32 n;
- RX(inst, execflag, regs, r1, b2, effective_addr2);
-
- /* Load 2 bytes from operand address */
-- (S32)n = (S16)ARCH_DEP(vfetch2) ( effective_addr2, b2, regs );
-+ n = (S32)(S16)ARCH_DEP(vfetch2) ( effective_addr2, b2, regs );
-
- /* Multiply R1 register by n, ignore leftmost 32 bits of
- result, and place rightmost 32 bits in R1 register */
-@@ -3502,7 +3502,7 @@ U16 i2;
- RI(inst, execflag, regs, r1, opcd, i2);
-
- /* Multiply register by operand ignoring overflow */
-- (S32)regs->GR_L(r1) *= (S16)i2;
-+ regs->GR_L(r1) = (S32)regs->GR_L(r1) * (S16)i2;
-
- }
- #endif /*defined(FEATURE_IMMEDIATE_AND_RELATIVE)*/
-@@ -3518,7 +3518,7 @@ int r1, r2;
- RRE(inst, execflag, regs, r1, r2);
-
- /* Multiply signed registers ignoring overflow */
-- (S32)regs->GR_L(r1) *= (S32)regs->GR_L(r2);
-+ regs->GR_L(r1) = (S32)regs->GR_L(r1) * (S32)regs->GR_L(r2);
-
- }
-
-@@ -3539,7 +3539,7 @@ U32 n;
- n = ARCH_DEP(vfetch4) ( effective_addr2, b2, regs );
-
- /* Multiply signed operands ignoring overflow */
-- (S32)regs->GR_L(r1) *= (S32)n;
-+ regs->GR_L(r1) = (S32)regs->GR_L(r1) * (S32)n;
-
- }
-
-@@ -4595,7 +4595,7 @@ VADR effective_addr2,
- if(regs->psw.cc && sysblk.numcpu > 1
- && sysblk.brdcstncpu == 0)
- usleep(1L);
--#endif MAX_CPU_ENGINES > 1
-+#endif /* MAX_CPU_ENGINES > 1 */
-
- }
- }
-@@ -4644,7 +4644,7 @@ BYTE termchar;
- code 1 and load the address of the character into R1 */
- if (sbyte == termchar)
- {
-- GR_A(r1, regs) = addr2;
-+ GR_Ax(r1, regs, addr2);
- regs->psw.cc = 1;
- return;
- }
-@@ -4656,7 +4656,7 @@ BYTE termchar;
- } /* end for(i) */
-
- /* Set R2 to point to next character of operand */
-- GR_A(r2, regs) = addr2;
-+ GR_Ax(r2, regs, addr2);
-
- /* Return condition code 3 */
- regs->psw.cc = 3;
-@@ -4928,7 +4928,7 @@ U32 n;
- n = effective_addr2 & 0x3F;
-
- /* Shift the signed value of the R1 register */
-- (S32)regs->GR_L(r1) = n > 30 ?
-+ regs->GR_L(r1) = n > 30 ?
- ((S32)regs->GR_L(r1) < 0 ? -1 : 0) :
- (S32)regs->GR_L(r1) >> n;
-
-@@ -5293,7 +5293,7 @@ U32 n;
- RX(inst, execflag, regs, r1, b2, effective_addr2);
-
- /* Load 2 bytes from operand address */
-- (S32)n = (S16)ARCH_DEP(vfetch2) ( effective_addr2, b2, regs );
-+ n = (S32)(S16)ARCH_DEP(vfetch2) ( effective_addr2, b2, regs );
-
- /* Subtract signed operands and set condition code */
- regs->psw.cc =
-@@ -5723,7 +5723,7 @@ BYTE trtab[256];
- len1--;
-
- /* Update the registers */
-- GR_A(r1, regs) = addr1;
-+ GR_Ax(r1, regs, addr1);
- regs->GR_L(r1+1) = len1;
-
- } /* end for(i) */
diff --git a/emulators/hercules/patches/patch-aq b/emulators/hercules/patches/patch-aq
deleted file mode 100644
index e0b1e2867b3..00000000000
--- a/emulators/hercules/patches/patch-aq
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD: patch-aq,v 1.1 2010/01/17 08:00:47 dholland Exp $
-
-Patch out gcc language extensions that are no longer supported.
-
---- service.c~ 2001-02-08 20:07:03.000000000 +0000
-+++ service.c
-@@ -1300,7 +1300,7 @@ BYTE *xstmap;
- }
- }
- mcd_len -= obj_len;
-- (BYTE*)obj_hdr += obj_len;
-+ obj_hdr = (SCCB_OBJ_HDR *)((BYTE*)obj_hdr + obj_len);
- }
-
- #ifndef NO_CYGWIN_STACK_BUG
diff --git a/emulators/hercules/patches/patch-ar b/emulators/hercules/patches/patch-ar
deleted file mode 100644
index ed22a8ed910..00000000000
--- a/emulators/hercules/patches/patch-ar
+++ /dev/null
@@ -1,17 +0,0 @@
-$NetBSD: patch-ar,v 1.1 2010/01/17 08:00:47 dholland Exp $
-
-Patch out gcc language extensions that are no longer supported.
-
---- cmpsc.c~ 2001-02-10 11:31:39.000000000 +0000
-+++ cmpsc.c
-@@ -142,8 +142,8 @@
- /*----------------------------------------------------------------------------*/
- #define ADJUSTREGS(r, regs, len) \
- { \
-- GR_A ((r), (regs)) = (GR_A ((r), (regs)) + (len)) & ADDRESS_MAXWRAP((regs)); \
-- GR_A ((r) + 1, (regs)) -= (len); \
-+ GR_Ax ((r), (regs), (GR_A ((r), (regs)) + (len)) & ADDRESS_MAXWRAP((regs))); \
-+ GR_Ax ((r) + 1, (regs), GR_A ((r) + 1, (regs)) - (len)); \
- }
-
- /*----------------------------------------------------------------------------*/
diff --git a/emulators/hercules/patches/patch-as b/emulators/hercules/patches/patch-as
deleted file mode 100644
index f356e2044ae..00000000000
--- a/emulators/hercules/patches/patch-as
+++ /dev/null
@@ -1,224 +0,0 @@
-$NetBSD: patch-as,v 1.1 2010/01/17 08:00:47 dholland Exp $
-
-Patch out gcc language extensions that are no longer supported.
-
---- esame.c~ 2001-02-10 14:41:55.000000000 +0000
-+++ esame.c
-@@ -945,8 +945,8 @@ U32 i2;
-
- RIL(inst, execflag, regs, r1, opcd, i2);
-
-- GR_A(r1, regs) = ((!execflag ? (regs->psw.IA - 6) : regs->ET)
-- + 2*(S32)i2) & ADDRESS_MAXWRAP(regs);
-+ GR_Ax(r1, regs, ((!execflag ? (regs->psw.IA - 6) : regs->ET)
-+ + 2*(S32)i2) & ADDRESS_MAXWRAP(regs));
- }
-
-
-@@ -1440,7 +1440,7 @@ int i,j;
- j = (r3 & 1) ? (S64)regs->GR_G(r3) : (S64)regs->GR_G(r3+1);
-
- /* Add the increment value to the R1 register */
-- (S64)regs->GR_G(r1) += i;
-+ regs->GR_G(r1) = (S64)regs->GR_G(r1) + i;
-
- /* Branch if result compares high */
- if ( (S64)regs->GR_G(r1) > j )
-@@ -1468,7 +1468,7 @@ int i,j;
- j = (r3 & 1) ? (S64)regs->GR_G(r3) : (S64)regs->GR_G(r3+1);
-
- /* Add the increment value to the R1 register */
-- (S64)regs->GR_G(r1) += i;
-+ regs->GR_G(r1) = (S64)regs->GR_G(r1) + i;
-
- /* Branch if result compares low or equal */
- if ( (S64)regs->GR_G(r1) <= j )
-@@ -1497,7 +1497,7 @@ S64 i, j;
- j = (r3 & 1) ? (S64)regs->GR_G(r3) : (S64)regs->GR_G(r3+1);
-
- /* Add the increment value to the R1 register */
-- (S64)regs->GR_G(r1) += i;
-+ regs->GR_G(r1) = (S64)regs->GR_G(r1) + i;
-
- /* Branch if result compares high */
- if ( (S64)regs->GR_G(r1) > j )
-@@ -1525,7 +1525,7 @@ S64 i, j;
- j = (r3 & 1) ? (S64)regs->GR_G(r3) : (S64)regs->GR_G(r3+1);
-
- /* Add the increment value to the R1 register */
-- (S64)regs->GR_G(r1) += i;
-+ regs->GR_G(r1) = (S64)regs->GR_G(r1) + i;
-
- /* Branch if result compares low or equal */
- if ( (S64)regs->GR_G(r1) <= j )
-@@ -1586,7 +1586,7 @@ U64 n;
- the physical CPU on a spinlock */
- if(regs->psw.cc && sysblk.numcpu > 1 && sysblk.brdcstncpu == 0)
- usleep(1L);
--#endif MAX_CPU_ENGINES > 1
-+#endif /* MAX_CPU_ENGINES > 1 */
-
- #if defined(_FEATURE_ZSIE)
- if(regs->sie_state && (regs->siebk->ic[0] & SIE_IC0_CS1))
-@@ -1652,7 +1652,7 @@ U64 n1, n2;
- the physical CPU on a spinlock */
- if(regs->psw.cc && sysblk.numcpu > 1 && sysblk.brdcstncpu == 0)
- usleep(1L);
--#endif MAX_CPU_ENGINES > 1
-+#endif /* MAX_CPU_ENGINES > 1 */
-
- #if defined(_FEATURE_ZSIE)
- if(regs->sie_state && (regs->siebk->ic[0] & SIE_IC0_CDS1))
-@@ -2071,7 +2071,7 @@ int r1, r2;
- }
-
- /* Load positive value of second operand and set cc */
-- (S64)regs->GR_G(r1) = (S64)regs->GR_G(r2) < 0 ?
-+ regs->GR_G(r1) = (S64)regs->GR_G(r2) < 0 ?
- -((S64)regs->GR_G(r2)) :
- (S64)regs->GR_G(r2);
-
-@@ -2089,9 +2089,9 @@ int r1, r2;
- RRE(inst, execflag, regs, r1, r2);
-
- /* Load positive value of second operand and set cc */
-- (S64)regs->GR_G(r1) = (S32)regs->GR_L(r2) < 0 ?
-+ regs->GR_G(r1) = (S64)((S32)regs->GR_L(r2) < 0 ?
- -((S32)regs->GR_L(r2)) :
-- (S32)regs->GR_L(r2);
-+ (S32)regs->GR_L(r2));
-
- regs->psw.cc = (S64)regs->GR_G(r1) == 0 ? 0 : 2;
- }
-@@ -2107,7 +2107,7 @@ int r1, r2;
- RRE(inst, execflag, regs, r1, r2);
-
- /* Load negative value of second operand and set cc */
-- (S64)regs->GR_G(r1) = (S64)regs->GR_G(r2) > 0 ?
-+ regs->GR_G(r1) = (S64)regs->GR_G(r2) > 0 ?
- -((S64)regs->GR_G(r2)) :
- (S64)regs->GR_G(r2);
-
-@@ -2125,9 +2125,9 @@ int r1, r2;
- RRE(inst, execflag, regs, r1, r2);
-
- /* Load negative value of second operand and set cc */
-- (S64)regs->GR_G(r1) = (S32)regs->GR_L(r2) > 0 ?
-+ regs->GR_G(r1) = (S64) ((S32)regs->GR_L(r2) > 0 ?
- -((S32)regs->GR_L(r2)) :
-- (S32)regs->GR_L(r2);
-+ (S32)regs->GR_L(r2));
-
- regs->psw.cc = (S64)regs->GR_G(r1) == 0 ? 0 : 1;
- }
-@@ -2160,7 +2160,7 @@ int r1, r2;
- RRE(inst, execflag, regs, r1, r2);
-
- /* Copy second operand and set condition code */
-- (S64)regs->GR_G(r1) = (S32)regs->GR_L(r2);
-+ regs->GR_G(r1) = (S64)(S32)regs->GR_L(r2);
-
- regs->psw.cc = (S64)regs->GR_G(r1) < 0 ? 1 :
- (S64)regs->GR_G(r1) > 0 ? 2 : 0;
-@@ -2187,7 +2187,7 @@ int r1, r2;
- }
-
- /* Load complement of second operand and set condition code */
-- (S64)regs->GR_G(r1) = -((S64)regs->GR_G(r2));
-+ regs->GR_G(r1) = -((S64)regs->GR_G(r2));
-
- regs->psw.cc = (S64)regs->GR_G(r1) < 0 ? 1 :
- (S64)regs->GR_G(r1) > 0 ? 2 : 0;
-@@ -2204,7 +2204,7 @@ int r1, r2;
- RRE(inst, execflag, regs, r1, r2);
-
- /* Load complement of second operand and set condition code */
-- (S64)regs->GR_G(r1) = -((S32)regs->GR_L(r2));
-+ regs->GR_G(r1) = (S64) -((S32)regs->GR_L(r2));
-
- regs->psw.cc = (S64)regs->GR_G(r1) < 0 ? 1 :
- (S64)regs->GR_G(r1) > 0 ? 2 : 0;
-@@ -2526,9 +2526,9 @@ U64 n;
- regs->GR_G(r1) = regs->GR_G(r3);
-
- /* Shift the signed value of the R1 register */
-- (S64)regs->GR_G(r1) = n > 62 ?
-+ regs->GR_G(r1) = (S64) (n > 62 ?
- ((S64)regs->GR_G(r1) < 0 ? -1 : 0) :
-- (S64)regs->GR_G(r1) >> n;
-+ (S64)regs->GR_G(r1) >> n);
-
- /* Set the condition code */
- regs->psw.cc = (S64)regs->GR_G(r1) > 0 ? 2 :
-@@ -2552,7 +2552,7 @@ U32 n;
- n = ARCH_DEP(vfetch4) ( effective_addr2, b2, regs );
-
- /* Multiply signed operands ignoring overflow */
-- (S64)regs->GR_G(r1) *= (S32)n;
-+ regs->GR_G(r1) = (S64)regs->GR_G(r1) * (S32)n;
-
- }
-
-@@ -2573,7 +2573,7 @@ U64 n;
- n = ARCH_DEP(vfetch8) ( effective_addr2, b2, regs );
-
- /* Multiply signed operands ignoring overflow */
-- (S64)regs->GR_G(r1) *= (S64)n;
-+ regs->GR_G(r1) = (S64)regs->GR_G(r1) * (S64)n;
-
- }
-
-@@ -2588,7 +2588,7 @@ int r1, r2;
- RRE(inst, execflag, regs, r1, r2);
-
- /* Multiply signed registers ignoring overflow */
-- (S64)regs->GR_G(r1) *= (S32)regs->GR_L(r2);
-+ regs->GR_G(r1) = (S64)regs->GR_G(r1) * (S32)regs->GR_L(r2);
-
- }
-
-@@ -2603,7 +2603,7 @@ int r1, r2;
- RRE(inst, execflag, regs, r1, r2);
-
- /* Multiply signed registers ignoring overflow */
-- (S64)regs->GR_G(r1) *= (S64)regs->GR_G(r2);
-+ regs->GR_G(r1) = (S64)regs->GR_G(r1) * (S64)regs->GR_G(r2);
-
- }
-
-@@ -2620,7 +2620,7 @@ U16 i2;
- RI(inst, execflag, regs, r1, opcd, i2);
-
- /* Load operand into register */
-- (S64)regs->GR_G(r1) = (S16)i2;
-+ regs->GR_G(r1) = (S64)(S16)i2;
-
- }
-
-@@ -2662,7 +2662,7 @@ U16 i2;
- RI(inst, execflag, regs, r1, opcd, i2);
-
- /* Multiply register by operand ignoring overflow */
-- (S64)regs->GR_G(r1) *= (S16)i2;
-+ regs->GR_G(r1) = (S64)regs->GR_G(r1) * (S16)i2;
-
- }
-
-@@ -2826,7 +2826,7 @@ int r1, r2;
- RRE(inst, execflag, regs, r1, r2);
-
- /* Copy second operand to first operand */
-- (S64)regs->GR_G(r1) = (S32)regs->GR_L(r2);
-+ regs->GR_G(r1) = (S64)(S32)regs->GR_L(r2);
- }
-
-
-@@ -3349,7 +3349,7 @@ VADR effective_addr2;
- RXE(inst, execflag, regs, r1, b2, effective_addr2);
-
- /* Load R1 register from second operand */
-- (S64)regs->GR_G(r1) = (S32)ARCH_DEP(vfetch4) ( effective_addr2, b2, regs );
-+ regs->GR_G(r1) = (S64) (S32)ARCH_DEP(vfetch4) ( effective_addr2, b2, regs );
- }
-
-
diff --git a/emulators/hercules/patches/patch-at b/emulators/hercules/patches/patch-at
deleted file mode 100644
index 398900f10b6..00000000000
--- a/emulators/hercules/patches/patch-at
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD: patch-at,v 1.1 2010/01/17 08:00:47 dholland Exp $
-
-Patch out mismatched decls gcc no longer accepts.
-
---- tapemap.c~ 2001-01-28 18:05:41.000000000 +0000
-+++ tapemap.c
-@@ -35,7 +35,7 @@ static BYTE buf[65500];
- /*-------------------------------------------------------------------*/
- /* ASCII to EBCDIC translate tables */
- /*-------------------------------------------------------------------*/
--static unsigned char
-+unsigned char
- ebcdic_to_ascii[] = {
- "\x00\x01\x02\x03\xA6\x09\xA7\x7F\xA9\xB0\xB1\x0B\x0C\x0D\x0E\x0F"
- "\x10\x11\x12\x13\xB2\xB4\x08\xB7\x18\x19\x1A\xB8\xBA\x1D\xBB\x1F"
diff --git a/emulators/hercules/patches/patch-au b/emulators/hercules/patches/patch-au
deleted file mode 100644
index 3a227757178..00000000000
--- a/emulators/hercules/patches/patch-au
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD: patch-au,v 1.1 2010/01/17 08:00:47 dholland Exp $
-
-Patch out mismatched decls gcc no longer accepts.
-
---- tapecopy.c~ 2010-01-17 07:18:17.000000000 +0000
-+++ tapecopy.c
-@@ -64,7 +64,7 @@ static BYTE buf[65500];
- /*-------------------------------------------------------------------*/
- /* ASCII to EBCDIC translate tables */
- /*-------------------------------------------------------------------*/
--static unsigned char
-+unsigned char
- ebcdic_to_ascii[] = {
- "\x00\x01\x02\x03\xA6\x09\xA7\x7F\xA9\xB0\xB1\x0B\x0C\x0D\x0E\x0F"
- "\x10\x11\x12\x13\xB2\xB4\x08\xB7\x18\x19\x1A\xB8\xBA\x1D\xBB\x1F"
diff --git a/emulators/hercules/patches/patch-av b/emulators/hercules/patches/patch-av
deleted file mode 100644
index 21b6afc1165..00000000000
--- a/emulators/hercules/patches/patch-av
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD: patch-av,v 1.1 2010/01/17 08:00:47 dholland Exp $
-
-Patch out mismatched decls gcc no longer accepts.
-
---- tapelist.c~ 2001-02-11 03:20:05.000000000 +0000
-+++ tapelist.c
-@@ -39,7 +39,7 @@ static BYTE buf[65500];
- /*-------------------------------------------------------------------*/
- /* EBCDIC to ASCII translate table */
- /*-------------------------------------------------------------------*/
--static unsigned char
-+unsigned char
- ebcdic_to_ascii[] = {
- "\x00\x01\x02\x03\xA6\x09\xA7\x7F\xA9\xB0\xB1\x0B\x0C\x0D\x0E\x0F"
- "\x10\x11\x12\x13\xB2\xB4\x08\xB7\x18\x19\x1A\xB8\xBA\x1D\xBB\x1F"
diff --git a/emulators/hercules/patches/patch-aw b/emulators/hercules/patches/patch-aw
deleted file mode 100644
index b1fa64c8634..00000000000
--- a/emulators/hercules/patches/patch-aw
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD: patch-aw,v 1.1 2010/01/17 08:00:47 dholland Exp $
-
-Patch out mismatched decls gcc no longer accepts.
-
---- tapesplit.c~ 2001-01-28 18:05:41.000000000 +0000
-+++ tapesplit.c
-@@ -36,7 +36,7 @@ static BYTE buf[65500];
- /*-------------------------------------------------------------------*/
- /* ASCII to EBCDIC translate tables */
- /*-------------------------------------------------------------------*/
--static unsigned char
-+unsigned char
- ebcdic_to_ascii[] = {
- "\x00\x01\x02\x03\xA6\x09\xA7\x7F\xA9\xB0\xB1\x0B\x0C\x0D\x0E\x0F"
- "\x10\x11\x12\x13\xB2\xB4\x08\xB7\x18\x19\x1A\xB8\xBA\x1D\xBB\x1F"
diff --git a/emulators/hercules/patches/patch-configure b/emulators/hercules/patches/patch-configure
new file mode 100644
index 00000000000..31bdd4f9f8b
--- /dev/null
+++ b/emulators/hercules/patches/patch-configure
@@ -0,0 +1,15 @@
+$NetBSD: patch-configure,v 1.1 2011/05/01 23:28:59 ryoon Exp $
+
+* Fix incorrect use of ==
+
+--- configure.orig 2010-03-07 12:04:50.000000000 +0000
++++ configure
+@@ -33253,7 +33253,7 @@ fi
+
+
+
+-if test "$hc_cv_have_sys_mtio_h" == "yes"; then
++if test "$hc_cv_have_sys_mtio_h" = "yes"; then
+ { echo "$as_me:$LINENO: checking whether MTEWARN is declared" >&5
+ echo $ECHO_N "checking whether MTEWARN is declared... $ECHO_C" >&6; }
+ if test "${ac_cv_have_decl_MTEWARN+set}" = set; then
diff --git a/emulators/hercules/patches/patch-crypto_Makefile.in b/emulators/hercules/patches/patch-crypto_Makefile.in
new file mode 100644
index 00000000000..03520631eda
--- /dev/null
+++ b/emulators/hercules/patches/patch-crypto_Makefile.in
@@ -0,0 +1,15 @@
+$NetBSD: patch-crypto_Makefile.in,v 1.1 2011/05/01 23:28:59 ryoon Exp $
+
+* Fix build. Use devel/libltdl instead of internal libltdl.
+
+--- crypto/Makefile.in.orig 2010-03-07 12:04:48.000000000 +0000
++++ crypto/Makefile.in
+@@ -246,7 +246,7 @@ dyndev_SRC = dyncrypt.c sha1.c sha256.c
+ @OPTION_DYNAMIC_LOAD_FALSE@DYNSRC = $(dyndev_SRC)
+ @OPTION_DYNAMIC_LOAD_TRUE@DYNSRC =
+ @OPTION_DYNAMIC_LOAD_FALSE@LTDL =
+-@OPTION_DYNAMIC_LOAD_TRUE@LTDL = ../ltdl.c
++@OPTION_DYNAMIC_LOAD_TRUE@LTDL =
+ @OPTION_DYNAMIC_LOAD_FALSE@DYNMOD_LD_FLAGS =
+ @OPTION_DYNAMIC_LOAD_TRUE@DYNMOD_LD_FLAGS = -module \
+ @OPTION_DYNAMIC_LOAD_TRUE@ -no-undefined \
diff --git a/emulators/hercules/patches/patch-decNumber_Makefile.in b/emulators/hercules/patches/patch-decNumber_Makefile.in
new file mode 100644
index 00000000000..e58d3b15706
--- /dev/null
+++ b/emulators/hercules/patches/patch-decNumber_Makefile.in
@@ -0,0 +1,15 @@
+$NetBSD: patch-decNumber_Makefile.in,v 1.1 2011/05/01 23:28:59 ryoon Exp $
+
+* Fix build. Use devel/libltdl instead of internal libltdl.
+
+--- decNumber/Makefile.in.orig 2010-03-07 12:04:48.000000000 +0000
++++ decNumber/Makefile.in
+@@ -260,7 +260,7 @@ decNumber_SRC = decContext.c \
+ @BUILD_SHARED_FALSE@XSTATIC = -static
+ @BUILD_SHARED_TRUE@XSTATIC =
+ @OPTION_DYNAMIC_LOAD_FALSE@LTDL =
+-@OPTION_DYNAMIC_LOAD_TRUE@LTDL = ../ltdl.c
++@OPTION_DYNAMIC_LOAD_TRUE@LTDL =
+ @OPTION_DYNAMIC_LOAD_FALSE@LIB_LD_FLAGS = $(XSTATIC) \
+ @OPTION_DYNAMIC_LOAD_FALSE@ -no-undefined \
+ @OPTION_DYNAMIC_LOAD_FALSE@ -avoid-version
diff --git a/emulators/hercules/patches/patch-hercifc.h b/emulators/hercules/patches/patch-hercifc.h
new file mode 100644
index 00000000000..06e88dcc82e
--- /dev/null
+++ b/emulators/hercules/patches/patch-hercifc.h
@@ -0,0 +1,16 @@
+$NetBSD: patch-hercifc.h,v 1.1 2011/05/01 23:28:59 ryoon Exp $
+
+--- hercifc.h.orig 2009-02-09 07:55:14.000000000 +0000
++++ hercifc.h
+@@ -90,7 +90,11 @@
+ // --------------------------------------------------------------------
+
+ #define HERCIFC_CMD "hercifc" // Interface config command
++#if defined(__FreeBSD__) || defined(__NetBSD__)
++#define HERCTUN_DEV "/dev/tun" // Default TUN/TAP char dev
++#else
+ #define HERCTUN_DEV "/dev/net/tun" // Default TUN/TAP char dev
++#endif
+
+ typedef struct _CTLREQ
+ {
diff --git a/emulators/hercules/patches/patch-hostopts.h b/emulators/hercules/patches/patch-hostopts.h
new file mode 100644
index 00000000000..9d4c04918e0
--- /dev/null
+++ b/emulators/hercules/patches/patch-hostopts.h
@@ -0,0 +1,28 @@
+$NetBSD: patch-hostopts.h,v 1.1 2011/05/01 23:28:59 ryoon Exp $
+
+--- hostopts.h.orig 2010-01-08 22:56:27.000000000 +0000
++++ hostopts.h
+@@ -272,7 +272,7 @@
+ /*-------------------------------------------------------------------*/
+ /* Hard-coded FreeBSD-specific features and options... */
+ /*-------------------------------------------------------------------*/
+-#elif defined(__FreeBSD__) /* "FreeBSD" options */
++#elif defined(__FreeBSD__) || defined(__NetBSD__)/* "BSD" options */
+
+ #define DLL_IMPORT extern
+ #define DLL_EXPORT
+@@ -295,6 +295,14 @@
+ #undef OPTION_EXTCURS /* Normal cursor handling */
+
+
++/* These should become configure checks */
++# if defined(__NetBSD__)
++# define OPTION_SCSI_TAPE /* SCSI tape support */
++# endif
++# if !defined(SOL_TCP)
++# define SOL_TCP IPPROTO_TCP
++# endif
++
+ /*-------------------------------------------------------------------*/
+ /* GNU Linux options... */
+ /*-------------------------------------------------------------------*/
diff --git a/emulators/hercules/patches/patch-hstructs.h b/emulators/hercules/patches/patch-hstructs.h
new file mode 100644
index 00000000000..be7f728aa8a
--- /dev/null
+++ b/emulators/hercules/patches/patch-hstructs.h
@@ -0,0 +1,30 @@
+$NetBSD: patch-hstructs.h,v 1.1 2011/05/01 23:28:59 ryoon Exp $
+
+--- hstructs.h.orig 2010-02-12 23:58:38.000000000 +0000
++++ hstructs.h
+@@ -1025,9 +1025,13 @@ struct DEVBLK {
+ U32 msgid; /* Message Id of async. i/o */
+ #if defined(OPTION_SCSI_TAPE)
+ struct mtget mtget; /* SCSI tape status struct */
++#if (defined(BSD) && BSD >= 199306)
++#define sstat mtget.mt_erreg
++#else
+ #define sstat mtget.mt_gstat /* Generic SCSI tape device-
+ independent status field;
+ (struct mtget->mt_gstat) */
++#endif
+ TID stape_mountmon_tid; /* Tape-mount monitor thread */
+ u_int stape_close_rewinds:1; /* 1=Rewind at close */
+ u_int stape_blkid_32:1; /* 1=block-ids are 32 bits */
+@@ -1039,7 +1043,11 @@ struct DEVBLK {
+ COND stape_getstat_cond; /* COND for status wrkr thrd */
+ COND stape_exit_cond; /* thread wait for exit COND */
+ struct mtget stape_getstat_mtget;/* status wrkr thrd status */
++#if (defined(BSD) && BSD >= 199306)
++#define stape_getstat_sstat stape_getstat_mtget.mt_erreg
++#else
+ #define stape_getstat_sstat stape_getstat_mtget.mt_gstat /* (gstat) */
++#endif
+ struct timeval
+ stape_getstat_query_tod;/* TOD of actual drive query */
+ #endif
diff --git a/emulators/hercules/patches/patch-scsitape.c b/emulators/hercules/patches/patch-scsitape.c
new file mode 100644
index 00000000000..d8749527249
--- /dev/null
+++ b/emulators/hercules/patches/patch-scsitape.c
@@ -0,0 +1,24 @@
+$NetBSD: patch-scsitape.c,v 1.1 2011/05/01 23:28:59 ryoon Exp $
+
+--- scsitape.c.orig 2010-01-08 22:56:27.000000000 +0000
++++ scsitape.c
+@@ -1334,6 +1334,19 @@ int locateblk_scsitape ( DEVBLK* dev, U3
+ mtop.mt_count = CSWAP32( mtop.mt_count ); // (host <- guest)
+ mtop.mt_op = MTSEEK;
+
++#if defined(BSD) && BSD >= 199306
++ /* Find out where we are so we can do a relative seek */
++ {
++ struct mtget here;
++
++ rc = ioctl_tape( dev->fd, MTIOCGET, (char*)&here );
++ if (rc >= 0) {
++ mtop.mt_count -= here.mt_blkno;
++ mtop.mt_op = MTFSR;
++ }
++ }
++#endif /* BSD */
++
+ // Ask the actual hardware to do an actual physical locate...
+
+ if ((rc = ioctl_tape( dev->fd, MTIOCTOP, (char*)&mtop )) < 0)
diff --git a/emulators/hercules/patches/patch-tapecopy.c b/emulators/hercules/patches/patch-tapecopy.c
new file mode 100644
index 00000000000..126fc7d7a90
--- /dev/null
+++ b/emulators/hercules/patches/patch-tapecopy.c
@@ -0,0 +1,63 @@
+$NetBSD: patch-tapecopy.c,v 1.1 2011/05/01 23:28:59 ryoon Exp $
+
+--- tapecopy.c.orig 2010-01-08 22:56:27.000000000 +0000
++++ tapecopy.c
+@@ -242,15 +242,21 @@ static void print_usage (void)
+ static int obtain_status (char *devname, int devfd, struct mtget* mtget)
+ {
+ int rc; /* Return code */
++long gstat;
+
+ rc = ioctl_tape (devfd, MTIOCGET, (char*)mtget);
+ if (rc < 0)
+ {
++#if (defined(BSD) && BSD >= 199306)
++ gstat = (mtget->mt_dsreg << 16) | mtget->mt_erreg;
++#else
++ gtat = mtget->mt_gstat;
++#endif
+ if (1
+ && EIO == errno
+ && (0
+- || GMT_EOD( mtget->mt_gstat )
+- || GMT_EOT( mtget->mt_gstat )
++ || GMT_EOD( gstat )
++ || GMT_EOT( gstat )
+ )
+ )
+ return +1;
+@@ -260,8 +266,8 @@ int rc;
+ return -1;
+ }
+
+- if (GMT_EOD( mtget->mt_gstat ) ||
+- GMT_EOT( mtget->mt_gstat ))
++ if (GMT_EOD( gstat ) ||
++ GMT_EOT( gstat ))
+ return +1;
+
+ return 0;
+@@ -499,6 +505,7 @@ struct mtget mtget;
+ struct mtpos mtpos; /* Area for MTIOCPOS ioctl */
+ int is3590 = 0; /* 1 == 3590, 0 == 3480/3490 */
+ #endif /*defined(EXTERNALGUI)*/
++long gstat;
+
+ INITIALIZE_UTILITY("tapecopy");
+
+@@ -636,8 +643,13 @@ int is3590 = 0;
+ printf (_("HHCTC004I %s tape density code: 0x%lX\n"),
+ (devnamein ? devnamein : devnameout), density);
+
+- if (mtget.mt_gstat != 0)
+- print_status ((devnamein ? devnamein : devnameout), mtget.mt_gstat);
++#if (defined(BSD) && BSD >= 199306)
++ gstat = (mtget.mt_dsreg << 16) | mtget.mt_erreg;
++#else
++ gstat = mtget.mt_gstat;
++#endif
++ if (gstat != 0)
++ print_status ((devnamein ? devnamein : devnameout), gstat);
+
+ /* Open the disk file */
+ if (filenamein)
diff --git a/emulators/hercules/patches/patch-ac b/emulators/hercules/patches/patch-tapedev.h
index e45ea816b42..1e61e28287e 100644
--- a/emulators/hercules/patches/patch-ac
+++ b/emulators/hercules/patches/patch-tapedev.h
@@ -1,30 +1,15 @@
-$NetBSD: patch-ac,v 1.2 2004/06/13 14:03:28 agc Exp $
+$NetBSD: patch-tapedev.h,v 1.1 2011/05/01 23:28:59 ryoon Exp $
-Linux tape handling.
-
---- hercules.h 2004-06-13 14:44:50.000000000 +0100
-+++ hercules.h 2004-06-13 14:47:06.000000000 +0100
-@@ -34,6 +34,7 @@
- #include <byteswap.h>
- #endif
- #include <sys/types.h>
-+#include <sys/param.h>
- #include <sys/resource.h>
- #include <sys/stat.h>
- #include <sys/socket.h>
-@@ -110,6 +111,7 @@
- #define HAVE_STRUCT_TIMESPEC
- #endif
- #include <pthread.h>
-+#include <sched.h>
- #ifdef WIN32
- #undef DWORD
- #endif
-@@ -935,6 +937,56 @@
- #define CCKD_OPEN_RD 2
- #define CCKD_OPEN_RW 3
+--- tapedev.h.orig 2010-01-08 22:56:27.000000000 +0000
++++ tapedev.h
+@@ -535,4 +535,61 @@ extern int readhdr_omaheaders (DEVBLK *
+ /*-------------------------------------------------------------------*/
+ // (see SCSITAPE.H)
+#if defined(BSD) && BSD >= 199306
++/*-------------------------------------------------------------------*/
++/* Support for BSD tape */
++/*-------------------------------------------------------------------*/
+struct mt_tape_info {
+ BYTE t_type;
+ const char *t_name;
@@ -72,8 +57,10 @@ Linux tape handling.
+#define MT_ISUNKNOWN 0x01
+#define MT_ISQIC02 0x02
+
-+#endif
++#define MTIOCPOS MTNOP /* do nothing, status only */
++#define mtpos mtget /* generic status struct, including mt_blkno */
++#define MTSEEK MTFSR /* forward seek record; probably wrong */
+
- /*-------------------------------------------------------------------*/
- /* Global data areas in module config.c */
- /*-------------------------------------------------------------------*/
++#endif /* BSD */
++
+ #endif // __TAPEDEV_H__