Applied a whole slew of patches, getting RAM usage down by a further 10 MB.

This commit is contained in:
OBattler
2018-03-19 01:02:04 +01:00
parent b6c393cc91
commit b1efb99ed6
222 changed files with 9538 additions and 9980 deletions

View File

@@ -8,7 +8,7 @@
*
* Common code to handle all sorts of disk controllers.
*
* Version: @(#)hdc.c 1.0.10 2018/03/17
* Version: @(#)hdc.c 1.0.11 2018/03/18
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
@@ -32,7 +32,7 @@ int hdc_current;
static void *
null_init(device_t *info)
null_init(const device_t *info)
{
return(NULL);
}
@@ -44,7 +44,7 @@ null_close(void *priv)
}
static device_t null_device = {
static const device_t null_device = {
"Null HDC", 0, 0,
null_init, null_close, NULL,
NULL, NULL, NULL, NULL, NULL
@@ -52,7 +52,7 @@ static device_t null_device = {
static void *
inthdc_init(device_t *info)
inthdc_init(const device_t *info)
{
return(NULL);
}
@@ -64,17 +64,17 @@ inthdc_close(void *priv)
}
static device_t inthdc_device = {
static const device_t inthdc_device = {
"Internal Controller", 0, 0,
inthdc_init, inthdc_close, NULL,
NULL, NULL, NULL, NULL, NULL
};
static struct {
static const struct {
char *name;
char *internal_name;
device_t *device;
const device_t *device;
int is_mfm;
} controllers[] = {
{ "None", "none",
@@ -185,7 +185,7 @@ hdc_get_internal_name(int hdc)
}
device_t *
const device_t *
hdc_get_device(int hdc)
{
return(controllers[hdc].device);

View File

@@ -8,7 +8,7 @@
*
* Definitions for the common disk controller handler.
*
* Version: @(#)hdc.h 1.0.5 2018/02/14
* Version: @(#)hdc.h 1.0.6 2018/03/18
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
@@ -32,25 +32,25 @@ extern char *hdc_name;
extern int hdc_current;
extern device_t mfm_xt_xebec_device; /* mfm_xt_xebec */
extern device_t mfm_xt_dtc5150x_device; /* mfm_xt_dtc */
extern device_t mfm_at_wd1003_device; /* mfm_at_wd1003 */
extern const device_t mfm_xt_xebec_device; /* mfm_xt_xebec */
extern const device_t mfm_xt_dtc5150x_device; /* mfm_xt_dtc */
extern const device_t mfm_at_wd1003_device; /* mfm_at_wd1003 */
extern device_t esdi_at_wd1007vse1_device; /* esdi_at */
extern device_t esdi_ps2_device; /* esdi_mca */
extern const device_t esdi_at_wd1007vse1_device; /* esdi_at */
extern const device_t esdi_ps2_device; /* esdi_mca */
extern device_t ide_isa_device; /* isa_ide */
extern device_t ide_isa_2ch_device; /* isa_ide_2ch */
extern device_t ide_isa_2ch_opt_device; /* isa_ide_2ch_opt */
extern device_t ide_vlb_device; /* vlb_ide */
extern device_t ide_vlb_2ch_device; /* vlb_ide_2ch */
extern device_t ide_pci_device; /* pci_ide */
extern device_t ide_pci_2ch_device; /* pci_ide_2ch */
extern const device_t ide_isa_device; /* isa_ide */
extern const device_t ide_isa_2ch_device; /* isa_ide_2ch */
extern const device_t ide_isa_2ch_opt_device; /* isa_ide_2ch_opt */
extern const device_t ide_vlb_device; /* vlb_ide */
extern const device_t ide_vlb_2ch_device; /* vlb_ide_2ch */
extern const device_t ide_pci_device; /* pci_ide */
extern const device_t ide_pci_2ch_device; /* pci_ide_2ch */
extern device_t xtide_device; /* xtide_xt */
extern device_t xtide_at_device; /* xtide_at */
extern device_t xtide_acculogic_device; /* xtide_ps2 */
extern device_t xtide_at_ps2_device; /* xtide_at_ps2 */
extern const device_t xtide_device; /* xtide_xt */
extern const device_t xtide_at_device; /* xtide_at */
extern const device_t xtide_acculogic_device; /* xtide_ps2 */
extern const device_t xtide_at_ps2_device; /* xtide_at_ps2 */
extern void hdc_init(char *name);
@@ -58,7 +58,7 @@ extern void hdc_reset(void);
extern char *hdc_get_name(int hdc);
extern char *hdc_get_internal_name(int hdc);
extern device_t *hdc_get_device(int hdc);
extern const device_t *hdc_get_device(int hdc);
extern int hdc_get_flags(int hdc);
extern int hdc_available(int hdc);
extern int hdc_current_is_mfm(void);

View File

@@ -8,15 +8,15 @@
*
* Driver for the ESDI controller (WD1007-vse1) for PC/AT.
*
* Version: @(#)hdc_esdi_at.c 1.0.8 2017/11/08
* Version: @(#)hdc_esdi_at.c 1.0.9 2018/03/18
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016,2017 Miran Grca.
* Copyright 2017 Fred N. van Kempen.
* Copyright 2008-2018 Sarah Walker.
* Copyright 2016-2018 Miran Grca.
* Copyright 2017,2018 Fred N. van Kempen.
*/
#define _LARGEFILE_SOURCE
#define _LARGEFILE64_SOURCE
@@ -770,7 +770,7 @@ loadhd(esdi_t *esdi, int hdd_num, int d, const wchar_t *fn)
static void *
wd1007vse1_init(device_t *info)
wd1007vse1_init(const device_t *info)
{
int c, d;
@@ -835,7 +835,7 @@ wd1007vse1_available(void)
}
device_t esdi_at_wd1007vse1_device = {
const device_t esdi_at_wd1007vse1_device = {
"Western Digital WD1007V-SE1 (ESDI)",
DEVICE_ISA | DEVICE_AT,
0,

View File

@@ -52,13 +52,13 @@
* however, are auto-configured by the system software as
* shown above.
*
* Version: @(#)hdc_esdi_mca.c 1.0.8 2017/11/04
* Version: @(#)hdc_esdi_mca.c 1.0.9 2018/03/18
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2008-2017 Sarah Walker.
* Copyright 2017 Fred N. van Kempen.
* Copyright 2008-2018 Sarah Walker.
* Copyright 2017,2018 Fred N. van Kempen.
*/
#include <stdio.h>
#include <stdint.h>
@@ -1041,7 +1041,7 @@ esdi_mca_write(int port, uint8_t val, void *priv)
static void *
esdi_init(device_t *info)
esdi_init(const device_t *info)
{
drive_t *drive;
esdi_t *dev;
@@ -1135,7 +1135,7 @@ esdi_available(void)
}
device_t esdi_ps2_device = {
const device_t esdi_ps2_device = {
"IBM ESDI Fixed Disk Adapter (MCA)",
DEVICE_MCA, 0,
esdi_init, esdi_close, NULL,

View File

@@ -9,7 +9,7 @@
* Implementation of the IDE emulation for hard disks and ATAPI
* CD-ROM devices.
*
* Version: @(#)hdc_ide.c 1.0.39 2018/03/17
* Version: @(#)hdc_ide.c 1.0.40 2018/03/18
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -2856,12 +2856,12 @@ void secondary_ide_check(void)
* Initialization of standalone IDE controller instance.
*
* Eventually, we should clean up the whole mess by only
* using device_t units, with configuration parameters to
* using const device_t units, with configuration parameters to
* indicate primary/secondary and all that, rather than
* keeping a zillion of duplicate functions around.
*/
static void *
ide_sainit(device_t *info)
ide_sainit(const device_t *info)
{
switch(info->local) {
case 0: /* ISA, single-channel */
@@ -2891,7 +2891,7 @@ ide_sainit(device_t *info)
break;
}
return(info);
return(ide_drives);
}
@@ -2903,7 +2903,7 @@ ide_saclose(void *priv)
}
device_t ide_isa_device = {
const device_t ide_isa_device = {
"ISA PC/AT IDE Controller",
DEVICE_ISA | DEVICE_AT,
0,
@@ -2912,7 +2912,7 @@ device_t ide_isa_device = {
NULL
};
device_t ide_isa_2ch_device = {
const device_t ide_isa_2ch_device = {
"ISA PC/AT IDE Controller (Dual-Channel)",
DEVICE_ISA | DEVICE_AT,
2,
@@ -2921,7 +2921,7 @@ device_t ide_isa_2ch_device = {
NULL
};
device_t ide_isa_2ch_opt_device = {
const device_t ide_isa_2ch_opt_device = {
"ISA PC/AT IDE Controller (Single/Dual)",
DEVICE_ISA | DEVICE_AT,
3,
@@ -2930,7 +2930,7 @@ device_t ide_isa_2ch_opt_device = {
NULL
};
device_t ide_vlb_device = {
const device_t ide_vlb_device = {
"VLB IDE Controller",
DEVICE_VLB | DEVICE_AT,
4,
@@ -2939,7 +2939,7 @@ device_t ide_vlb_device = {
NULL
};
device_t ide_vlb_2ch_device = {
const device_t ide_vlb_2ch_device = {
"VLB IDE Controller (Dual-Channel)",
DEVICE_VLB | DEVICE_AT,
6,
@@ -2948,7 +2948,7 @@ device_t ide_vlb_2ch_device = {
NULL
};
device_t ide_pci_device = {
const device_t ide_pci_device = {
"PCI IDE Controller",
DEVICE_PCI | DEVICE_AT,
8,
@@ -2957,7 +2957,7 @@ device_t ide_pci_device = {
NULL
};
device_t ide_pci_2ch_device = {
const device_t ide_pci_2ch_device = {
"PCI IDE Controller (Dual-Channel)",
DEVICE_PCI | DEVICE_AT,
10,

View File

@@ -12,13 +12,13 @@
* based design. Most cards were WD1003-WA2 or -WAH, where the
* -WA2 cards had a floppy controller as well (to save space.)
*
* Version: @(#)hdc_mfm_at.c 1.0.12 2017/12/09
* Version: @(#)hdc_mfm_at.c 1.0.13 2018/03/18
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2008-2017 Sarah Walker.
* Copyright 2017 Fred N. van Kempen.
* Copyright 2008-2018 Sarah Walker.
* Copyright 2017,2018 Fred N. van Kempen.
*/
#define __USE_LARGEFILE64
#define _LARGEFILE_SOURCE
@@ -707,7 +707,7 @@ loadhd(mfm_t *mfm, int c, int d, const wchar_t *fn)
static void *
mfm_init(device_t *info)
mfm_init(const device_t *info)
{
mfm_t *mfm;
int c, d;
@@ -764,7 +764,7 @@ mfm_close(void *priv)
}
device_t mfm_at_wd1003_device = {
const device_t mfm_at_wd1003_device = {
"WD1003 AT MFM/RLL Controller",
DEVICE_ISA | DEVICE_AT,
0,

View File

@@ -41,13 +41,13 @@
* Since all controllers (including the ones made by DTC) use
* (mostly) the same API, we keep them all in this module.
*
* Version: @(#)hdc_mfm_xt.c 1.0.13 2017/11/06
* Version: @(#)hdc_mfm_xt.c 1.0.14 2018/03/18
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2008-2017 Sarah Walker.
* Copyright 2017 Fred N. van Kempen.
* Copyright 2008-2018 Sarah Walker.
* Copyright 2017,2018 Fred N. van Kempen.
*/
#define __USE_LARGEFILE64
#define _LARGEFILE_SOURCE
@@ -808,7 +808,7 @@ mfm_set_switches(mfm_t *mfm)
static void *
xebec_init(device_t *info)
xebec_init(const device_t *info)
{
int i, c = 0;
@@ -863,7 +863,7 @@ xebec_available(void)
}
device_t mfm_xt_xebec_device = {
const device_t mfm_xt_xebec_device = {
"IBM PC Fixed Disk Adapter",
DEVICE_ISA,
0,
@@ -874,7 +874,7 @@ device_t mfm_xt_xebec_device = {
static void *
dtc5150x_init(device_t *info)
dtc5150x_init(const device_t *info)
{
int i, c = 0;
@@ -918,7 +918,7 @@ dtc5150x_available(void)
}
device_t mfm_xt_dtc5150x_device = {
const device_t mfm_xt_dtc5150x_device = {
"DTC 5150X",
DEVICE_ISA,
0,

View File

@@ -21,7 +21,7 @@
* already on their way out, the newer IDE standard based on the
* PC/AT controller and 16b design became the IDE we now know.
*
* Version: @(#)hdc_xtide.c 1.0.11 2018/02/14
* Version: @(#)hdc_xtide.c 1.0.11 2018/03/18
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -127,7 +127,7 @@ xtide_read(uint16_t port, void *priv)
static void *
xtide_init(device_t *info)
xtide_init(const device_t *info)
{
xtide_t *xtide = malloc(sizeof(xtide_t));
@@ -154,7 +154,7 @@ xtide_available(void)
static void *
xtide_at_init(device_t *info)
xtide_at_init(const device_t *info)
{
xtide_t *xtide = malloc(sizeof(xtide_t));
@@ -177,7 +177,7 @@ xtide_at_available(void)
static void *
xtide_acculogic_init(device_t *info)
xtide_acculogic_init(const device_t *info)
{
xtide_t *xtide = malloc(sizeof(xtide_t));
@@ -204,7 +204,7 @@ xtide_acculogic_available(void)
static void *
xtide_at_ps2_init(device_t *info)
xtide_at_ps2_init(const device_t *info)
{
xtide_t *xtide = malloc(sizeof(xtide_t));
@@ -235,7 +235,7 @@ xtide_close(void *priv)
}
device_t xtide_device = {
const device_t xtide_device = {
"XTIDE",
DEVICE_ISA,
0,
@@ -244,7 +244,7 @@ device_t xtide_device = {
NULL
};
device_t xtide_at_device = {
const device_t xtide_at_device = {
"XTIDE (AT)",
DEVICE_ISA | DEVICE_AT,
0,
@@ -253,7 +253,7 @@ device_t xtide_at_device = {
NULL
};
device_t xtide_acculogic_device = {
const device_t xtide_acculogic_device = {
"XTIDE (Acculogic)",
DEVICE_ISA,
0,
@@ -262,7 +262,7 @@ device_t xtide_acculogic_device = {
NULL
};
device_t xtide_at_ps2_device = {
const device_t xtide_at_ps2_device = {
"XTIDE (AT) (1.1.5)",
DEVICE_ISA | DEVICE_PS2,
0,

View File

@@ -9,7 +9,7 @@
* Implementation of the Iomega ZIP drive with SCSI(-like)
* commands, for both ATAPI and SCSI usage.
*
* Version: @(#)zip.c 1.0.12 2018/03/17
* Version: @(#)zip.c 1.0.13 2018/03/18
*
* Author: Miran Grca, <mgrca8@gmail.com>
*
@@ -70,7 +70,7 @@ uint8_t scsi_zip_drives[16][8] = { { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0
/* Table of all SCSI commands and their flags, needed for the new disc change / not ready handler. */
uint8_t zip_command_flags[0x100] =
const uint8_t zip_command_flags[0x100] =
{
IMPLEMENTED | CHECK_READY | NONDATA, /* 0x00 */
IMPLEMENTED | ALLOW_UA | NONDATA | SCSI_ONLY, /* 0x01 */