trying to sync rc1

parent 08d195f3
/*
* UAE - The Un*x Amiga Emulator
*
* Common code needed by all the various graphics systems.
*
* (c) 1996 Bernd Schmidt, Ed Hanway, Samuel Devulder
*/
/*
* UAE - The Un*x Amiga Emulator
*
* Common code needed by all the various graphics systems.
*
* (c) 1996 Bernd Schmidt, Ed Hanway, Samuel Devulder
*/
#include "sysconfig.h"
#include "sysdeps.h"
......@@ -13,6 +13,7 @@
#include "rtgmodes.h"
#include "xwin.h"
#include "gfxfilter.h"
#include "uae_endian.h"
int getvsyncrate (int hz)
......@@ -22,9 +23,9 @@ int getvsyncrate (int hz)
return hz;
}
#define RED 0
#define GRN 1
#define BLU 2
#define RED 0
#define GRN 1
#define BLU 2
/*
* dither matrix
......@@ -39,57 +40,57 @@ static uae_u8 dither[4][4] =
unsigned int doMask (int p, int bits, int shift)
{
/* scale to 0..255, shift to align msb with mask, and apply mask */
/* scale to 0..255, shift to align msb with mask, and apply mask */
unsigned long val;
if (flashscreen)
p ^= 0xff;
val = p << 24;
if (!bits)
return 0;
val >>= (32 - bits);
val <<= shift;
if (!bits)
return 0;
val >>= (32 - bits);
val <<= shift;
return val;
return val;
}
int bits_in_mask (unsigned long mask)
{
int n = 0;
while (mask) {
n += mask & 1;
mask >>= 1;
}
return n;
int n = 0;
while (mask) {
n += mask & 1;
mask >>= 1;
}
return n;
}
int mask_shift (unsigned long mask)
{
int n = 0;
while (!(mask & 1)) {
n++;
mask >>= 1;
}
return n;
int n = 0;
while (!(mask & 1)) {
n++;
mask >>= 1;
}
return n;
}
unsigned int doMask256 (int p, int bits, int shift)
{
/* p is a value from 0 to 255 (Amiga color value)
* shift to align msb with mask, and apply mask */
/* p is a value from 0 to 255 (Amiga color value)
* shift to align msb with mask, and apply mask */
unsigned long val = p * 0x01010101UL;
if (bits == 0)
return 0;
val >>= (32 - bits);
val <<= shift;
val >>= (32 - bits);
val <<= shift;
return val;
return val;
}
static unsigned int doColor (int i, int bits, int shift)
{
int shift2;
int shift2;
if (flashscreen)
i ^= 0xffffffff;
......@@ -97,12 +98,12 @@ static unsigned int doColor (int i, int bits, int shift)
shift2 = 0;
else
shift2 = 8 - bits;
return (i >> shift2) << shift;
return (i >> shift2) << shift;
}
static unsigned int doAlpha (int alpha, int bits, int shift)
{
return (alpha & ((1 << bits) - 1)) << shift;
return (alpha & ((1 << bits) - 1)) << shift;
}
static float video_gamma (float value, float gamma, float bri, float con)
......@@ -254,30 +255,30 @@ void alloc_colors64k (int rw, int gw, int bw, int rs, int gs, int bs, int aw, in
video_calc_gammatable();
j = 256;
for (i = 0; i < 4096; i++) {
for (i = 0; i < 4096; i++) {
int r = ((i >> 8) << 4) | (i >> 8);
int g = (((i >> 4) & 0xf) << 4) | ((i >> 4) & 0x0f);
int b = ((i & 0xf) << 4) | (i & 0x0f);
r = gamma[r + j];
g = gamma[g + j];
b = gamma[b + j];
xcolors[i] = doMask(r, rw, rs) | doMask(g, gw, gs) | doMask(b, bw, bs) | doAlpha (alpha, aw, as);
if (byte_swap) {
if (bpp <= 16)
xcolors[i] = bswap_16 (xcolors[i]);
else
xcolors[i] = bswap_32 (xcolors[i]);
}
if (bpp <= 16) {
/* Fill upper 16 bits of each colour value
* with a copy of the colour. */
xcolors[i] = doMask(r, rw, rs) | doMask(g, gw, gs) | doMask(b, bw, bs) | doAlpha (alpha, aw, as);
if (byte_swap) {
if (bpp <= 16)
xcolors[i] = bswap_16 (xcolors[i]);
else
xcolors[i] = bswap_32 (xcolors[i]);
}
if (bpp <= 16) {
/* Fill upper 16 bits of each colour value
* with a copy of the colour. */
xcolors[i] |= xcolors[i] * 0x00010001;
}
}
}
#if defined(AGA) || defined(GFXFILTER)
alloc_colors_rgb (rw, gw, bw, rs, gs, bs, aw, as, alpha, byte_swap, xredcolors, xgreencolors, xbluecolors);
/* copy original color table */
for (i = 0; i < 256; i++) {
for (i = 0; i < 256; i++) {
redc[0 * 256 + i] = xredcolors[0];
grec[0 * 256 + i] = xgreencolors[0];
bluc[0 * 256 + i] = xbluecolors[0];
......@@ -287,7 +288,7 @@ void alloc_colors64k (int rw, int gw, int bw, int rs, int gs, int bs, int aw, in
redc[2 * 256 + i] = xredcolors[255];
grec[2 * 256 + i] = xgreencolors[255];
bluc[2 * 256 + i] = xbluecolors[255];
}
}
#ifdef GFXFILTER
if (usedfilter && usedfilter->yuv) {
/* create internal 5:6:5 color tables */
......@@ -296,14 +297,14 @@ void alloc_colors64k (int rw, int gw, int bw, int rs, int gs, int bs, int aw, in
xredcolors[i] = doColor (gamma[j], 5, 11);
xgreencolors[i] = doColor (gamma[j], 6, 5);
xbluecolors[i] = doColor (gamma[j], 5, 0);
if (bpp <= 16) {
/* Fill upper 16 bits of each colour value with
* a copy of the colour. */
xredcolors [i] = xredcolors [i] * 0x00010001;
xgreencolors[i] = xgreencolors[i] * 0x00010001;
xbluecolors [i] = xbluecolors [i] * 0x00010001;
}
}
if (bpp <= 16) {
/* Fill upper 16 bits of each colour value with
* a copy of the colour. */
xredcolors [i] = xredcolors [i] * 0x00010001;
xgreencolors[i] = xgreencolors[i] * 0x00010001;
xbluecolors [i] = xbluecolors [i] * 0x00010001;
}
}
for (i = 0; i < 4096; i++) {
int r = ((i >> 8) << 4) | (i >> 8);
int g = (((i >> 4) & 0xf) << 4) | ((i >> 4) & 0x0f);
......@@ -348,9 +349,9 @@ void alloc_colors64k (int rw, int gw, int bw, int rs, int gs, int bs, int aw, in
xredcolor_s = rs;
xgreencolor_s = gs;
xbluecolor_s = bs;
xredcolor_m = (1 << rw) - 1;
xgreencolor_m = (1 << gw) - 1;
xbluecolor_m = (1 << bw) - 1;
xredcolor_m = ((1 << rw) - 1) << xredcolor_s;
xgreencolor_m = ((1 << gw) - 1) << xgreencolor_s;
xbluecolor_m = ((1 << bw) - 1) << xbluecolor_s;
}
static int color_diff[4096];
......
/*
* UAE - The Un*x Amiga Emulator
*
* Hardfile emulation
*
* Copyright 1995 Bernd Schmidt
* 2002 Toni Wilen (scsi emulation, 64-bit support)
*/
/*
* UAE - The Un*x Amiga Emulator
*
* Hardfile emulation
*
* Copyright 1995 Bernd Schmidt
* 2002 Toni Wilen (scsi emulation, 64-bit support)
*/
#include "sysconfig.h"
#include "sysdeps.h"
......@@ -69,14 +69,14 @@
#define ASYNC_REQUEST_CHANGEINT 10
struct hardfileprivdata {
volatile uaecptr d_request[MAX_ASYNC_REQUESTS];
volatile int d_request_type[MAX_ASYNC_REQUESTS];
volatile uae_u32 d_request_data[MAX_ASYNC_REQUESTS];
smp_comm_pipe requests;
int thread_running;
uae_sem_t sync_sem;
uaecptr base;
int changenum;
volatile uaecptr d_request[MAX_ASYNC_REQUESTS];
volatile int d_request_type[MAX_ASYNC_REQUESTS];
volatile uae_u32 d_request_data[MAX_ASYNC_REQUESTS];
smp_comm_pipe requests;
int thread_running;
uae_sem_t sync_sem;
uaecptr base;
int changenum;
uaecptr changeint;
uae_thread_id tid;
};
......@@ -86,7 +86,7 @@ struct hardfileprivdata {
STATIC_INLINE uae_u32 gl (uae_u8 *p)
{
return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3] << 0);
return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3] << 0);
}
static uae_sem_t change_sem;
......@@ -97,64 +97,64 @@ static uae_u32 nscmd_cmd;
static void wl (uae_u8 *p, int v)
{
p[0] = v >> 24;
p[1] = v >> 16;
p[2] = v >> 8;
p[3] = v;
p[0] = v >> 24;
p[1] = v >> 16;
p[2] = v >> 8;
p[3] = v;
}
static void ww (uae_u8 *p, int v)
{
p[0] = v >> 8;
p[1] = v;
p[0] = v >> 8;
p[1] = v;
}
static int rl (uae_u8 *p)
{
return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3]);
return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3]);
}
static void getchs2 (struct hardfiledata *hfd, int *cyl, int *cylsec, int *head, int *tracksec)
{
unsigned int total = (unsigned int)(hfd->virtsize / 1024);
int heads;
int sectors = 63;
int heads;
int sectors = 63;
/* do we have RDB values? */
if (hfd->cylinders) {
/* do we have RDB values? */
if (hfd->cylinders) {
*cyl = hfd->cylinders;
*tracksec = hfd->sectors;
*head = hfd->heads;
*cylsec = hfd->sectors * hfd->heads;
return;
}
/* what about HDF settings? */
if (hfd->surfaces && hfd->secspertrack) {
}
/* what about HDF settings? */
if (hfd->surfaces && hfd->secspertrack) {
*head = hfd->surfaces;
*tracksec = hfd->secspertrack;
*cylsec = (*head) * (*tracksec);
*cyl = (unsigned int)(hfd->virtsize / hfd->blocksize) / ((*tracksec) * (*head));
return;
}
/* no, lets guess something.. */
if (total <= 504 * 1024)
}
/* no, lets guess something.. */
if (total <= 504 * 1024)
heads = 16;
else if (total <= 1008 * 1024)
else if (total <= 1008 * 1024)
heads = 32;
else if (total <= 2016 * 1024)
else if (total <= 2016 * 1024)
heads = 64;
else if (total <= 4032 * 1024)
else if (total <= 4032 * 1024)
heads = 128;
else
else
heads = 255;
*cyl = (unsigned int)(hfd->virtsize / hfd->blocksize) / (sectors * heads);
*cylsec = sectors * heads;
*tracksec = sectors;
*head = heads;
*cylsec = sectors * heads;
*tracksec = sectors;
*head = heads;
}
static void getchs (struct hardfiledata *hfd, int *cyl, int *cylsec, int *head, int *tracksec)
{
getchs2 (hfd, cyl, cylsec, head, tracksec);
getchs2 (hfd, cyl, cylsec, head, tracksec);
hf_log ("CHS: %08X-%08X %d %d %d %d %d\n",
(uae_u32)(hfd->virtsize >> 32),(uae_u32)hfd->virtsize,
*cyl, *cylsec, *head, *tracksec);
......@@ -1556,37 +1556,37 @@ static uae_u32 REGPARAM2 hardfile_expunge (TrapContext *context)
static void outofbounds (int cmd, uae_u64 offset, uae_u64 len, uae_u64 max)
{
write_log ("UAEHF: cmd %d: out of bounds, %08X-%08X + %08X-%08X > %08X-%08X\n", cmd,
(uae_u32)(offset >> 32),(uae_u32)offset,(uae_u32)(len >> 32),(uae_u32)len,
(uae_u32)(max >> 32),(uae_u32)max);
(uae_u32)(offset >> 32),(uae_u32)offset,(uae_u32)(len >> 32),(uae_u32)len,
(uae_u32)(max >> 32),(uae_u32)max);
}
static void unaligned (int cmd, uae_u64 offset, uae_u64 len, int blocksize)
{
write_log ("UAEHF: cmd %d: unaligned access, %08X-%08X, %08X-%08X, %08X\n", cmd,
(uae_u32)(offset >> 32),(uae_u32)offset,(uae_u32)(len >> 32),(uae_u32)len,
blocksize);
(uae_u32)(offset >> 32),(uae_u32)offset,(uae_u32)(len >> 32),(uae_u32)len,
blocksize);
}
static uae_u32 hardfile_do_io (struct hardfiledata *hfd, struct hardfileprivdata *hfpd, uaecptr request)
{
uae_u32 dataptr, offset, actual = 0, cmd;
uae_u64 offset64;
int unit = get_long (request + 24);
uae_u32 error = 0, len;
int async = 0;
int bmask = hfd->blocksize - 1;
cmd = get_word (request + 28); /* io_Command */
dataptr = get_long (request + 40);
switch (cmd)
{
uae_u32 dataptr, offset, actual = 0, cmd;
uae_u64 offset64;
int unit = get_long (request + 24);
uae_u32 error = 0, len;
int async = 0;
int bmask = hfd->blocksize - 1;
cmd = get_word (request + 28); /* io_Command */
dataptr = get_long (request + 40);
switch (cmd)
{
case CMD_READ:
if (nodisk (hfd))
goto no_disk;
offset = get_long (request + 44);
len = get_long (request + 36); /* io_Length */
if ((offset & bmask) || dataptr == 0) {
unaligned (cmd, offset, len, hfd->blocksize);
goto bad_command;
unaligned (cmd, offset, len, hfd->blocksize);
goto bad_command;
}
if (len & bmask) {
unaligned (cmd, offset, len, hfd->blocksize);
......@@ -1606,8 +1606,8 @@ static uae_u32 hardfile_do_io (struct hardfiledata *hfd, struct hardfileprivdata
offset64 = get_long (request + 44) | ((uae_u64)get_long (request + 32) << 32);
len = get_long (request + 36); /* io_Length */
if ((offset64 & bmask) || dataptr == 0) {
unaligned (cmd, offset64, len, hfd->blocksize);
goto bad_command;
unaligned (cmd, offset64, len, hfd->blocksize);
goto bad_command;
}
if (len & bmask) {
unaligned (cmd, offset64, len, hfd->blocksize);
......@@ -1625,14 +1625,14 @@ static uae_u32 hardfile_do_io (struct hardfiledata *hfd, struct hardfileprivdata
if (nodisk (hfd))
goto no_disk;
if (hfd->readonly || hfd->dangerous) {
error = 28; /* write protect */
error = 28; /* write protect */
} else {
offset = get_long (request + 44);
len = get_long (request + 36); /* io_Length */
offset = get_long (request + 44);
len = get_long (request + 36); /* io_Length */
if ((offset & bmask) || dataptr == 0) {
unaligned (cmd, offset, len, hfd->blocksize);
goto bad_command;
}
}
if (len & bmask) {
unaligned (cmd, offset, len, hfd->blocksize);
goto bad_len;
......@@ -1640,8 +1640,8 @@ static uae_u32 hardfile_do_io (struct hardfiledata *hfd, struct hardfileprivdata
if (len + offset > hfd->virtsize) {
outofbounds (cmd, offset, len, hfd->virtsize);
goto bad_len;
}
actual = (uae_u32)cmd_write (hfd, dataptr, offset, len);
}
actual = (uae_u32)cmd_write (hfd, dataptr, offset, len);
}
break;
......@@ -1652,14 +1652,14 @@ static uae_u32 hardfile_do_io (struct hardfiledata *hfd, struct hardfileprivdata
if (nodisk (hfd))
goto no_disk;
if (hfd->readonly || hfd->dangerous) {
error = 28; /* write protect */
error = 28; /* write protect */
} else {
offset64 = get_long (request + 44) | ((uae_u64)get_long (request + 32) << 32);
len = get_long (request + 36); /* io_Length */
offset64 = get_long (request + 44) | ((uae_u64)get_long (request + 32) << 32);
len = get_long (request + 36); /* io_Length */
if ((offset64 & bmask) || dataptr == 0) {
unaligned (cmd, offset64, len, hfd->blocksize);
goto bad_command;
}
}
if (len & bmask) {
unaligned (cmd, offset64, len, hfd->blocksize);
goto bad_len;
......@@ -1667,8 +1667,8 @@ static uae_u32 hardfile_do_io (struct hardfiledata *hfd, struct hardfileprivdata
if (len + offset64 > hfd->virtsize) {
outofbounds (cmd, offset64, len, hfd->virtsize);
goto bad_len;
}
put_long (request + 32, (uae_u32)cmd_write (hfd, dataptr, offset64, len));
}
put_long (request + 32, (uae_u32)cmd_write (hfd, dataptr, offset64, len));
}
break;
......@@ -1679,53 +1679,53 @@ bad_len:
error = IOERR_BADLENGTH;
no_disk:
error = 29; /* no disk */
break;
break;
case NSCMD_DEVICEQUERY:
put_long (dataptr + 0, 0);
put_long (dataptr + 4, 16); /* size */
put_long (dataptr + 4, 16); /* size */
put_word (dataptr + 8, NSDEVTYPE_TRACKDISK);
put_word (dataptr + 10, 0);
put_long (dataptr + 12, nscmd_cmd);
actual = 16;
break;
put_word (dataptr + 10, 0);
put_long (dataptr + 12, nscmd_cmd);
actual = 16;
break;
case CMD_GETDRIVETYPE:
actual = DRIVE_NEWSTYLE;
break;
actual = DRIVE_NEWSTYLE;
break;
case CMD_GETNUMTRACKS:
{
int cyl, cylsec, head, tracksec;
getchs (hfd, &cyl, &cylsec, &head, &tracksec);
actual = cyl * head;
break;
getchs (hfd, &cyl, &cylsec, &head, &tracksec);
actual = cyl * head;
break;
}
case CMD_GETGEOMETRY:
{
int cyl, cylsec, head, tracksec;
int cyl, cylsec, head, tracksec;
uae_u64 size;
getchs (hfd, &cyl, &cylsec, &head, &tracksec);
put_long (dataptr + 0, hfd->blocksize);
getchs (hfd, &cyl, &cylsec, &head, &tracksec);
put_long (dataptr + 0, hfd->blocksize);
size = hfd->virtsize / hfd->blocksize;
if (size > 0x00ffffffff)
size = 0xffffffff;
put_long (dataptr + 4, (uae_u32)size);
put_long (dataptr + 8, cyl);
put_long (dataptr + 12, cylsec);
put_long (dataptr + 16, head);
put_long (dataptr + 20, tracksec);
put_long (dataptr + 24, 0); /* bufmemtype */
put_byte (dataptr + 28, 0); /* type = DG_DIRECT_ACCESS */
put_byte (dataptr + 29, 0); /* flags */
put_long (dataptr + 8, cyl);
put_long (dataptr + 12, cylsec);
put_long (dataptr + 16, head);
put_long (dataptr + 20, tracksec);
put_long (dataptr + 24, 0); /* bufmemtype */
put_byte (dataptr + 28, 0); /* type = DG_DIRECT_ACCESS */
put_byte (dataptr + 29, 0); /* flags */
}
break;
case CMD_PROTSTATUS:
if (hfd->readonly || hfd->dangerous)
actual = -1;
else
else
actual = 0;
break;
......@@ -1733,7 +1733,7 @@ no_disk:
actual = hfd->drive_empty ? 1 :0;
break;
/* Some commands that just do nothing and return zero */
/* Some commands that just do nothing and return zero */
case CMD_UPDATE:
case CMD_CLEAR:
case CMD_MOTOR:
......@@ -1753,41 +1753,41 @@ no_disk:
case CMD_ADDCHANGEINT:
error = add_async_request (hfpd, request, ASYNC_REQUEST_CHANGEINT, get_long (request + 40));
if (!error)
async = 1;
async = 1;
break;
case CMD_REMCHANGEINT:
release_async_request (hfpd, request);
break;
case HD_SCSICMD: /* SCSI */
if (hfd->nrcyls == 0) {
if (hfd->nrcyls == 0) {
error = handle_scsi (request, hfd);
} else { /* we don't want users trashing their "partition" hardfiles with hdtoolbox */
} else { /* we don't want users trashing their "partition" hardfiles with hdtoolbox */
error = IOERR_NOCMD;
write_log ("UAEHF: HD_SCSICMD tried on regular HDF, unit %d\n", unit);
}
}
break;
default:
/* Command not understood. */
/* Command not understood. */
error = IOERR_NOCMD;
break;
}
put_long (request + 32, actual);
put_byte (request + 31, error);
}
put_long (request + 32, actual);
put_byte (request + 31, error);
hf_log2 ("hf: unit=%d, request=%p, cmd=%d offset=%u len=%d, actual=%d error%=%d\n", unit, request,
get_word (request + 28), get_long (request + 44), get_long (request + 36), actual, error);
get_word (request + 28), get_long (request + 44), get_long (request + 36), actual, error);
return async;
return async;
}
static uae_u32 REGPARAM2 hardfile_abortio (TrapContext *context)
{
uae_u32 request = m68k_areg (regs, 1);
int unit = mangleunit (get_long (request + 24));
struct hardfiledata *hfd = get_hardfile_data (unit);
struct hardfileprivdata *hfpd = &hardfpd[unit];
int unit = mangleunit (get_long (request + 24));
struct hardfiledata *hfd = get_hardfile_data (unit);
struct hardfileprivdata *hfpd = &hardfpd[unit];
hf_log2 ("uaehf.device abortio ");
start_thread (context, unit);
......@@ -1795,17 +1795,17 @@ static uae_u32 REGPARAM2 hardfile_abortio (TrapContext *context)
put_byte (request + 31, 32);
hf_log2 ("error\n");
return get_byte (request + 31);
}
put_byte (request + 31, -2);
}
put_byte (request + 31, -2);
hf_log2 ("unit=%d, request=%08X\n", unit, request);
abort_async (hfpd, request, -2, 0);
return 0;
abort_async (hfpd, request, -2, 0);
return 0;
}
static int hardfile_can_quick (uae_u32 command)
{
switch (command)
{
switch (command)
{
case CMD_RESET:
case CMD_STOP:
case CMD_START:
......@@ -1817,44 +1817,44 @@ static int hardfile_can_quick (uae_u32 command)
case CMD_GETGEOMETRY:
case NSCMD_DEVICEQUERY:
return 1;
}
return 0;
}
return 0;
}
static int hardfile_canquick (struct hardfiledata *hfd, uaecptr request)
{
uae_u32 command = get_word (request + 28);
return hardfile_can_quick (command);
uae_u32 command = get_word (request + 28);
return hardfile_can_quick (command);
}
static uae_u32 REGPARAM2 hardfile_beginio (TrapContext *context)
{
uae_u32 request = m68k_areg (regs, 1);
uae_u8 flags = get_byte (request + 30);
int cmd = get_word (request + 28);
int unit = mangleunit (get_long (request + 24));
struct hardfiledata *hfd = get_hardfile_data (unit);
struct hardfileprivdata *hfpd = &hardfpd[unit];
uae_u8 flags = get_byte (request + 30);
int cmd = get_word (request + 28);
int unit = mangleunit (get_long (request + 24));
struct hardfiledata *hfd = get_hardfile_data (unit);
struct hardfileprivdata *hfpd = &hardfpd[unit];
put_byte (request + 8, NT_MESSAGE);
put_byte (request + 8, NT_MESSAGE);
start_thread (context, unit);
if (!hfd || !hfpd || !hfpd->thread_running) {
put_byte (request + 31, 32);
return get_byte (request + 31);
}
put_byte (request + 31, 0);
if ((flags & 1) && hardfile_canquick (hfd, request)) {
}
put_byte (request + 31, 0);
if ((flags & 1) && hardfile_canquick (hfd, request)) {
hf_log ("hf quickio unit=%d request=%p cmd=%d\n", unit, request, cmd);
if (hardfile_do_io (hfd, hfpd, request))
hf_log2 ("uaehf.device cmd %d bug with IO_QUICK\n", cmd);
return get_byte (request + 31);
} else {
} else {
hf_log2 ("hf asyncio unit=%d request=%p cmd=%d\n", unit, request, cmd);
add_async_request (hfpd, request, ASYNC_REQUEST_TEMP, 0);
put_byte (request + 30, get_byte (request + 30) & ~1);
write_comm_pipe_u32 (&hfpd->requests, request, 1);
return 0;
}
}
}
static void *hardfile_thread (void *devs)
......@@ -1862,147 +1862,147 @@ static void *hardfile_thread (void *devs)
struct hardfileprivdata *hfpd = (struct hardfileprivdata*)devs;
uae_set_thread_priority (2);
hfpd->thread_running = 1;
uae_sem_post (&hfpd->sync_sem);
for (;;) {
hfpd->thread_running = 1;
uae_sem_post (&hfpd->sync_sem);
for (;;) {
uaecptr request = (uaecptr)read_comm_pipe_u32_blocking (&hfpd->requests);
uae_sem_wait (&change_sem);
if (!request) {
hfpd->thread_running = 0;
uae_sem_post (&hfpd->sync_sem);
uae_sem_post (&change_sem);
return 0;
hfpd->thread_running = 0;
uae_sem_post (&hfpd->sync_sem);
uae_sem_post (&change_sem);
return 0;
} else if (hardfile_do_io (get_hardfile_data (hfpd - &hardfpd[0]), hfpd, request) == 0) {
put_byte (request + 30, get_byte (request + 30) & ~1);
release_async_request (hfpd, request);
uae_ReplyMsg (request);
put_byte (request + 30, get_byte (request + 30) & ~1);
release_async_request (hfpd, request);
uae_ReplyMsg (request);
} else {
hf_log2 ("async request %08X\n", request);
}
uae_sem_post (&change_sem);
}
}
}
void hardfile_reset (void)
{
int i, j;
struct hardfileprivdata *hfpd;
int i, j;
struct hardfileprivdata *hfpd;
for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
hfpd = &hardfpd[i];
if (hfpd->base && valid_address (hfpd->base, 36) && get_word (hfpd->base + 32) > 0) {
for (j = 0; j < MAX_ASYNC_REQUESTS; j++) {
for (j = 0; j < MAX_ASYNC_REQUESTS; j++) {
uaecptr request;
if ((request = hfpd->d_request[i]))
abort_async (hfpd, request, 0, 0);
}
abort_async (hfpd, request, 0, 0);
}
}
memset (hfpd, 0, sizeof (struct hardfileprivdata));
}
}
}
void hardfile_install (void)
{
uae_u32 functable, datatable;
uae_u32 initcode, openfunc, closefunc, expungefunc;
uae_u32 beginiofunc, abortiofunc;
uae_u32 functable, datatable;
uae_u32 initcode, openfunc, closefunc, expungefunc;
uae_u32 beginiofunc, abortiofunc;
uae_sem_init (&change_sem, 0, 1);
uae_sem_init (&change_sem, 0, 1);
ROM_hardfile_resname = ds ("uaehf.device");
ROM_hardfile_resid = ds ("UAE hardfile.device 0.2");
nscmd_cmd = here ();
dw (NSCMD_DEVICEQUERY);
dw (CMD_RESET);
dw (CMD_READ);
dw (CMD_WRITE);
dw (CMD_UPDATE);
dw (CMD_CLEAR);
dw (CMD_START);
dw (CMD_STOP);
dw (CMD_FLUSH);
dw (CMD_MOTOR);
dw (CMD_SEEK);
dw (CMD_FORMAT);
dw (CMD_REMOVE);
dw (CMD_CHANGENUM);
dw (CMD_CHANGESTATE);
dw (CMD_PROTSTATUS);
dw (CMD_GETDRIVETYPE);
dw (CMD_GETGEOMETRY);
dw (CMD_ADDCHANGEINT);
dw (CMD_REMCHANGEINT);
dw (HD_SCSICMD);
dw (NSCMD_TD_READ64);
dw (NSCMD_TD_WRITE64);
dw (NSCMD_TD_SEEK64);
dw (NSCMD_TD_FORMAT64);
dw (0);
/* initcode */
nscmd_cmd = here ();
dw (NSCMD_DEVICEQUERY);
dw (CMD_RESET);
dw (CMD_READ);
dw (CMD_WRITE);
dw (CMD_UPDATE);
dw (CMD_CLEAR);
dw (CMD_START);
dw (CMD_STOP);
dw (CMD_FLUSH);
dw (CMD_MOTOR);
dw (CMD_SEEK);
dw (CMD_FORMAT);
dw (CMD_REMOVE);
dw (CMD_CHANGENUM);
dw (CMD_CHANGESTATE);
dw (CMD_PROTSTATUS);
dw (CMD_GETDRIVETYPE);
dw (CMD_GETGEOMETRY);
dw (CMD_ADDCHANGEINT);
dw (CMD_REMCHANGEINT);
dw (HD_SCSICMD);
dw (NSCMD_TD_READ64);
dw (NSCMD_TD_WRITE64);
dw (NSCMD_TD_SEEK64);
dw (NSCMD_TD_FORMAT64);
dw (0);
/* initcode */
#if 0
initcode = here ();
calltrap (deftrap (hardfile_init)); dw (RTS);
initcode = here ();
calltrap (deftrap (hardfile_init)); dw (RTS);
#else
initcode = filesys_initcode;
initcode = filesys_initcode;
#endif
/* Open */
openfunc = here ();
calltrap (deftrap (hardfile_open)); dw (RTS);
/* Close */
closefunc = here ();
calltrap (deftrap (hardfile_close)); dw (RTS);
/* Expunge */
expungefunc = here ();
calltrap (deftrap (hardfile_expunge)); dw (RTS);
/* BeginIO */
beginiofunc = here ();
calltrap (deftrap (hardfile_beginio));
dw (RTS);
/* AbortIO */
abortiofunc = here ();
calltrap (deftrap (hardfile_abortio)); dw (RTS);
/* FuncTable */
functable = here ();
dl (openfunc); /* Open */
dl (closefunc); /* Close */
dl (expungefunc); /* Expunge */
dl (EXPANSION_nullfunc); /* Null */
dl (beginiofunc); /* BeginIO */
dl (abortiofunc); /* AbortIO */
dl (0xFFFFFFFFul); /* end of table */
/* DataTable */
datatable = here ();
dw (0xE000); /* INITBYTE */
dw (0x0008); /* LN_TYPE */
dw (0x0300); /* NT_DEVICE */
dw (0xC000); /* INITLONG */
dw (0x000A); /* LN_NAME */
dl (ROM_hardfile_resname);
dw (0xE000); /* INITBYTE */
dw (0x000E); /* LIB_FLAGS */
dw (0x0600); /* LIBF_SUMUSED | LIBF_CHANGED */
dw (0xD000); /* INITWORD */
dw (0x0014); /* LIB_VERSION */
dw (0x0004); /* 0.4 */
dw (0xD000);
dw (0x0016); /* LIB_REVISION */
dw (0x0000);
dw (0xC000);
dw (0x0018); /* LIB_IDSTRING */
dl (ROM_hardfile_resid);
dw (0x0000); /* end of table */
ROM_hardfile_init = here ();
dl (0x00000100); /* ??? */
dl (functable);
dl (datatable);
dl (initcode);
/* Open */
openfunc = here ();
calltrap (deftrap (hardfile_open)); dw (RTS);
/* Close */
closefunc = here ();
calltrap (deftrap (hardfile_close)); dw (RTS);
/* Expunge */
expungefunc = here ();
calltrap (deftrap (hardfile_expunge)); dw (RTS);
/* BeginIO */
beginiofunc = here ();
calltrap (deftrap (hardfile_beginio));
dw (RTS);
/* AbortIO */
abortiofunc = here ();
calltrap (deftrap (hardfile_abortio)); dw (RTS);
/* FuncTable */
functable = here ();
dl (openfunc); /* Open */
dl (closefunc); /* Close */
dl (expungefunc); /* Expunge */
dl (EXPANSION_nullfunc); /* Null */
dl (beginiofunc); /* BeginIO */
dl (abortiofunc); /* AbortIO */
dl (0xFFFFFFFFul); /* end of table */
/* DataTable */
datatable = here ();
dw (0xE000); /* INITBYTE */
dw (0x0008); /* LN_TYPE */
dw (0x0300); /* NT_DEVICE */
dw (0xC000); /* INITLONG */
dw (0x000A); /* LN_NAME */
dl (ROM_hardfile_resname);
dw (0xE000); /* INITBYTE */
dw (0x000E); /* LIB_FLAGS */
dw (0x0600); /* LIBF_SUMUSED | LIBF_CHANGED */
dw (0xD000); /* INITWORD */
dw (0x0014); /* LIB_VERSION */
dw (0x0004); /* 0.4 */
dw (0xD000);
dw (0x0016); /* LIB_REVISION */
dw (0x0000);
dw (0xC000);
dw (0x0018); /* LIB_IDSTRING */
dl (ROM_hardfile_resid);
dw (0x0000); /* end of table */
ROM_hardfile_init = here ();
dl (0x00000100); /* ??? */
dl (functable);
dl (datatable);
dl (initcode);
}
#ifdef A2065
extern void a2065_init (void);
extern void a2065_free (void);
extern void a2065_reset (void);
extern void a2065_hsync_handler (void);
extern void rethink_a2065 (void);
#endif
#ifdef A2065
extern void a2065_init (void);
extern void a2065_free (void);
extern void a2065_reset (void);
extern void a2065_hsync_handler (void);
extern void rethink_a2065 (void);
#endif
#ifdef A2091
extern addrbank dmaca2091_bank;
extern void a2091_init (void);
extern void a2091_free (void);
extern void a2091_reset (void);
extern void a3000scsi_init (void);
extern void a3000scsi_free (void);
extern void a3000scsi_reset (void);
extern void rethink_a2091 (void);
extern void wdscsi_put (uae_u8);
extern uae_u8 wdscsi_get (void);
extern uae_u8 wdscsi_getauxstatus (void);
extern void wdscsi_sasr (uae_u8);
extern void scsi_hsync (void);
extern uae_u8 wdregs[32];
extern struct scsi_data *scsis[8];
#define WD33C93 "WD33C93"
#define SCSIID (scsis[wdregs[WD_DESTINATION_ID] & 7])
extern int a2091_add_scsi_unit (int ch, TCHAR *path, int blocksize, int readonly,
TCHAR *devname, int sectors, int surfaces, int reserved,
int bootpri, TCHAR *filesys);
extern int a3000_add_scsi_unit (int ch, TCHAR *path, int blocksize, int readonly,
TCHAR *devname, int sectors, int surfaces, int reserved,
int bootpri, TCHAR *filesys);
extern int addscsi (int ch, TCHAR *path, int blocksize, int readonly,
TCHAR *devname, int sectors, int surfaces, int reserved,
int bootpri, TCHAR *filesys, int scsi_level);
#endif
#ifdef A2091
extern addrbank dmaca2091_bank;
extern void a2091_init (void);
extern void a2091_free (void);
extern void a2091_reset (void);
extern void a3000scsi_init (void);
extern void a3000scsi_free (void);
extern void a3000scsi_reset (void);
extern void rethink_a2091 (void);
extern void wdscsi_put (uae_u8);
extern uae_u8 wdscsi_get (void);
extern uae_u8 wdscsi_getauxstatus (void);
extern void wdscsi_sasr (uae_u8);
extern void scsi_hsync (void);
extern uae_u8 wdregs[32];
extern struct scsi_data *scsis[8];
#define WD33C93 "WD33C93"
#define SCSIID (scsis[wdregs[WD_DESTINATION_ID] & 7])
extern int a2091_add_scsi_unit (int ch, TCHAR *path, int blocksize, int readonly,
TCHAR *devname, int sectors, int surfaces, int reserved,
int bootpri, TCHAR *filesys);
extern int a3000_add_scsi_unit (int ch, TCHAR *path, int blocksize, int readonly,
TCHAR *devname, int sectors, int surfaces, int reserved,
int bootpri, TCHAR *filesys);
extern int addscsi (int ch, TCHAR *path, int blocksize, int readonly,
TCHAR *devname, int sectors, int surfaces, int reserved,
int bootpri, TCHAR *filesys, int scsi_level);
#endif
void amax_diskwrite (uae_u16 w);
void amax_bfe001_write (uae_u8 pra, uae_u8 dra);
uae_u8 amax_disk_status (void);
void amax_disk_select (uae_u8 v, uae_u8 ov);
void amax_reset (void);
void amax_init (void);
void amax_diskwrite (uae_u16 w);
void amax_bfe001_write (uae_u8 pra, uae_u8 dra);
uae_u8 amax_disk_status (void);
void amax_disk_select (uae_u8 v, uae_u8 ov);
void amax_reset (void);
void amax_init (void);
......@@ -39,18 +39,17 @@ extern void action_replay_hide (void);
extern void action_replay_reset (void);
extern int action_replay_load (void);
extern void action_replay_memory_reset(void);
extern void action_replay_memory_reset (void);
extern void action_replay_init (int);
extern void action_replay_cleanup (void);
extern void action_replay_chipwrite(void);
//static--extern void action_replay_map_banks(void);
//extern void action_replay_map_banks (void);
extern void REGPARAM3 chipmem_lput_actionreplay23 (uaecptr addr, uae_u32 l) REGPARAM;
extern void REGPARAM3 chipmem_wput_actionreplay23 (uaecptr addr, uae_u32 w) REGPARAM;
extern void REGPARAM3 chipmem_bput_actionreplay1 (uaecptr addr, uae_u32 b) REGPARAM;
extern void REGPARAM3 chipmem_wput_actionreplay1 (uaecptr addr, uae_u32 w) REGPARAM;
extern void REGPARAM3 chipmem_lput_actionreplay1 (uaecptr addr, uae_u32 l) REGPARAM;
extern void action_replay_version(void);
extern void action_replay_version (void);
extern int hrtmon_flag;
......@@ -60,7 +59,7 @@ extern void hrtmon_ciaread (void);
extern void hrtmon_hide (void);
extern void hrtmon_reset (void);
extern int hrtmon_load (void);
extern void hrtmon_map_banks(void);
extern void hrtmon_map_banks (void);
/*extern uae_u8 *hrtmemory;*/
extern uae_u32 hrtmem_start, hrtmem_size;
......
#ifdef ARCADIA
extern void arcadia_init (void);
extern int is_arcadia_rom (const TCHAR *path);
extern int arcadia_map_banks (void);
extern void arcadia_unmap (void);
extern void arcadia_vsync (void);
extern void arcadia_reset (void);
extern uae_u8 arcadia_parport (int port, uae_u8 pra, uae_u8 dra);
extern struct romdata *scan_arcadia_rom (TCHAR*, int);
struct arcadiarom {
int romid;
TCHAR *name, *rom;
int type, extra;
int b7, b6, b5, b4, b3, b2, b1, b0;
};
extern struct arcadiarom *arcadia_bios, *arcadia_game;
extern int arcadia_flag, arcadia_coin[2];
#define NO_ARCADIA_ROM 0
#define ARCADIA_BIOS 1
#define ARCADIA_GAME 2
#ifdef ARCADIA
extern void arcadia_init (void);
extern int is_arcadia_rom (const TCHAR *path);
extern int arcadia_map_banks (void);
extern void arcadia_unmap (void);
extern void arcadia_vsync (void);
extern void arcadia_reset (void);
extern uae_u8 arcadia_parport (int port, uae_u8 pra, uae_u8 dra);
extern struct romdata *scan_arcadia_rom (TCHAR*, int);
struct arcadiarom {
int romid;
TCHAR *name, *rom;
int type, extra;
int b7, b6, b5, b4, b3, b2, b1, b0;
};
extern struct arcadiarom *arcadia_bios, *arcadia_game;
extern int arcadia_flag, arcadia_coin[2];
#define NO_ARCADIA_ROM 0
#define ARCADIA_BIOS 1
#define ARCADIA_GAME 2
#endif
\ No newline at end of file
int consolehook_activate (void);
void consolehook_ret (uaecptr condev, uaecptr oldbeginio);
uaecptr consolehook_beginio (uaecptr request);
void consolehook_config (struct uae_prefs *p);
int consolehook_activate (void);
void consolehook_ret (uaecptr condev, uaecptr oldbeginio);
uaecptr consolehook_beginio (uaecptr request);
void consolehook_config (struct uae_prefs *p);
......@@ -216,16 +216,16 @@ STATIC_INLINE void put_long_ce020 (uaecptr addr, uae_u32 v)
{
mem_access_delay_long_write_ce020 (addr, v);
}
STATIC_INLINE void put_word_ce020 (uaecptr addr, uae_u32 v)
STATIC_INLINE void put_word_ce020 (uaecptr addr, uae_u32 v)
{
mem_access_delay_word_write_ce020 (addr, v);
}
STATIC_INLINE void put_byte_ce020 (uaecptr addr, uae_u32 v)
STATIC_INLINE void put_byte_ce020 (uaecptr addr, uae_u32 v)
{
mem_access_delay_byte_write_ce020 (addr, v);
}
extern void fill_icache020 (uae_u32);
extern void fill_icache020 (uae_u32);
STATIC_INLINE uae_u32 get_word_ce020_prefetch (int o)
{
......@@ -238,10 +238,10 @@ STATIC_INLINE uae_u32 get_word_ce020_prefetch (int o)
}
if (pc == regs.prefetch020addr + 2) {
uae_u32 v = regs.prefetch020data & 0xffff;
fill_icache020 (pc + 2);
fill_icache020 (pc + 2);
return v;
}
fill_icache020 (pc);
fill_icache020 (pc);
}
}
......@@ -265,106 +265,106 @@ STATIC_INLINE uae_u32 next_ilong_020ce (void)
m68k_incpc (4);
return r;
}
STATIC_INLINE void m68k_do_bsr_ce020 (uaecptr oldpc, uae_s32 offset)
{
m68k_areg (regs, 7) -= 4;
put_long_ce020 (m68k_areg (regs, 7), oldpc);
m68k_incpc (offset);
}
STATIC_INLINE void m68k_do_rts_ce020 (void)
{
m68k_setpc (get_long_ce020 (m68k_areg (regs, 7)));
m68k_areg (regs, 7) += 4;
}
STATIC_INLINE void m68k_do_bsr_ce020 (uaecptr oldpc, uae_s32 offset)
{
m68k_areg (regs, 7) -= 4;
put_long_ce020 (m68k_areg (regs, 7), oldpc);
m68k_incpc (offset);
}
STATIC_INLINE void m68k_do_rts_ce020 (void)
{
m68k_setpc (get_long_ce020 (m68k_areg (regs, 7)));
m68k_areg (regs, 7) += 4;
}
#endif
#ifdef CPUEMU_21
extern void fill_icache030 (uae_u32 addr);
extern void write_dcache030 (uaecptr, uae_u32, int);
extern uae_u32 read_dcache030 (uaecptr, int);
STATIC_INLINE void put_long_ce030 (uaecptr addr, uae_u32 v)
{
write_dcache030 (addr, v, 2);
mem_access_delay_long_write_ce020 (addr, v);
}
STATIC_INLINE void put_word_ce030 (uaecptr addr, uae_u32 v)
{
write_dcache030 (addr, v, 1);
mem_access_delay_word_write_ce020 (addr, v);
}
STATIC_INLINE void put_byte_ce030 (uaecptr addr, uae_u32 v)
{
write_dcache030 (addr, v, 0);
mem_access_delay_byte_write_ce020 (addr, v);
}
STATIC_INLINE uae_u32 get_long_ce030 (uaecptr addr)
{
return read_dcache030 (addr, 2);
}
STATIC_INLINE uae_u32 get_word_ce030 (uaecptr addr)
{
return read_dcache030 (addr, 1);
}
STATIC_INLINE uae_u32 get_byte_ce030 (uaecptr addr)
{
return read_dcache030 (addr, 0);
}
STATIC_INLINE uae_u32 get_word_ce030_prefetch (int o)
{
uae_u32 pc = m68k_getpc () + o;
for (;;) {
if (pc == regs.prefetch020addr) {
uae_u32 v = regs.prefetch020data >> 16;
return v;
}
if (pc == regs.prefetch020addr + 2) {
uae_u32 v = regs.prefetch020data & 0xffff;
fill_icache030 (pc + 2);
return v;
}
fill_icache030 (pc);
}
}
STATIC_INLINE uae_u32 get_long_ce030_prefetch (int o)
{
uae_u32 v;
v = get_word_ce030_prefetch (o) << 16;
v |= get_word_ce030_prefetch (o + 2);
return v;
}
STATIC_INLINE uae_u32 next_iword_030ce (void)
{
uae_u32 r = get_word_ce030_prefetch (0);
m68k_incpc (2);
return r;
}
STATIC_INLINE uae_u32 next_ilong_030ce (void)
{
uae_u32 r = get_long_ce030_prefetch (0);
m68k_incpc (4);
return r;
}
STATIC_INLINE void m68k_do_bsr_ce030 (uaecptr oldpc, uae_s32 offset)
{
m68k_areg (regs, 7) -= 4;
put_long_ce030 (m68k_areg (regs, 7), oldpc);
m68k_incpc (offset);
}
STATIC_INLINE void m68k_do_rts_ce030 (void)
{
m68k_setpc (get_long_ce030 (m68k_areg (regs, 7)));
m68k_areg (regs, 7) += 4;
}
#endif
#ifdef CPUEMU_21
extern void fill_icache030 (uae_u32 addr);
extern void write_dcache030 (uaecptr, uae_u32, int);
extern uae_u32 read_dcache030 (uaecptr, int);
STATIC_INLINE void put_long_ce030 (uaecptr addr, uae_u32 v)
{
write_dcache030 (addr, v, 2);
mem_access_delay_long_write_ce020 (addr, v);
}
STATIC_INLINE void put_word_ce030 (uaecptr addr, uae_u32 v)
{
write_dcache030 (addr, v, 1);
mem_access_delay_word_write_ce020 (addr, v);
}
STATIC_INLINE void put_byte_ce030 (uaecptr addr, uae_u32 v)
{
write_dcache030 (addr, v, 0);
mem_access_delay_byte_write_ce020 (addr, v);
}
STATIC_INLINE uae_u32 get_long_ce030 (uaecptr addr)
{
return read_dcache030 (addr, 2);
}
STATIC_INLINE uae_u32 get_word_ce030 (uaecptr addr)
{
return read_dcache030 (addr, 1);
}
STATIC_INLINE uae_u32 get_byte_ce030 (uaecptr addr)
{
return read_dcache030 (addr, 0);
}
STATIC_INLINE uae_u32 get_word_ce030_prefetch (int o)
{
uae_u32 pc = m68k_getpc () + o;
for (;;) {
if (pc == regs.prefetch020addr) {
uae_u32 v = regs.prefetch020data >> 16;
return v;
}
if (pc == regs.prefetch020addr + 2) {
uae_u32 v = regs.prefetch020data & 0xffff;
fill_icache030 (pc + 2);
return v;
}
fill_icache030 (pc);
}
}
STATIC_INLINE uae_u32 get_long_ce030_prefetch (int o)
{
uae_u32 v;
v = get_word_ce030_prefetch (o) << 16;
v |= get_word_ce030_prefetch (o + 2);
return v;
}
STATIC_INLINE uae_u32 next_iword_030ce (void)
{
uae_u32 r = get_word_ce030_prefetch (0);
m68k_incpc (2);
return r;
}
STATIC_INLINE uae_u32 next_ilong_030ce (void)
{
uae_u32 r = get_long_ce030_prefetch (0);
m68k_incpc (4);
return r;
}
STATIC_INLINE void m68k_do_bsr_ce030 (uaecptr oldpc, uae_s32 offset)
{
m68k_areg (regs, 7) -= 4;
put_long_ce030 (m68k_areg (regs, 7), oldpc);
m68k_incpc (offset);
}
STATIC_INLINE void m68k_do_rts_ce030 (void)
{
m68k_setpc (get_long_ce030 (m68k_areg (regs, 7)));
m68k_areg (regs, 7) += 4;
}
#endif
#ifdef CPUEMU_12
STATIC_INLINE void ipl_fetch (void)
......@@ -392,7 +392,7 @@ STATIC_INLINE uae_u32 mem_access_delay_wordi_read (uaecptr addr)
case CE_MEMBANK_CHIP:
return wait_cpu_cycle_read (addr, 1);
case CE_MEMBANK_FAST:
case CE_MEMBANK_FAST16BIT:
case CE_MEMBANK_FAST16BIT:
do_cycles_ce000 (4);
break;
}
......@@ -406,12 +406,12 @@ STATIC_INLINE uae_u32 mem_access_delay_byte_read (uaecptr addr)
case CE_MEMBANK_CHIP:
return wait_cpu_cycle_read (addr, 0);
case CE_MEMBANK_FAST:
case CE_MEMBANK_FAST16BIT:
case CE_MEMBANK_FAST16BIT:
do_cycles_ce000 (4);
break;
}
return get_byte (addr);
}
return get_byte (addr);
}
STATIC_INLINE void mem_access_delay_byte_write (uaecptr addr, uae_u32 v)
{
......@@ -421,11 +421,11 @@ STATIC_INLINE void mem_access_delay_byte_write (uaecptr addr, uae_u32 v)
wait_cpu_cycle_write (addr, 0, v);
return;
case CE_MEMBANK_FAST:
case CE_MEMBANK_FAST16BIT:
case CE_MEMBANK_FAST16BIT:
do_cycles_ce000 (4);
break;
}
put_byte (addr, v);
}
put_byte (addr, v);
}
STATIC_INLINE void mem_access_delay_word_write (uaecptr addr, uae_u32 v)
{
......@@ -436,22 +436,22 @@ STATIC_INLINE void mem_access_delay_word_write (uaecptr addr, uae_u32 v)
return;
break;
case CE_MEMBANK_FAST:
case CE_MEMBANK_FAST16BIT:
case CE_MEMBANK_FAST16BIT:
do_cycles_ce000 (4);
break;
}
put_word (addr, v);
}
put_word (addr, v);
}
STATIC_INLINE uae_u32 get_long_ce (uaecptr addr)
{
uae_u32 v = mem_access_delay_word_read (addr) << 16;
v |= mem_access_delay_word_read (addr + 2);
return v;
}
STATIC_INLINE uae_u32 get_long_ce (uaecptr addr)
{
uae_u32 v = mem_access_delay_word_read (addr) << 16;
v |= mem_access_delay_word_read (addr + 2);
return v;
}
STATIC_INLINE uae_u32 get_word_ce (uaecptr addr)
{
return mem_access_delay_word_read (addr);
return mem_access_delay_word_read (addr);
}
STATIC_INLINE uae_u32 get_wordi_ce (uaecptr addr)
{
......@@ -459,47 +459,47 @@ STATIC_INLINE uae_u32 get_wordi_ce (uaecptr addr)
}
STATIC_INLINE uae_u32 get_byte_ce (uaecptr addr)
{
return mem_access_delay_byte_read (addr);
return mem_access_delay_byte_read (addr);
}
STATIC_INLINE uae_u32 get_word_ce_prefetch (int o)
{
uae_u32 v = regs.irc;
regs.irc = get_wordi_ce (m68k_getpc () + o);
return v;
return v;
}
STATIC_INLINE void put_long_ce (uaecptr addr, uae_u32 v)
{
mem_access_delay_word_write (addr, v >> 16);
mem_access_delay_word_write (addr + 2, v);
}
STATIC_INLINE void put_word_ce (uaecptr addr, uae_u32 v)
STATIC_INLINE void put_long_ce (uaecptr addr, uae_u32 v)
{
mem_access_delay_word_write (addr, v);
mem_access_delay_word_write (addr, v >> 16);
mem_access_delay_word_write (addr + 2, v);
}
STATIC_INLINE void put_byte_ce (uaecptr addr, uae_u32 v)
STATIC_INLINE void put_word_ce (uaecptr addr, uae_u32 v)
{
mem_access_delay_byte_write (addr, v);
mem_access_delay_word_write (addr, v);
}
STATIC_INLINE void put_byte_ce (uaecptr addr, uae_u32 v)
{
mem_access_delay_byte_write (addr, v);
}
STATIC_INLINE void m68k_do_rts_ce (void)
{
uaecptr pc;
pc = get_word_ce (m68k_areg (regs, 7)) << 16;
pc |= get_word_ce (m68k_areg (regs, 7) + 2);
m68k_areg (regs, 7) += 4;
if (pc & 1)
exception3 (0x4e75, m68k_getpc (), pc);
else
m68k_setpc (pc);
uaecptr pc;
pc = get_word_ce (m68k_areg (regs, 7)) << 16;
pc |= get_word_ce (m68k_areg (regs, 7) + 2);
m68k_areg (regs, 7) += 4;
if (pc & 1)
exception3 (0x4e75, m68k_getpc (), pc);
else
m68k_setpc (pc);
}
STATIC_INLINE void m68k_do_bsr_ce (uaecptr oldpc, uae_s32 offset)
{
m68k_areg (regs, 7) -= 4;
put_word_ce (m68k_areg (regs, 7), oldpc >> 16);
put_word_ce (m68k_areg (regs, 7) + 2, oldpc);
m68k_incpc (offset);
m68k_areg (regs, 7) -= 4;
put_word_ce (m68k_areg (regs, 7), oldpc >> 16);
put_word_ce (m68k_areg (regs, 7) + 2, oldpc);
m68k_incpc (offset);
}
STATIC_INLINE void m68k_do_jsr_ce (uaecptr oldpc, uaecptr dest)
......
/*
* cpummu.h - MMU emulation
*
* Copyright (c) 2001-2004 Milan Jurik of ARAnyM dev team (see AUTHORS)
*
* Inspired by UAE MMU patch
*
* This file is part of the ARAnyM project which builds a new and powerful
* TOS/FreeMiNT compatible virtual machine running on almost any hardware.
*
* ARAnyM is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ARAnyM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ARAnyM; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef CPUMMU_H
#define CPUMMU_H
#ifndef FULLMMU
#define FULLMMU
#endif
/*
* cpummu.h - MMU emulation
*
* Copyright (c) 2001-2004 Milan Jurik of ARAnyM dev team (see AUTHORS)
*
* Inspired by UAE MMU patch
*
* This file is part of the ARAnyM project which builds a new and powerful
* TOS/FreeMiNT compatible virtual machine running on almost any hardware.
*
* ARAnyM is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ARAnyM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ARAnyM; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef CPUMMU_H
#define CPUMMU_H
#ifndef FULLMMU
#define FULLMMU
#endif
#ifndef ALWAYS_INLINE
#if WIN32
#define ALWAYS_INLINE __forceinline
......@@ -39,564 +39,563 @@
//if COMPILER(GCC) (MSVC)
#endif
#endif
#define bool int
#define DUNUSED(x)
#define D
#if DEBUG
#define bug write_log
#else
#define bug
#endif
#define MMUEX 0x4d4d5520
#define bool int
#define DUNUSED(x)
#define D
#if DEBUG
#define bug write_log
#else
#define bug
#endif
#define MMUEX 0x4d4d5520
#ifdef WIN32
#define TRY(x) __try
#define CATCH(x) __except(GetExceptionCode() == MMUEX)
#define THROW(x) RaiseException(MMUEX,EXCEPTION_NONCONTINUABLE,0,NULL)
#define THROW_AGAIN(x) THROW(x)
#define TRY(x) __try
#define CATCH(x) __except(GetExceptionCode() == MMUEX)
#define THROW(x) RaiseException(MMUEX,EXCEPTION_NONCONTINUABLE,0,NULL)
#define THROW_AGAIN(x) THROW(x)
#else
#define TRY(x)
#define CATCH(x)
#define THROW(x)
#define THROW_AGAIN(x)
#endif
#define SAVE_EXCEPTION
#define RESTORE_EXCEPTION
#define true 1
#define false 0
#define likely(x) x
#define unlikely(x) x
static ALWAYS_INLINE void flush_internals (void) { }
//typedef uae_u8 flagtype;
struct xttrx {
uae_u32 log_addr_base : 8;
uae_u32 log_addr_mask : 8;
uae_u32 enable : 1;
uae_u32 s_field : 2;
uae_u32 : 3;
uae_u32 usr1 : 1;
uae_u32 usr0 : 1;
uae_u32 : 1;
uae_u32 cmode : 2;
uae_u32 : 2;
uae_u32 write : 1;
uae_u32 : 2;
};
struct mmusr_t {
uae_u32 phys_addr : 20;
uae_u32 bus_err : 1;
uae_u32 global : 1;
uae_u32 usr1 : 1;
uae_u32 usr0 : 1;
uae_u32 super : 1;
uae_u32 cmode : 2;
uae_u32 modif : 1;
uae_u32 : 1;
uae_u32 write : 1;
uae_u32 ttrhit : 1;
uae_u32 resident : 1;
};
struct log_addr4 {
uae_u32 rif : 7;
uae_u32 pif : 7;
uae_u32 paif : 6;
uae_u32 poff : 12;
};
struct log_addr8 {
uae_u32 rif : 7;
uae_u32 pif : 7;
uae_u32 paif : 5;
uae_u32 poff : 13;
};
#define MMU_TEST_PTEST 1
#define MMU_TEST_VERBOSE 2
#define MMU_TEST_FORCE_TABLE_SEARCH 4
#define MMU_TEST_NO_BUSERR 8
extern void mmu_dump_tables(void);
#define MMU_TTR_LOGICAL_BASE 0xff000000
#define MMU_TTR_LOGICAL_MASK 0x00ff0000
#define MMU_TTR_BIT_ENABLED (1 << 15)
#define MMU_TTR_BIT_SFIELD_ENABLED (1 << 14)
#define MMU_TTR_BIT_SFIELD_SUPER (1 << 13)
#define MMU_TTR_SFIELD_SHIFT 13
#define MMU_TTR_UX_MASK ((1 << 9) | (1 << 8))
#define MMU_TTR_UX_SHIFT 8
#define MMU_TTR_CACHE_MASK ((1 << 6) | (1 << 5))
#define MMU_TTR_CACHE_SHIFT 5
#define MMU_TTR_BIT_WRITE_PROTECT (1 << 2)
#define MMU_UDT_MASK 3
#define MMU_PDT_MASK 3
#define MMU_DES_WP 4
#define MMU_DES_USED 8
/* page descriptors only */
#define MMU_DES_MODIFIED 16
#define MMU_DES_SUPER (1 << 7)
#define MMU_DES_GLOBAL (1 << 10)
#define MMU_ROOT_PTR_ADDR_MASK 0xfffffe00
#define MMU_PTR_PAGE_ADDR_MASK_8 0xffffff80
#define MMU_PTR_PAGE_ADDR_MASK_4 0xffffff00
#define MMU_PAGE_INDIRECT_MASK 0xfffffffc
#define MMU_PAGE_ADDR_MASK_8 0xffffe000
#define MMU_PAGE_ADDR_MASK_4 0xfffff000
#define MMU_PAGE_UR_MASK_8 ((1 << 12) | (1 << 11))
#define MMU_PAGE_UR_MASK_4 (1 << 11)
#define MMU_PAGE_UR_SHIFT 11
#define MMU_MMUSR_ADDR_MASK 0xfffff000
#define MMU_MMUSR_B (1 << 11)
#define MMU_MMUSR_G (1 << 10)
#define MMU_MMUSR_U1 (1 << 9)
#define MMU_MMUSR_U0 (1 << 8)
#define MMU_MMUSR_Ux (MMU_MMUSR_U1 | MMU_MMUSR_U0)
#define MMU_MMUSR_S (1 << 7)
#define MMU_MMUSR_CM ((1 << 6) | ( 1 << 5))
#define MMU_MMUSR_M (1 << 4)
#define MMU_MMUSR_W (1 << 2)
#define MMU_MMUSR_T (1 << 1)
#define MMU_MMUSR_R (1 << 0)
/* special status word (access error stack frame) */
#define MMU_SSW_TM 0x0007
#define MMU_SSW_TT 0x0018
#define MMU_SSW_SIZE 0x0060
#define MMU_SSW_SIZE_B 0x0020
#define MMU_SSW_SIZE_W 0x0040
#define MMU_SSW_SIZE_L 0x0000
#define MMU_SSW_RW 0x0100
#define MMU_SSW_LK 0x0200
#define MMU_SSW_ATC 0x0400
#define MMU_SSW_MA 0x0800
#define MMU_SSW_CM 0x1000
#define MMU_SSW_CT 0x2000
#define MMU_SSW_CU 0x4000
#define MMU_SSW_CP 0x8000
#define TTR_I0 4
#define TTR_I1 5
#define TTR_D0 6
#define TTR_D1 7
#define TTR_NO_MATCH 0
#define TTR_NO_WRITE 1
#define TTR_OK_MATCH 2
struct mmu_atc_line {
uae_u16 tag;
unsigned tt : 1;
unsigned valid_data : 1;
unsigned valid_inst : 1;
unsigned global : 1;
unsigned modified : 1;
unsigned write_protect : 1;
unsigned hw : 1;
unsigned bus_fault : 1;
uaecptr phys;
};
/*
* We don't need to store the whole logical address in the atc cache, as part of
* it is encoded as index into the cache. 14 bits of the address are stored in
* the tag, this means at least 6 bits must go into the index. The upper two
* bits of the tag define the type of data in the atc line:
* - 00: a normal memory address
* - 11: invalid memory address or hardware access
* (generated via ~ATC_TAG(addr) in the slow path)
* - 10: empty atc line
*/
#define ATC_TAG_SHIFT 18
#define ATC_TAG(addr) ((uae_u32)(addr) >> ATC_TAG_SHIFT)
#define ATC_L1_SIZE_LOG 8
#define ATC_L1_SIZE (1 << ATC_L1_SIZE_LOG)
#define ATC_L1_INDEX(addr) (((addr) >> 12) % ATC_L1_SIZE)
/*
* first level atc cache
* indexed by [super][data][rw][idx]
*/
typedef struct mmu_atc_line mmu_atc_l1_array[2][2][ATC_L1_SIZE];
extern mmu_atc_l1_array atc_l1[2];
extern mmu_atc_l1_array *current_atc;
#define ATC_L2_SIZE_LOG 12
#define ATC_L2_SIZE (1 << ATC_L2_SIZE_LOG)
#define ATC_L2_INDEX(addr) ((((addr) >> 12) ^ ((addr) >> (32 - ATC_L2_SIZE_LOG))) % ATC_L2_SIZE)
extern struct mmu_atc_line atc_l2[2][ATC_L2_SIZE];
/*
* lookup address in the level 1 atc cache,
* the data and write arguments are constant in the common,
* thus allows gcc to generate a constant offset.
*/
static ALWAYS_INLINE int mmu_lookup(uaecptr addr, bool data, bool write,
struct mmu_atc_line **cl)
{
addr >>= 12;
*cl = &(*current_atc)[data][write][addr % ATC_L1_SIZE];
return (*cl)->tag == addr >> (ATC_TAG_SHIFT - 12);
}
/*
* similiar to mmu_user_lookup, but for the use of the moves instruction
*/
static ALWAYS_INLINE int mmu_user_lookup(uaecptr addr, bool super, bool data,
bool write, struct mmu_atc_line **cl)
{
addr >>= 12;
*cl = &atc_l1[super][data][write][addr % ATC_L1_SIZE];
return (*cl)->tag == addr >> (ATC_TAG_SHIFT - 12);
}
extern uae_u16 REGPARAM3 mmu_get_word_unaligned(uaecptr addr, int data) REGPARAM;
extern uae_u32 REGPARAM3 mmu_get_long_unaligned(uaecptr addr, int data) REGPARAM;
extern uae_u8 REGPARAM3 mmu_get_byte_slow(uaecptr addr, int super, int data,
int size, struct mmu_atc_line *cl) REGPARAM;
extern uae_u16 REGPARAM3 mmu_get_word_slow(uaecptr addr, int super, int data,
int size, struct mmu_atc_line *cl) REGPARAM;
extern uae_u32 REGPARAM3 mmu_get_long_slow(uaecptr addr, int super, int data,
int size, struct mmu_atc_line *cl) REGPARAM;
extern void REGPARAM3 mmu_put_word_unaligned(uaecptr addr, uae_u16 val, int data) REGPARAM;
extern void REGPARAM3 mmu_put_long_unaligned(uaecptr addr, uae_u32 val, int data) REGPARAM;
extern void REGPARAM3 mmu_put_byte_slow(uaecptr addr, uae_u8 val, int super, int data,
int size, struct mmu_atc_line *cl) REGPARAM;
extern void REGPARAM3 mmu_put_word_slow(uaecptr addr, uae_u16 val, int super, int data,
int size, struct mmu_atc_line *cl) REGPARAM;
extern void REGPARAM3 mmu_put_long_slow(uaecptr addr, uae_u32 val, int super, int data,
int size, struct mmu_atc_line *cl) REGPARAM;
extern void mmu_make_transparent_region(uaecptr baseaddr, uae_u32 size, int datamode);
#define FC_DATA (regs.s ? 5 : 1)
#define FC_INST (regs.s ? 6 : 2)
extern uaecptr REGPARAM3 mmu_translate(uaecptr addr, int super, int data, int write) REGPARAM;
extern uae_u32 REGPARAM3 sfc_get_long(uaecptr addr) REGPARAM;
extern uae_u16 REGPARAM3 sfc_get_word(uaecptr addr) REGPARAM;
extern uae_u8 REGPARAM3 sfc_get_byte(uaecptr addr) REGPARAM;
extern void REGPARAM3 dfc_put_long(uaecptr addr, uae_u32 val) REGPARAM;
extern void REGPARAM3 dfc_put_word(uaecptr addr, uae_u16 val) REGPARAM;
extern void REGPARAM3 dfc_put_byte(uaecptr addr, uae_u8 val) REGPARAM;
extern void REGPARAM3 mmu_flush_atc(uaecptr addr, bool super, bool global) REGPARAM;
extern void REGPARAM3 mmu_flush_atc_all(bool global) REGPARAM;
extern void REGPARAM3 mmu_op_real(uae_u32 opcode, uae_u16 extra) REGPARAM;
extern void REGPARAM3 mmu_reset(void) REGPARAM;
extern void REGPARAM3 mmu_set_tc(uae_u16 tc) REGPARAM;
extern void REGPARAM3 mmu_set_super(bool super) REGPARAM;
static ALWAYS_INLINE bool is_unaligned(uaecptr addr, int size)
{
return unlikely((addr & (size - 1)) && (addr ^ (addr + size - 1)) & 0x1000);
}
static ALWAYS_INLINE uaecptr mmu_get_real_address(uaecptr addr, struct mmu_atc_line *cl)
{
return cl->phys + addr;
}
static ALWAYS_INLINE void phys_put_long(uaecptr addr, uae_u32 l)
{
longput(addr, l);
}
static ALWAYS_INLINE void phys_put_word(uaecptr addr, uae_u32 w)
{
wordput(addr, w);
}
static ALWAYS_INLINE void phys_put_byte(uaecptr addr, uae_u32 b)
{
byteput(addr, b);
}
static ALWAYS_INLINE uae_u32 phys_get_long(uaecptr addr)
{
return longget (addr);
}
static ALWAYS_INLINE uae_u32 phys_get_word(uaecptr addr)
{
return wordget (addr);
}
static ALWAYS_INLINE uae_u32 phys_get_byte(uaecptr addr)
{
return byteget (addr);
}
static ALWAYS_INLINE uae_u32 mmu_get_long(uaecptr addr, int data, int size)
{
struct mmu_atc_line *cl;
if (likely(mmu_lookup(addr, data, 0, &cl)))
return phys_get_long(mmu_get_real_address(addr, cl));
return mmu_get_long_slow(addr, regs.s, data, size, cl);
}
static ALWAYS_INLINE uae_u16 mmu_get_word(uaecptr addr, int data, int size)
{
struct mmu_atc_line *cl;
if (likely(mmu_lookup(addr, data, 0, &cl)))
return phys_get_word(mmu_get_real_address(addr, cl));
return mmu_get_word_slow(addr, regs.s, data, size, cl);
}
static ALWAYS_INLINE uae_u8 mmu_get_byte(uaecptr addr, int data, int size)
{
struct mmu_atc_line *cl;
if (likely(mmu_lookup(addr, data, 0, &cl)))
return phys_get_byte(mmu_get_real_address(addr, cl));
return mmu_get_byte_slow(addr, regs.s, data, size, cl);
}
static ALWAYS_INLINE void mmu_put_long(uaecptr addr, uae_u32 val, int data, int size)
{
struct mmu_atc_line *cl;
if (likely(mmu_lookup(addr, data, 1, &cl)))
phys_put_long(mmu_get_real_address(addr, cl), val);
else
mmu_put_long_slow(addr, val, regs.s, data, size, cl);
}
static ALWAYS_INLINE void mmu_put_word(uaecptr addr, uae_u16 val, int data, int size)
{
struct mmu_atc_line *cl;
if (likely(mmu_lookup(addr, data, 1, &cl)))
phys_put_word(mmu_get_real_address(addr, cl), val);
else
mmu_put_word_slow(addr, val, regs.s, data, size, cl);
}
static ALWAYS_INLINE void mmu_put_byte(uaecptr addr, uae_u8 val, int data, int size)
{
struct mmu_atc_line *cl;
if (likely(mmu_lookup(addr, data, 1, &cl)))
phys_put_byte(mmu_get_real_address(addr, cl), val);
else
mmu_put_byte_slow(addr, val, regs.s, data, size, cl);
}
static ALWAYS_INLINE uae_u32 mmu_get_user_long(uaecptr addr, int super, int data, int size)
{
struct mmu_atc_line *cl;
if (likely(mmu_user_lookup(addr, super, data, 0, &cl)))
return phys_get_long(mmu_get_real_address(addr, cl));
return mmu_get_long_slow(addr, super, data, size, cl);
}
static ALWAYS_INLINE uae_u16 mmu_get_user_word(uaecptr addr, int super, int data, int size)
{
struct mmu_atc_line *cl;
if (likely(mmu_user_lookup(addr, super, data, 0, &cl)))
return phys_get_word(mmu_get_real_address(addr, cl));
return mmu_get_word_slow(addr, super, data, size, cl);
}
static ALWAYS_INLINE uae_u8 mmu_get_user_byte(uaecptr addr, int super, int data, int size)
{
struct mmu_atc_line *cl;
if (likely(mmu_user_lookup(addr, super, data, 0, &cl)))
return phys_get_byte(mmu_get_real_address(addr, cl));
return mmu_get_byte_slow(addr, super, data, size, cl);
}
static ALWAYS_INLINE void mmu_put_user_long(uaecptr addr, uae_u32 val, int super, int data, int size)
{
struct mmu_atc_line *cl;
if (likely(mmu_user_lookup(addr, super, data, 1, &cl)))
phys_put_long(mmu_get_real_address(addr, cl), val);
else
mmu_put_long_slow(addr, val, super, data, size, cl);
}
static ALWAYS_INLINE void mmu_put_user_word(uaecptr addr, uae_u16 val, int super, int data, int size)
{
struct mmu_atc_line *cl;
if (likely(mmu_user_lookup(addr, super, data, 1, &cl)))
phys_put_word(mmu_get_real_address(addr, cl), val);
else
mmu_put_word_slow(addr, val, super, data, size, cl);
}
static ALWAYS_INLINE void mmu_put_user_byte(uaecptr addr, uae_u8 val, int super, int data, int size)
{
struct mmu_atc_line *cl;
if (likely(mmu_user_lookup(addr, super, data, 1, &cl)))
phys_put_byte(mmu_get_real_address(addr, cl), val);
else
mmu_put_byte_slow(addr, val, super, data, size, cl);
}
static ALWAYS_INLINE void HWput_l(uaecptr addr, uae_u32 l)
{
put_long (addr, l);
}
static ALWAYS_INLINE void HWput_w(uaecptr addr, uae_u32 w)
{
put_word (addr, w);
}
static ALWAYS_INLINE void HWput_b(uaecptr addr, uae_u32 b)
{
put_byte (addr, b);
}
static ALWAYS_INLINE uae_u32 HWget_l(uaecptr addr)
{
return get_long (addr);
}
static ALWAYS_INLINE uae_u32 HWget_w(uaecptr addr)
{
return get_word (addr);
}
static ALWAYS_INLINE uae_u32 HWget_b(uaecptr addr)
{
return get_byte (addr);
}
static ALWAYS_INLINE uae_u32 uae_mmu_get_ilong(uaecptr addr)
{
if (unlikely(is_unaligned(addr, 4)))
return mmu_get_long_unaligned(addr, 0);
return mmu_get_long(addr, 0, sz_long);
}
static ALWAYS_INLINE uae_u16 uae_mmu_get_iword(uaecptr addr)
{
if (unlikely(is_unaligned(addr, 2)))
return mmu_get_word_unaligned(addr, 0);
return mmu_get_word(addr, 0, sz_word);
}
static ALWAYS_INLINE uae_u16 uae_mmu_get_ibyte(uaecptr addr)
{
return mmu_get_byte(addr, 0, sz_byte);
}
static ALWAYS_INLINE uae_u32 uae_mmu_get_long(uaecptr addr)
{
if (unlikely(is_unaligned(addr, 4)))
return mmu_get_long_unaligned(addr, 1);
return mmu_get_long(addr, 1, sz_long);
}
static ALWAYS_INLINE uae_u16 uae_mmu_get_word(uaecptr addr)
{
if (unlikely(is_unaligned(addr, 2)))
return mmu_get_word_unaligned(addr, 1);
return mmu_get_word(addr, 1, sz_word);
}
static ALWAYS_INLINE uae_u8 uae_mmu_get_byte(uaecptr addr)
{
return mmu_get_byte(addr, 1, sz_byte);
}
static ALWAYS_INLINE void uae_mmu_put_long(uaecptr addr, uae_u32 val)
{
if (unlikely(is_unaligned(addr, 4)))
mmu_put_long_unaligned(addr, val, 1);
else
mmu_put_long(addr, val, 1, sz_long);
}
static ALWAYS_INLINE void uae_mmu_put_word(uaecptr addr, uae_u16 val)
{
if (unlikely(is_unaligned(addr, 2)))
mmu_put_word_unaligned(addr, val, 1);
else
mmu_put_word(addr, val, 1, sz_word);
}
static ALWAYS_INLINE void uae_mmu_put_byte(uaecptr addr, uae_u8 val)
{
mmu_put_byte(addr, val, 1, sz_byte);
}
STATIC_INLINE void put_byte_mmu (uaecptr addr, uae_u32 v)
{
uae_mmu_put_byte (addr, v);
}
STATIC_INLINE void put_word_mmu (uaecptr addr, uae_u32 v)
{
uae_mmu_put_word (addr, v);
}
STATIC_INLINE void put_long_mmu (uaecptr addr, uae_u32 v)
{
uae_mmu_put_long (addr, v);
}
STATIC_INLINE uae_u32 get_byte_mmu (uaecptr addr)
{
return uae_mmu_get_byte (addr);
}
STATIC_INLINE uae_u32 get_word_mmu (uaecptr addr)
{
return uae_mmu_get_word (addr);
}
STATIC_INLINE uae_u32 get_long_mmu (uaecptr addr)
{
return uae_mmu_get_long (addr);
}
STATIC_INLINE uae_u32 get_ibyte_mmu (int o)
{
uae_u32 pc = m68k_getpc () + o;
return uae_mmu_get_iword (pc);
}
STATIC_INLINE uae_u32 get_iword_mmu (int o)
{
uae_u32 pc = m68k_getpc () + o;
return uae_mmu_get_iword (pc);
}
STATIC_INLINE uae_u32 get_ilong_mmu (int o)
{
uae_u32 pc = m68k_getpc () + o;
return uae_mmu_get_ilong (pc);
}
STATIC_INLINE uae_u32 next_iword_mmu (void)
{
uae_u32 pc = m68k_getpc ();
m68k_incpci (2);
return uae_mmu_get_iword (pc);
}
STATIC_INLINE uae_u32 next_ilong_mmu (void)
{
uae_u32 pc = m68k_getpc ();
m68k_incpci (4);
return uae_mmu_get_ilong (pc);
}
extern void m68k_do_rts_mmu (void);
extern void m68k_do_rte_mmu (uaecptr a7);
extern void m68k_do_bsr_mmu (uaecptr oldpc, uae_s32 offset);
struct mmufixup
{
int reg;
uae_u32 value;
};
extern struct mmufixup mmufixup[2];
#endif /* CPUMMU_H */
#define SAVE_EXCEPTION
#define RESTORE_EXCEPTION
#define true 1
#define false 0
#define likely(x) x
#define unlikely(x) x
static ALWAYS_INLINE void flush_internals (void) { }
//typedef uae_u8 flagtype;
struct xttrx {
uae_u32 log_addr_base : 8;
uae_u32 log_addr_mask : 8;
uae_u32 enable : 1;
uae_u32 s_field : 2;
uae_u32 : 3;
uae_u32 usr1 : 1;
uae_u32 usr0 : 1;
uae_u32 : 1;
uae_u32 cmode : 2;
uae_u32 : 2;
uae_u32 write : 1;
uae_u32 : 2;
};
struct mmusr_t {
uae_u32 phys_addr : 20;
uae_u32 bus_err : 1;
uae_u32 global : 1;
uae_u32 usr1 : 1;
uae_u32 usr0 : 1;
uae_u32 super : 1;
uae_u32 cmode : 2;
uae_u32 modif : 1;
uae_u32 : 1;
uae_u32 write : 1;
uae_u32 ttrhit : 1;
uae_u32 resident : 1;
};
struct log_addr4 {
uae_u32 rif : 7;
uae_u32 pif : 7;
uae_u32 paif : 6;
uae_u32 poff : 12;
};
struct log_addr8 {
uae_u32 rif : 7;
uae_u32 pif : 7;
uae_u32 paif : 5;
uae_u32 poff : 13;
};
#define MMU_TEST_PTEST 1
#define MMU_TEST_VERBOSE 2
#define MMU_TEST_FORCE_TABLE_SEARCH 4
#define MMU_TEST_NO_BUSERR 8
extern void mmu_dump_tables(void);
#define MMU_TTR_LOGICAL_BASE 0xff000000
#define MMU_TTR_LOGICAL_MASK 0x00ff0000
#define MMU_TTR_BIT_ENABLED (1 << 15)
#define MMU_TTR_BIT_SFIELD_ENABLED (1 << 14)
#define MMU_TTR_BIT_SFIELD_SUPER (1 << 13)
#define MMU_TTR_SFIELD_SHIFT 13
#define MMU_TTR_UX_MASK ((1 << 9) | (1 << 8))
#define MMU_TTR_UX_SHIFT 8
#define MMU_TTR_CACHE_MASK ((1 << 6) | (1 << 5))
#define MMU_TTR_CACHE_SHIFT 5
#define MMU_TTR_BIT_WRITE_PROTECT (1 << 2)
#define MMU_UDT_MASK 3
#define MMU_PDT_MASK 3
#define MMU_DES_WP 4
#define MMU_DES_USED 8
/* page descriptors only */
#define MMU_DES_MODIFIED 16
#define MMU_DES_SUPER (1 << 7)
#define MMU_DES_GLOBAL (1 << 10)
#define MMU_ROOT_PTR_ADDR_MASK 0xfffffe00
#define MMU_PTR_PAGE_ADDR_MASK_8 0xffffff80
#define MMU_PTR_PAGE_ADDR_MASK_4 0xffffff00
#define MMU_PAGE_INDIRECT_MASK 0xfffffffc
#define MMU_PAGE_ADDR_MASK_8 0xffffe000
#define MMU_PAGE_ADDR_MASK_4 0xfffff000
#define MMU_PAGE_UR_MASK_8 ((1 << 12) | (1 << 11))
#define MMU_PAGE_UR_MASK_4 (1 << 11)
#define MMU_PAGE_UR_SHIFT 11
#define MMU_MMUSR_ADDR_MASK 0xfffff000
#define MMU_MMUSR_B (1 << 11)
#define MMU_MMUSR_G (1 << 10)
#define MMU_MMUSR_U1 (1 << 9)
#define MMU_MMUSR_U0 (1 << 8)
#define MMU_MMUSR_Ux (MMU_MMUSR_U1 | MMU_MMUSR_U0)
#define MMU_MMUSR_S (1 << 7)
#define MMU_MMUSR_CM ((1 << 6) | ( 1 << 5))
#define MMU_MMUSR_M (1 << 4)
#define MMU_MMUSR_W (1 << 2)
#define MMU_MMUSR_T (1 << 1)
#define MMU_MMUSR_R (1 << 0)
/* special status word (access error stack frame) */
#define MMU_SSW_TM 0x0007
#define MMU_SSW_TT 0x0018
#define MMU_SSW_SIZE 0x0060
#define MMU_SSW_SIZE_B 0x0020
#define MMU_SSW_SIZE_W 0x0040
#define MMU_SSW_SIZE_L 0x0000
#define MMU_SSW_RW 0x0100
#define MMU_SSW_LK 0x0200
#define MMU_SSW_ATC 0x0400
#define MMU_SSW_MA 0x0800
#define MMU_SSW_CM 0x1000
#define MMU_SSW_CT 0x2000
#define MMU_SSW_CU 0x4000
#define MMU_SSW_CP 0x8000
#define TTR_I0 4
#define TTR_I1 5
#define TTR_D0 6
#define TTR_D1 7
#define TTR_NO_MATCH 0
#define TTR_NO_WRITE 1
#define TTR_OK_MATCH 2
struct mmu_atc_line {
uae_u16 tag;
unsigned tt : 1;
unsigned valid_data : 1;
unsigned valid_inst : 1;
unsigned global : 1;
unsigned modified : 1;
unsigned write_protect : 1;
unsigned hw : 1;
unsigned bus_fault : 1;
uaecptr phys;
};
/*
* We don't need to store the whole logical address in the atc cache, as part of
* it is encoded as index into the cache. 14 bits of the address are stored in
* the tag, this means at least 6 bits must go into the index. The upper two
* bits of the tag define the type of data in the atc line:
* - 00: a normal memory address
* - 11: invalid memory address or hardware access
* (generated via ~ATC_TAG(addr) in the slow path)
* - 10: empty atc line
*/
#define ATC_TAG_SHIFT 18
#define ATC_TAG(addr) ((uae_u32)(addr) >> ATC_TAG_SHIFT)
#define ATC_L1_SIZE_LOG 8
#define ATC_L1_SIZE (1 << ATC_L1_SIZE_LOG)
#define ATC_L1_INDEX(addr) (((addr) >> 12) % ATC_L1_SIZE)
/*
* first level atc cache
* indexed by [super][data][rw][idx]
*/
typedef struct mmu_atc_line mmu_atc_l1_array[2][2][ATC_L1_SIZE];
extern mmu_atc_l1_array atc_l1[2];
extern mmu_atc_l1_array *current_atc;
#define ATC_L2_SIZE_LOG 12
#define ATC_L2_SIZE (1 << ATC_L2_SIZE_LOG)
#define ATC_L2_INDEX(addr) ((((addr) >> 12) ^ ((addr) >> (32 - ATC_L2_SIZE_LOG))) % ATC_L2_SIZE)
extern struct mmu_atc_line atc_l2[2][ATC_L2_SIZE];
/*
* lookup address in the level 1 atc cache,
* the data and write arguments are constant in the common,
* thus allows gcc to generate a constant offset.
*/
static ALWAYS_INLINE int mmu_lookup(uaecptr addr, bool data, bool write,
struct mmu_atc_line **cl)
{
addr >>= 12;
*cl = &(*current_atc)[data][write][addr % ATC_L1_SIZE];
return (*cl)->tag == addr >> (ATC_TAG_SHIFT - 12);
}
/*
* similiar to mmu_user_lookup, but for the use of the moves instruction
*/
static ALWAYS_INLINE int mmu_user_lookup(uaecptr addr, bool super, bool data,
bool write, struct mmu_atc_line **cl)
{
addr >>= 12;
*cl = &atc_l1[super][data][write][addr % ATC_L1_SIZE];
return (*cl)->tag == addr >> (ATC_TAG_SHIFT - 12);
}
extern uae_u16 REGPARAM3 mmu_get_word_unaligned(uaecptr addr, int data) REGPARAM;
extern uae_u32 REGPARAM3 mmu_get_long_unaligned(uaecptr addr, int data) REGPARAM;
extern uae_u8 REGPARAM3 mmu_get_byte_slow(uaecptr addr, int super, int data,
int size, struct mmu_atc_line *cl) REGPARAM;
extern uae_u16 REGPARAM3 mmu_get_word_slow(uaecptr addr, int super, int data,
int size, struct mmu_atc_line *cl) REGPARAM;
extern uae_u32 REGPARAM3 mmu_get_long_slow(uaecptr addr, int super, int data,
int size, struct mmu_atc_line *cl) REGPARAM;
extern void REGPARAM3 mmu_put_word_unaligned(uaecptr addr, uae_u16 val, int data) REGPARAM;
extern void REGPARAM3 mmu_put_long_unaligned(uaecptr addr, uae_u32 val, int data) REGPARAM;
extern void REGPARAM3 mmu_put_byte_slow(uaecptr addr, uae_u8 val, int super, int data,
int size, struct mmu_atc_line *cl) REGPARAM;
extern void REGPARAM3 mmu_put_word_slow(uaecptr addr, uae_u16 val, int super, int data,
int size, struct mmu_atc_line *cl) REGPARAM;
extern void REGPARAM3 mmu_put_long_slow(uaecptr addr, uae_u32 val, int super, int data,
int size, struct mmu_atc_line *cl) REGPARAM;
extern void mmu_make_transparent_region(uaecptr baseaddr, uae_u32 size, int datamode);
#define FC_DATA (regs.s ? 5 : 1)
#define FC_INST (regs.s ? 6 : 2)
extern uaecptr REGPARAM3 mmu_translate(uaecptr addr, int super, int data, int write) REGPARAM;
extern uae_u32 REGPARAM3 sfc_get_long(uaecptr addr) REGPARAM;
extern uae_u16 REGPARAM3 sfc_get_word(uaecptr addr) REGPARAM;
extern uae_u8 REGPARAM3 sfc_get_byte(uaecptr addr) REGPARAM;
extern void REGPARAM3 dfc_put_long(uaecptr addr, uae_u32 val) REGPARAM;
extern void REGPARAM3 dfc_put_word(uaecptr addr, uae_u16 val) REGPARAM;
extern void REGPARAM3 dfc_put_byte(uaecptr addr, uae_u8 val) REGPARAM;
extern void REGPARAM3 mmu_flush_atc(uaecptr addr, bool super, bool global) REGPARAM;
extern void REGPARAM3 mmu_flush_atc_all(bool global) REGPARAM;
extern void REGPARAM3 mmu_op_real(uae_u32 opcode, uae_u16 extra) REGPARAM;
extern void REGPARAM3 mmu_reset(void) REGPARAM;
extern void REGPARAM3 mmu_set_tc(uae_u16 tc) REGPARAM;
extern void REGPARAM3 mmu_set_super(bool super) REGPARAM;
static ALWAYS_INLINE bool is_unaligned(uaecptr addr, int size)
{
return unlikely((addr & (size - 1)) && (addr ^ (addr + size - 1)) & 0x1000);
}
static ALWAYS_INLINE uaecptr mmu_get_real_address(uaecptr addr, struct mmu_atc_line *cl)
{
return cl->phys + addr;
}
static ALWAYS_INLINE void phys_put_long(uaecptr addr, uae_u32 l)
{
longput(addr, l);
}
static ALWAYS_INLINE void phys_put_word(uaecptr addr, uae_u32 w)
{
wordput(addr, w);
}
static ALWAYS_INLINE void phys_put_byte(uaecptr addr, uae_u32 b)
{
byteput(addr, b);
}
static ALWAYS_INLINE uae_u32 phys_get_long(uaecptr addr)
{
return longget (addr);
}
static ALWAYS_INLINE uae_u32 phys_get_word(uaecptr addr)
{
return wordget (addr);
}
static ALWAYS_INLINE uae_u32 phys_get_byte(uaecptr addr)
{
return byteget (addr);
}
static ALWAYS_INLINE uae_u32 mmu_get_long(uaecptr addr, int data, int size)
{
struct mmu_atc_line *cl;
if (likely(mmu_lookup(addr, data, 0, &cl)))
return phys_get_long(mmu_get_real_address(addr, cl));
return mmu_get_long_slow(addr, regs.s, data, size, cl);
}
static ALWAYS_INLINE uae_u16 mmu_get_word(uaecptr addr, int data, int size)
{
struct mmu_atc_line *cl;
if (likely(mmu_lookup(addr, data, 0, &cl)))
return phys_get_word(mmu_get_real_address(addr, cl));
return mmu_get_word_slow(addr, regs.s, data, size, cl);
}
static ALWAYS_INLINE uae_u8 mmu_get_byte(uaecptr addr, int data, int size)
{
struct mmu_atc_line *cl;
if (likely(mmu_lookup(addr, data, 0, &cl)))
return phys_get_byte(mmu_get_real_address(addr, cl));
return mmu_get_byte_slow(addr, regs.s, data, size, cl);
}
static ALWAYS_INLINE void mmu_put_long(uaecptr addr, uae_u32 val, int data, int size)
{
struct mmu_atc_line *cl;
if (likely(mmu_lookup(addr, data, 1, &cl)))
phys_put_long(mmu_get_real_address(addr, cl), val);
else
mmu_put_long_slow(addr, val, regs.s, data, size, cl);
}
static ALWAYS_INLINE void mmu_put_word(uaecptr addr, uae_u16 val, int data, int size)
{
struct mmu_atc_line *cl;
if (likely(mmu_lookup(addr, data, 1, &cl)))
phys_put_word(mmu_get_real_address(addr, cl), val);
else
mmu_put_word_slow(addr, val, regs.s, data, size, cl);
}
static ALWAYS_INLINE void mmu_put_byte(uaecptr addr, uae_u8 val, int data, int size)
{
struct mmu_atc_line *cl;
if (likely(mmu_lookup(addr, data, 1, &cl)))
phys_put_byte(mmu_get_real_address(addr, cl), val);
else
mmu_put_byte_slow(addr, val, regs.s, data, size, cl);
}
static ALWAYS_INLINE uae_u32 mmu_get_user_long(uaecptr addr, int super, int data, int size)
{
struct mmu_atc_line *cl;
if (likely(mmu_user_lookup(addr, super, data, 0, &cl)))
return phys_get_long(mmu_get_real_address(addr, cl));
return mmu_get_long_slow(addr, super, data, size, cl);
}
static ALWAYS_INLINE uae_u16 mmu_get_user_word(uaecptr addr, int super, int data, int size)
{
struct mmu_atc_line *cl;
if (likely(mmu_user_lookup(addr, super, data, 0, &cl)))
return phys_get_word(mmu_get_real_address(addr, cl));
return mmu_get_word_slow(addr, super, data, size, cl);
}
static ALWAYS_INLINE uae_u8 mmu_get_user_byte(uaecptr addr, int super, int data, int size)
{
struct mmu_atc_line *cl;
if (likely(mmu_user_lookup(addr, super, data, 0, &cl)))
return phys_get_byte(mmu_get_real_address(addr, cl));
return mmu_get_byte_slow(addr, super, data, size, cl);
}
static ALWAYS_INLINE void mmu_put_user_long(uaecptr addr, uae_u32 val, int super, int data, int size)
{
struct mmu_atc_line *cl;
if (likely(mmu_user_lookup(addr, super, data, 1, &cl)))
phys_put_long(mmu_get_real_address(addr, cl), val);
else
mmu_put_long_slow(addr, val, super, data, size, cl);
}
static ALWAYS_INLINE void mmu_put_user_word(uaecptr addr, uae_u16 val, int super, int data, int size)
{
struct mmu_atc_line *cl;
if (likely(mmu_user_lookup(addr, super, data, 1, &cl)))
phys_put_word(mmu_get_real_address(addr, cl), val);
else
mmu_put_word_slow(addr, val, super, data, size, cl);
}
static ALWAYS_INLINE void mmu_put_user_byte(uaecptr addr, uae_u8 val, int super, int data, int size)
{
struct mmu_atc_line *cl;
if (likely(mmu_user_lookup(addr, super, data, 1, &cl)))
phys_put_byte(mmu_get_real_address(addr, cl), val);
else
mmu_put_byte_slow(addr, val, super, data, size, cl);
}
static ALWAYS_INLINE void HWput_l(uaecptr addr, uae_u32 l)
{
put_long (addr, l);
}
static ALWAYS_INLINE void HWput_w(uaecptr addr, uae_u32 w)
{
put_word (addr, w);
}
static ALWAYS_INLINE void HWput_b(uaecptr addr, uae_u32 b)
{
put_byte (addr, b);
}
static ALWAYS_INLINE uae_u32 HWget_l(uaecptr addr)
{
return get_long (addr);
}
static ALWAYS_INLINE uae_u32 HWget_w(uaecptr addr)
{
return get_word (addr);
}
static ALWAYS_INLINE uae_u32 HWget_b(uaecptr addr)
{
return get_byte (addr);
}
static ALWAYS_INLINE uae_u32 uae_mmu_get_ilong(uaecptr addr)
{
if (unlikely(is_unaligned(addr, 4)))
return mmu_get_long_unaligned(addr, 0);
return mmu_get_long(addr, 0, sz_long);
}
static ALWAYS_INLINE uae_u16 uae_mmu_get_iword(uaecptr addr)
{
if (unlikely(is_unaligned(addr, 2)))
return mmu_get_word_unaligned(addr, 0);
return mmu_get_word(addr, 0, sz_word);
}
static ALWAYS_INLINE uae_u16 uae_mmu_get_ibyte(uaecptr addr)
{
return mmu_get_byte(addr, 0, sz_byte);
}
static ALWAYS_INLINE uae_u32 uae_mmu_get_long(uaecptr addr)
{
if (unlikely(is_unaligned(addr, 4)))
return mmu_get_long_unaligned(addr, 1);
return mmu_get_long(addr, 1, sz_long);
}
static ALWAYS_INLINE uae_u16 uae_mmu_get_word(uaecptr addr)
{
if (unlikely(is_unaligned(addr, 2)))
return mmu_get_word_unaligned(addr, 1);
return mmu_get_word(addr, 1, sz_word);
}
static ALWAYS_INLINE uae_u8 uae_mmu_get_byte(uaecptr addr)
{
return mmu_get_byte(addr, 1, sz_byte);
}
static ALWAYS_INLINE void uae_mmu_put_long(uaecptr addr, uae_u32 val)
{
if (unlikely(is_unaligned(addr, 4)))
mmu_put_long_unaligned(addr, val, 1);
else
mmu_put_long(addr, val, 1, sz_long);
}
static ALWAYS_INLINE void uae_mmu_put_word(uaecptr addr, uae_u16 val)
{
if (unlikely(is_unaligned(addr, 2)))
mmu_put_word_unaligned(addr, val, 1);
else
mmu_put_word(addr, val, 1, sz_word);
}
static ALWAYS_INLINE void uae_mmu_put_byte(uaecptr addr, uae_u8 val)
{
mmu_put_byte(addr, val, 1, sz_byte);
}
STATIC_INLINE void put_byte_mmu (uaecptr addr, uae_u32 v)
{
uae_mmu_put_byte (addr, v);
}
STATIC_INLINE void put_word_mmu (uaecptr addr, uae_u32 v)
{
uae_mmu_put_word (addr, v);
}
STATIC_INLINE void put_long_mmu (uaecptr addr, uae_u32 v)
{
uae_mmu_put_long (addr, v);
}
STATIC_INLINE uae_u32 get_byte_mmu (uaecptr addr)
{
return uae_mmu_get_byte (addr);
}
STATIC_INLINE uae_u32 get_word_mmu (uaecptr addr)
{
return uae_mmu_get_word (addr);
}
STATIC_INLINE uae_u32 get_long_mmu (uaecptr addr)
{
return uae_mmu_get_long (addr);
}
STATIC_INLINE uae_u32 get_ibyte_mmu (int o)
{
uae_u32 pc = m68k_getpc () + o;
return uae_mmu_get_iword (pc);
}
STATIC_INLINE uae_u32 get_iword_mmu (int o)
{
uae_u32 pc = m68k_getpc () + o;
return uae_mmu_get_iword (pc);
}
STATIC_INLINE uae_u32 get_ilong_mmu (int o)
{
uae_u32 pc = m68k_getpc () + o;
return uae_mmu_get_ilong (pc);
}
STATIC_INLINE uae_u32 next_iword_mmu (void)
{
uae_u32 pc = m68k_getpc ();
m68k_incpci (2);
return uae_mmu_get_iword (pc);
}
STATIC_INLINE uae_u32 next_ilong_mmu (void)
{
uae_u32 pc = m68k_getpc ();
m68k_incpci (4);
return uae_mmu_get_ilong (pc);
}
extern void m68k_do_rts_mmu (void);
extern void m68k_do_rte_mmu (uaecptr a7);
extern void m68k_do_bsr_mmu (uaecptr oldpc, uae_s32 offset);
struct mmufixup
{
int reg;
uae_u32 value;
};
extern struct mmufixup mmufixup[2];
#endif /* CPUMMU_H */
int isamigatrack (uae_u16 *amigamfmbuffer, uae_u8 *mfmdata, int len, uae_u8 *writebuffer, uae_u8 *writebuffer_ok, int track, int *outsize);
int ispctrack (uae_u16 *amigamfmbuffer, uae_u8 *mfmdata, int len, uae_u8 *writebuffer, uae_u8 *writebuffer_ok, int track, int *outsize);
int isamigatrack (uae_u16 *amigamfmbuffer, uae_u8 *mfmdata, int len, uae_u8 *writebuffer, uae_u8 *writebuffer_ok, int track, int *outsize);
int ispctrack (uae_u16 *amigamfmbuffer, uae_u8 *mfmdata, int len, uae_u8 *writebuffer, uae_u8 *writebuffer_ok, int track, int *outsize);
......@@ -57,10 +57,10 @@ int setup_sound (void)
printf("ALSA lib version: %s\n", SND_LIB_VERSION_STR);
if ((err = open_sound()) < 0) {
/* TODO: if the pcm was busy, we should the same as sd-uss does.
tell the caller that sound is available. in any other
condition we should just return 0. */
write_log ("ALSA: Can't open audio device: %s\n", snd_strerror (err));
return 0;
tell the caller that sound is available. in any other
condition we should just return 0. */
write_log ("ALSA: Can't open audio device: %s\n", snd_strerror (err));
return 0;
}
snd_pcm_close (alsa_playback_handle);
alsa_playback_handle = 0;
......@@ -171,8 +171,8 @@ int init_sound (void)
channels = currprefs.sound_stereo ? 2 : 1;
rate = currprefs.sound_freq;
have_sound = 0;
alsa_playback_handle = 0;
have_sound = 0;
alsa_playback_handle = 0;
printf("ALSA lib version: %s\n", SND_LIB_VERSION_STR);
if ((err = open_sound()) < 0) {
write_log ("ALSA: Can't open audio device: %s\n", snd_strerror (err));
......
......@@ -4,7 +4,7 @@ running configure, to aid debugging if configure makes a mistake.
It was created by configure, which was
generated by GNU Autoconf 2.65. Invocation command line was
$ ./configure --disable-option-checking --prefix=/usr/local --with-sdl --with-sdl-gl --with-sdl-gfx --with-sdl-sound --with-caps --with-gayle --enable-drvsnd --enable-amax --enable-cd32 --enable-scsi-device --disable-jit --cache-file=/dev/null --srcdir=.
$ ./configure --disable-option-checking --prefix=/usr/local --with-sdl --with-sdl-gl --with-sdl-gfx --with-sdl-sound --with-caps --with-gayle --enable-drvsnd --enable-amax --enable-cd32 --enable-scsi-device --cache-file=/dev/null --srcdir=.
## --------- ##
## Platform. ##
......@@ -445,7 +445,7 @@ configure:4344: $? = 0
configure:4344: result: yes
configure:4350: checking for _doprnt
configure:4350: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5
/tmp/cclXBtVj.o: In function `main':
/tmp/ccKkOe2m.o: In function `main':
/home/gnostic/puaex/src/tools/conftest.c:67: undefined reference to `_doprnt'
collect2: ld returned 1 exit status
configure:4350: $? = 1
......@@ -533,7 +533,7 @@ configure:4364: $? = 0
configure:4364: result: yes
configure:4364: checking for strcmpi
configure:4364: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5
/tmp/cc5VqNdA.o: In function `main':
/tmp/ccZO2eLu.o: In function `main':
/home/gnostic/puaex/src/tools/conftest.c:69: undefined reference to `strcmpi'
collect2: ld returned 1 exit status
configure:4364: $? = 1
......@@ -613,7 +613,7 @@ configure: failed program was:
configure:4364: result: no
configure:4364: checking for stricmp
configure:4364: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5
/tmp/ccQPmvfF.o: In function `main':
/tmp/ccmHyUSz.o: In function `main':
/home/gnostic/puaex/src/tools/conftest.c:69: undefined reference to `stricmp'
collect2: ld returned 1 exit status
configure:4364: $? = 1
......
......@@ -438,7 +438,7 @@ $config_links
Report bugs to the package provider."
ac_cs_config="'--disable-option-checking' '--prefix=/usr/local' '--with-sdl' '--with-sdl-gl' '--with-sdl-gfx' '--with-sdl-sound' '--with-caps' '--with-gayle' '--enable-drvsnd' '--enable-amax' '--enable-cd32' '--enable-scsi-device' '--disable-jit' '--cache-file=/dev/null' '--srcdir=.'"
ac_cs_config="'--disable-option-checking' '--prefix=/usr/local' '--with-sdl' '--with-sdl-gl' '--with-sdl-gfx' '--with-sdl-sound' '--with-caps' '--with-gayle' '--enable-drvsnd' '--enable-amax' '--enable-cd32' '--enable-scsi-device' '--cache-file=/dev/null' '--srcdir=.'"
ac_cs_version="\
config.status
configured by ./configure, generated by GNU Autoconf 2.65,
......@@ -522,7 +522,7 @@ if $ac_cs_silent; then
fi
if $ac_cs_recheck; then
set X '/bin/bash' './configure' '--disable-option-checking' '--prefix=/usr/local' '--with-sdl' '--with-sdl-gl' '--with-sdl-gfx' '--with-sdl-sound' '--with-caps' '--with-gayle' '--enable-drvsnd' '--enable-amax' '--enable-cd32' '--enable-scsi-device' '--disable-jit' '--cache-file=/dev/null' '--srcdir=.' $ac_configure_extra_args --no-create --no-recursion
set X '/bin/bash' './configure' '--disable-option-checking' '--prefix=/usr/local' '--with-sdl' '--with-sdl-gl' '--with-sdl-gfx' '--with-sdl-sound' '--with-caps' '--with-gayle' '--enable-drvsnd' '--enable-amax' '--enable-cd32' '--enable-scsi-device' '--cache-file=/dev/null' '--srcdir=.' $ac_configure_extra_args --no-create --no-recursion
shift
$as_echo "running CONFIG_SHELL=/bin/bash $*" >&6
CONFIG_SHELL='/bin/bash'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment