From 88076c4b1bf21588f9779068dd7fd9804fb24a1b Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Tue, 31 Jan 2012 05:45:33 -0800 Subject: [PATCH 1/6] Added check for required build dependencies in the Visual Studio Projects to provide advise when needed. --- Visual Studio Projects/PDP11.vcproj | 4 ++++ Visual Studio Projects/VAX.vcproj | 8 ++++---- Visual Studio Projects/VAX780.vcproj | 8 ++++---- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Visual Studio Projects/PDP11.vcproj b/Visual Studio Projects/PDP11.vcproj index ec24e7e4..fc4f4b67 100644 --- a/Visual Studio Projects/PDP11.vcproj +++ b/Visual Studio Projects/PDP11.vcproj @@ -26,6 +26,8 @@ > Date: Wed, 1 Feb 2012 19:58:55 -0800 Subject: [PATCH 2/6] Fixed concurrent write issue (discovered by Sergey Oboguev) which may happen if SIM_ASYNC_IO is enabled --- sim_fio.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sim_fio.c b/sim_fio.c index c80c8020..720bde9e 100644 --- a/sim_fio.c +++ b/sim_fio.c @@ -57,7 +57,6 @@ #include "sim_defs.h" -static unsigned char sim_flip[FLIP_SIZE]; int32 sim_end = 1; /* 1 = little */ /* OS-independent, endian independent binary I/O package @@ -141,11 +140,13 @@ size_t sim_fwrite (void *bptr, size_t size, size_t count, FILE *fptr) size_t c, nelem, nbuf, lcnt, total; int32 i; unsigned char *sptr; +unsigned char *sim_flip; if ((size == 0) || (count == 0)) /* check arguments */ return 0; if (sim_end || (size == sizeof (char))) /* le or byte? */ return fwrite (bptr, size, count, fptr); /* done */ +sim_flip = (unsigned char *)malloc(FLIP_SIZE); nelem = FLIP_SIZE / size; /* elements in buffer */ nbuf = count / nelem; /* number buffers */ lcnt = count % nelem; /* count in last buf */ @@ -158,10 +159,13 @@ for (i = (int32)nbuf; i > 0; i--) { /* loop on buffers */ sim_buf_copy_swapped (sim_flip, sptr, size, c); sptr = sptr + size * count; c = fwrite (sim_flip, size, c, fptr); - if (c == 0) + if (c == 0) { + free(sim_flip); return total; + } total = total + c; } +free(sim_flip); return total; } From c2d50b503e494ea0cd0539fb8cbf0f278fe27193 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Wed, 1 Feb 2012 19:59:24 -0800 Subject: [PATCH 3/6] Fixed error path issues found by Sergey Oboguev --- sim_disk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sim_disk.c b/sim_disk.c index 2f852262..7d95b794 100644 --- a/sim_disk.c +++ b/sim_disk.c @@ -2660,7 +2660,7 @@ VHD_DynamicDiskHeader Dynamic; uint32 *BAT = NULL; time_t now; uint32 i; -FILE *File; +FILE *File = NULL; uint32 Status = 0; uint32 BytesPerSector = 512; uint64 SizeInBytes = ((uint64)SizeInSectors)*BytesPerSector; @@ -2833,7 +2833,7 @@ CreateDifferencingVirtualDisk(const char *szVHDPath, const char *szParentVHDPath) { uint32 BytesPerSector = 512; -VHDHANDLE hVHD; +VHDHANDLE hVHD = NULL; VHD_Footer ParentFooter; VHD_DynamicDiskHeader ParentDynamic; uint32 ParentTimeStamp; From 9b5750f6a877464d910ae7b42479aeb682c67dd6 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Wed, 1 Feb 2012 20:01:46 -0800 Subject: [PATCH 4/6] Fixed error path issue when RAW disk operations are active (found by Sergey Oboguev) --- PDP11/pdp11_rq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PDP11/pdp11_rq.c b/PDP11/pdp11_rq.c index 8bd6044e..e0c54727 100644 --- a/PDP11/pdp11_rq.c +++ b/PDP11/pdp11_rq.c @@ -1924,7 +1924,7 @@ if (err != 0) { /* error? */ if (rq_dte (cp, uptr, ST_DRV)) /* post err log */ rq_rw_end (cp, uptr, EF_LOG, ST_DRV); /* if ok, report err */ perror ("RQ I/O error"); - if (!(uptr->flags | UNIT_RAW)) + if (!(uptr->flags & UNIT_RAW)) clearerr (uptr->fileref); return SCPE_IOERR; } From 5efd8fe1b5a2d592c15fb3f606f11e8ca13b9364 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Thu, 2 Feb 2012 07:30:40 -0800 Subject: [PATCH 5/6] Fixed bug in save command. The issue is that attached units which are buffered in memory should also be flushed to storage as part of the save operation to make all the components of the save 'snapshot' consistent. --- scp.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scp.c b/scp.c index 86a8680e..3e5dd88b 100644 --- a/scp.c +++ b/scp.c @@ -2725,8 +2725,18 @@ for (i = 0; (dptr = sim_devices[i]) != NULL; i++) { /* loop thru devices */ WRITE_I (uptr->u6); WRITE_I (uptr->flags); /* [V2.10] flags */ WRITE_I (uptr->capac); /* [V3.5] capacity */ - if (uptr->flags & UNIT_ATT) + if (uptr->flags & UNIT_ATT) { fputs (uptr->filename, sfile); + if ((uptr->flags & UNIT_BUF) && /* writable buffered */ + uptr->hwmark && /* files need to be */ + ((uptr->flags & UNIT_RO) == 0)) { /* written on save */ + uint32 cap = (uptr->hwmark + dptr->aincr - 1) / dptr->aincr; + rewind (uptr->fileref); + sim_fwrite (uptr->filebuf, SZ_D (dptr), cap, uptr->fileref); + fclose (uptr->fileref); /* flush data and state */ + uptr->fileref = sim_fopen (uptr->filename, "rb+");/* reopen r/w */ + } + } fputc ('\n', sfile); if (((uptr->flags & (UNIT_FIX + UNIT_ATTABLE)) == UNIT_FIX) && (dptr->examine != NULL) && From d8b900ea8d81fe753dd231105244a9697f069521 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Thu, 2 Feb 2012 07:32:38 -0800 Subject: [PATCH 6/6] Make sure that saved VAX clock state is stored in a host platform independent way. --- VAX/vax780_stddev.c | 2 +- VAX/vax_stddev.c | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/VAX/vax780_stddev.c b/VAX/vax780_stddev.c index 3a3016fe..814a5f43 100644 --- a/VAX/vax780_stddev.c +++ b/VAX/vax780_stddev.c @@ -327,7 +327,7 @@ REG clk_reg[] = { DEVICE clk_dev = { "TODR", &clk_unit, clk_reg, NULL, - 1, 0, 8, 1, 0, 0, + 1, 0, 8, 4, 0, 32, NULL, NULL, &clk_reset, NULL, &clk_attach, &clk_detach, NULL, 0 diff --git a/VAX/vax_stddev.c b/VAX/vax_stddev.c index af05fb8b..204be3fe 100644 --- a/VAX/vax_stddev.c +++ b/VAX/vax_stddev.c @@ -101,8 +101,6 @@ int32 clk_tps = 100; /* ticks/second */ int32 todr_reg = 0; /* TODR register */ int32 todr_blow = 1; /* TODR battery low */ struct todr_battery_info { - char toy_gmtbase_a[16]; /* Platform independent Text format of toy_gmtbase */ - char toy_gmtbasemsec_a[16]; /* Platform independent Text format of toy_gmtbasemsec */ uint32 toy_gmtbase; /* GMT base of set value */ uint32 toy_gmtbasemsec; /* The milliseconds of the set value */ }; @@ -234,7 +232,7 @@ MTAB clk_mod[] = { DEVICE clk_dev = { "CLK", &clk_unit, clk_reg, clk_mod, - 1, 0, 8, 1, 0, 0, + 1, 0, 8, 4, 0, 32, NULL, NULL, &clk_reset, NULL, &clk_attach, &clk_detach, &clk_dib, 0 @@ -429,8 +427,6 @@ if (0 == todr_reg) /* clock running? */ #define TOY_MAX_SECS (0x40000000/25) clock_gettime(CLOCK_REALTIME, &now); /* get curr time */ -toy->toy_gmtbase = strtoul(toy->toy_gmtbase_a, NULL, 0); -toy->toy_gmtbasemsec = strtoul(toy->toy_gmtbasemsec_a, NULL, 0); base.tv_sec = toy->toy_gmtbase; base.tv_nsec = toy->toy_gmtbasemsec * 1000000; sim_timespec_diff (&val, &now, &base); @@ -457,8 +453,6 @@ val.tv_nsec = (((uint32)data) % 100) * 10000000; sim_timespec_diff (&base, &now, &val); /* base = now - data */ toy->toy_gmtbase = (uint32)base.tv_sec; toy->toy_gmtbasemsec = base.tv_nsec/1000000; -sprintf(toy->toy_gmtbase_a, "0x%08X", toy->toy_gmtbase); -sprintf(toy->toy_gmtbasemsec_a, "0x%08X", toy->toy_gmtbasemsec); todr_reg = data; if (data) todr_blow = 0;