First renames after merge

Renamed folders
Updated Makefile contents
Removed obsolete files/folders
This commit is contained in:
Dimitris Panokostas 2016-12-09 19:04:33 +01:00
parent 247acd0575
commit 348281d36a
72 changed files with 55 additions and 976 deletions

294
src/machdep/m68k.h Normal file
View file

@ -0,0 +1,294 @@
/*
* m68k.h - machine dependent bits
*
* Copyright (c) 2001-2004 Milan Jurik of ARAnyM dev team (see AUTHORS)
*
* Inspired by Christian Bauer's Basilisk II
*
* 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
*/
/*
* UAE - The Un*x Amiga Emulator
*
* MC68000 emulation - machine dependent bits
*
* Copyright 1996 Bernd Schmidt
* Copyright 2004-2005 Richard Drummond
*/
#if (defined(CPU_i386) && defined(X86_ASSEMBLY)) || (defined(CPU_x86_64) && defined(X86_64_ASSEMBLY))
/*
* Machine dependent structure for holding the 68k CCR flags
*/
struct flag_struct
{
unsigned int cznv;
unsigned int x;
};
/*
* The bits in the cznv field in the above structure are assigned to
* allow the easy mirroring of the x86 condition flags. (For example,
* from the AX register - the x86 overflow flag can be copied to AL
* with a setto %AL instr and the other flags copied to AH with an
* lahf instr).
*
* The 68k CZNV flags are thus assinged in cznv as:
*
* <--AL--> <--AH-->
* 76543210 FEDCBA98 --------- ---------
* xxxxxxxV NZxxxxxC xxxxxxxxx xxxxxxxxx
*/
#define FLAGBIT_N 15
#define FLAGBIT_Z 14
#define FLAGBIT_C 8
#define FLAGBIT_V 0
#define FLAGBIT_X 8
#define FLAGVAL_N (1 << FLAGBIT_N)
#define FLAGVAL_Z (1 << FLAGBIT_Z)
#define FLAGVAL_C (1 << FLAGBIT_C)
#define FLAGVAL_V (1 << FLAGBIT_V)
#define FLAGVAL_X (1 << FLAGBIT_X)
#define SET_ZFLG(y) (regs.ccrflags.cznv = (regs.ccrflags.cznv & ~FLAGVAL_Z) | (((y) ? 1 : 0) << FLAGBIT_Z))
#define SET_CFLG(y) (regs.ccrflags.cznv = (regs.ccrflags.cznv & ~FLAGVAL_C) | (((y) ? 1 : 0) << FLAGBIT_C))
#define SET_VFLG(y) (regs.ccrflags.cznv = (regs.ccrflags.cznv & ~FLAGVAL_V) | (((y) ? 1 : 0) << FLAGBIT_V))
#define SET_NFLG(y) (regs.ccrflags.cznv = (regs.ccrflags.cznv & ~FLAGVAL_N) | (((y) ? 1 : 0) << FLAGBIT_N))
#define SET_XFLG(y) (regs.ccrflags.x = ((y) ? 1 : 0) << FLAGBIT_X)
#define GET_ZFLG() ((regs.ccrflags.cznv >> FLAGBIT_Z) & 1)
#define GET_CFLG() ((regs.ccrflags.cznv >> FLAGBIT_C) & 1)
#define GET_VFLG() ((regs.ccrflags.cznv >> FLAGBIT_V) & 1)
#define GET_NFLG() ((regs.ccrflags.cznv >> FLAGBIT_N) & 1)
#define GET_XFLG() ((regs.ccrflags.x >> FLAGBIT_X) & 1)
#define CLEAR_CZNV() (regs.ccrflags.cznv = 0)
#define GET_CZNV() (regs.ccrflags.cznv)
#define IOR_CZNV(X) (regs.ccrflags.cznv |= (X))
#define SET_CZNV(X) (regs.ccrflags.cznv = (X))
#define COPY_CARRY() (regs.ccrflags.x = regs.ccrflags.cznv)
/*
* Test CCR condition
*/
STATIC_INLINE int cctrue (struct flag_struct &flags, int cc)
{
uae_u32 cznv = flags.cznv;
switch (cc)
{
case 0:
return 1; /* T */
case 1:
return 0; /* F */
case 2:
return (cznv & (FLAGVAL_C | FLAGVAL_Z)) == 0; /* !CFLG && !ZFLG HI */
case 3:
return (cznv & (FLAGVAL_C | FLAGVAL_Z)) != 0; /* CFLG || ZFLG LS */
case 4:
return (cznv & FLAGVAL_C) == 0; /* !CFLG CC */
case 5:
return (cznv & FLAGVAL_C) != 0; /* CFLG CS */
case 6:
return (cznv & FLAGVAL_Z) == 0; /* !ZFLG NE */
case 7:
return (cznv & FLAGVAL_Z) != 0; /* ZFLG EQ */
case 8:
return (cznv & FLAGVAL_V) == 0; /* !VFLG VC */
case 9:
return (cznv & FLAGVAL_V) != 0; /* VFLG VS */
case 10:
return (cznv & FLAGVAL_N) == 0; /* !NFLG PL */
case 11:
return (cznv & FLAGVAL_N) != 0; /* NFLG MI */
case 12:
return (((cznv << (FLAGBIT_N - FLAGBIT_V)) ^ cznv) & FLAGVAL_N) == 0; /* NFLG == VFLG GE */
case 13:
return (((cznv << (FLAGBIT_N - FLAGBIT_V)) ^ cznv) & FLAGVAL_N) != 0; /* NFLG != VFLG LT */
case 14:
cznv &= (FLAGVAL_N | FLAGVAL_Z | FLAGVAL_V); /* ZFLG && (NFLG == VFLG) GT */
return (((cznv << (FLAGBIT_N - FLAGBIT_V)) ^ cznv) & (FLAGVAL_N | FLAGVAL_Z)) == 0;
case 15:
cznv &= (FLAGVAL_N | FLAGVAL_Z | FLAGVAL_V); /* ZFLG && (NFLG != VFLG) LE */
return (((cznv << (FLAGBIT_N - FLAGBIT_V)) ^ cznv) & (FLAGVAL_N | FLAGVAL_Z)) != 0;
}
return 0;
}
#elif defined(CPU_arm) && defined(ARMV6_ASSEMBLY)
struct flag_struct
{
uae_u32 nzcv;
uae_u32 x;
};
#define FLAGVAL_Q 0x08000000
#define FLAGVAL_V 0x10000000
#define FLAGVAL_C 0x20000000
#define FLAGVAL_Z 0x40000000
#define FLAGVAL_N 0x80000000
#define SET_NFLG(y) (regs.ccrflags.nzcv = (regs.ccrflags.nzcv & ~0x80000000) | (((y) ? 1 : 0) << 31))
#define SET_ZFLG(y) (regs.ccrflags.nzcv = (regs.ccrflags.nzcv & ~0x40000000) | (((y) ? 1 : 0) << 30))
#define SET_CFLG(y) (regs.ccrflags.nzcv = (regs.ccrflags.nzcv & ~0x20000000) | (((y) ? 1 : 0) << 29))
#define SET_VFLG(y) (regs.ccrflags.nzcv = (regs.ccrflags.nzcv & ~0x10000000) | (((y) ? 1 : 0) << 28))
#define SET_XFLG(y) (regs.ccrflags.x = ((y) ? 1 : 0))
#define GET_NFLG() ((regs.ccrflags.nzcv >> 31) & 1)
#define GET_ZFLG() ((regs.ccrflags.nzcv >> 30) & 1)
#define GET_CFLG() ((regs.ccrflags.nzcv >> 29) & 1)
#define GET_VFLG() ((regs.ccrflags.nzcv >> 28) & 1)
#define GET_XFLG() (regs.ccrflags.x & 1)
#define CLEAR_CZNV() (regs.ccrflags.nzcv = 0)
#define GET_CZNV() (regs.ccrflags.nzcv)
#define IOR_CZNV(X) (regs.ccrflags.nzcv |= (X))
#define SET_CZNV(X) (regs.ccrflags.nzcv = (X))
#define COPY_CARRY() (regs.ccrflags.x = ((regs.ccrflags.nzcv >> 29) & 1))
STATIC_INLINE int cctrue(struct flag_struct &flags, int cc)
{
unsigned int nzcv = flags.nzcv;
switch(cc)
{
case 0:
return 1; /* T */
case 1:
return 0; /* F */
case 2:
return (nzcv & 0x60000000) == 0; /* !GET_CFLG && !GET_ZFLG; HI */
case 3:
return (nzcv & 0x60000000) != 0; /* GET_CFLG || GET_ZFLG; LS */
case 4:
return (nzcv & 0x20000000) == 0; /* !GET_CFLG; CC */
case 5:
return (nzcv & 0x20000000) != 0; /* GET_CFLG; CS */
case 6:
return (nzcv & 0x40000000) == 0; /* !GET_ZFLG; NE */
case 7:
return (nzcv & 0x40000000) != 0; /* GET_ZFLG; EQ */
case 8:
return (nzcv & 0x10000000) == 0; /* !GET_VFLG; VC */
case 9:
return (nzcv & 0x10000000) != 0; /* GET_VFLG; VS */
case 10:
return (nzcv & 0x80000000) == 0; /* !GET_NFLG; PL */
case 11:
return (nzcv & 0x80000000) != 0; /* GET_NFLG; MI */
case 12:
return (((nzcv << 3) ^ nzcv) & 0x80000000) == 0; /* GET_NFLG == GET_VFLG; GE */
case 13:
return (((nzcv << 3) ^ nzcv) & 0x80000000) != 0; /* GET_NFLG != GET_VFLG; LT */
case 14:
nzcv &= 0xd0000000;
return (((nzcv << 3) ^ nzcv) & 0xc0000000) == 0; /* !GET_ZFLG && (GET_NFLG == GET_VFLG); GT */
case 15:
nzcv &= 0xd0000000;
return (((nzcv << 3) ^ nzcv) & 0xc0000000) != 0; /* GET_ZFLG || (GET_NFLG != GET_VFLG); LE */
}
return 0;
}
#else
struct flag_struct
{
unsigned int c;
unsigned int z;
unsigned int n;
unsigned int v;
unsigned int x;
};
#define ZFLG (regs.ccrflags.z)
#define NFLG (regs.ccrflags.n)
#define CFLG (regs.ccrflags.c)
#define VFLG (regs.ccrflags.v)
#define XFLG (regs.ccrflags.x)
#define SET_CFLG(x) (CFLG = (x))
#define SET_NFLG(x) (NFLG = (x))
#define SET_VFLG(x) (VFLG = (x))
#define SET_ZFLG(x) (ZFLG = (x))
#define SET_XFLG(x) (XFLG = (x))
#define GET_CFLG() CFLG
#define GET_NFLG() NFLG
#define GET_VFLG() VFLG
#define GET_ZFLG() ZFLG
#define GET_XFLG() XFLG
#define CLEAR_CZNV() do { \
SET_CFLG (0); \
SET_ZFLG (0); \
SET_NFLG (0); \
SET_VFLG (0); \
} while (0)
#define COPY_CARRY() (regs.ccrflags.x = regs.ccrflags.c)
STATIC_INLINE int cctrue(struct flag_struct &flags, const int cc)
{
switch(cc)
{
case 0:
return 1; /* T */
case 1:
return 0; /* F */
case 2:
return !CFLG && !ZFLG; /* HI */
case 3:
return CFLG || ZFLG; /* LS */
case 4:
return !CFLG; /* CC */
case 5:
return CFLG; /* CS */
case 6:
return !ZFLG; /* NE */
case 7:
return ZFLG; /* EQ */
case 8:
return !VFLG; /* VC */
case 9:
return VFLG; /* VS */
case 10:
return !NFLG; /* PL */
case 11:
return NFLG; /* MI */
case 12:
return NFLG == VFLG; /* GE */
case 13:
return NFLG != VFLG; /* LT */
case 14:
return !ZFLG && (NFLG == VFLG); /* GT */
case 15:
return ZFLG || (NFLG != VFLG); /* LE */
}
return 0;
}
#endif

109
src/machdep/maccess.h Normal file
View file

@ -0,0 +1,109 @@
/*
* UAE - The Un*x Amiga Emulator
*
* Memory access functions
*
* Copyright 1996 Bernd Schmidt
*/
#ifndef MACCESS_UAE_H
#define MACCESS_UAE_H
#ifdef ARMV6_ASSEMBLY
STATIC_INLINE uae_u16 do_get_mem_word(uae_u16 *_GCCRES_ a)
{
uae_u16 v;
__asm__ (
"ldrh %[v], [%[a]] \n\t"
"rev16 %[v], %[v] \n\t"
: [v] "=r" (v) : [a] "r" (a) );
return v;
}
#else
STATIC_INLINE uae_u16 do_get_mem_word(uae_u16 *_GCCRES_ a)
{
uae_u8 *b = (uae_u8 *)a;
return (*b << 8) | (*(b+1));
}
#endif
#ifdef ARMV6_ASSEMBLY
STATIC_INLINE uae_u32 do_get_mem_long(uae_u32 *a)
{
uae_u32 v;
__asm__ (
"ldr %[v], [%[a]] \n\t"
"rev %[v], %[v] \n\t"
: [v] "=r" (v) : [a] "r" (a) );
return v;
}
#else
STATIC_INLINE uae_u32 do_get_mem_long(uae_u32 *_GCCRES_ a)
{
uae_u8 *b = (uae_u8 *)a;
return (*b << 24) | (*(b+1) << 16) | (*(b+2) << 8) | (*(b+3));
}
#endif
STATIC_INLINE uae_u8 do_get_mem_byte(uae_u8 *_GCCRES_ a)
{
return *a;
}
#ifdef ARMV6_ASSEMBLY
STATIC_INLINE void do_put_mem_word(uae_u16 *_GCCRES_ a, uae_u16 v)
{
__asm__ (
"rev16 r2, %[v] \n\t"
"strh r2, [%[a]] \n\t"
: : [v] "r" (v), [a] "r" (a) : "r2", "memory" );
}
#else
STATIC_INLINE void do_put_mem_word(uae_u16 *_GCCRES_ a, uae_u16 v)
{
uae_u8 *b = (uae_u8 *)a;
*b = v >> 8;
*(b+1) = v;
}
#endif
#ifdef ARMV6_ASSEMBLY
STATIC_INLINE void do_put_mem_long(uae_u32 *_GCCRES_ a, uae_u32 v)
{
__asm__ (
"rev r2, %[v] \n\t"
"str r2, [%[a]] \n\t"
: : [v] "r" (v), [a] "r" (a) : "r2", "memory" );
}
#else
STATIC_INLINE void do_put_mem_long(uae_u32 *_GCCRES_ a, uae_u32 v)
{
uae_u8 *b = (uae_u8 *)a;
*b = v >> 24;
*(b+1) = v >> 16;
*(b+2) = v >> 8;
*(b+3) = v;
}
#endif
STATIC_INLINE void do_put_mem_byte(uae_u8 *_GCCRES_ a, uae_u8 v)
{
*a = v;
}
#define call_mem_get_func(func, addr) ((*func)(addr))
#define call_mem_put_func(func, addr, v) ((*func)(addr, v))
#undef MD_HAVE_MEM_1_FUNCS
#define ALIGN_POINTER_TO32(p) ((~(unsigned long)(p)) & 3)
#endif

131
src/machdep/md-fpp.h Normal file
View file

@ -0,0 +1,131 @@
/*
* UAE - The Un*x Amiga Emulator
*
* MC68881 emulation
* Support functions for IEEE 754-compatible host CPUs.
* These functions use a GCC extension (type punning through unions) and
* should only be compiled with compilers that support this.
*
* Copyright 1999 Sam Jordan
* Copyright 2007 Richard Drummond
*/
#define FPCR_ROUNDING_MODE 0x00000030
#define FPCR_ROUND_NEAR 0x00000000
#define FPCR_ROUND_ZERO 0x00000010
#define FPCR_ROUND_MINF 0x00000020
#define FPCR_ROUND_PINF 0x00000030
#define FPCR_ROUNDING_PRECISION 0x000000c0
#define FPCR_PRECISION_SINGLE 0x00000040
#define FPCR_PRECISION_DOUBLE 0x00000080
#define FPCR_PRECISION_EXTENDED 0x00000000
STATIC_INLINE void exten_zeronormalize(uae_u32 *pwrd1, uae_u32 *pwrd2, uae_u32 *pwrd3)
{
uae_u32 wrd1 = *pwrd1;
uae_u32 wrd2 = *pwrd2;
uae_u32 wrd3 = *pwrd3;
int exp = (wrd1 >> 16) & 0x7fff;
// Force zero if mantissa is zero but exponent is non-zero
// M68k FPU automatically convert them to plain zeros.
// x86 FPU considers them invalid values
if (exp != 0 && exp != 0x7fff && !wrd2 && !wrd3) {
*pwrd1 = (wrd1 & 0x80000000);
}
}
STATIC_INLINE double to_single (uae_u32 value)
{
union {
float f;
uae_u32 u;
} val;
val.u = value;
return val.f;
}
STATIC_INLINE uae_u32 from_single (double src)
{
union {
float f;
uae_u32 u;
} val;
val.f = (float) src;
return val.u;
}
STATIC_INLINE double to_double (uae_u32 wrd1, uae_u32 wrd2)
{
union {
double d;
uae_u32 u[2];
} val;
val.u[0] = wrd2; // little endian
val.u[1] = wrd1;
return val.d;
}
STATIC_INLINE void from_double (double src, uae_u32 * wrd1, uae_u32 * wrd2)
{
uae_u32 *longarray = (uae_u32 *)&src;
*wrd1 = longarray[1]; // little endian
*wrd2 = longarray[0];
}
static const double twoto32 = 4294967296.0;
STATIC_INLINE void to_exten(fpdata *fpd, uae_u32 wrd1, uae_u32 wrd2, uae_u32 wrd3)
{
double frac;
exten_zeronormalize(&wrd1, &wrd2, &wrd3);
if ((wrd1 & 0x7fff0000) == 0 && wrd2 == 0 && wrd3 == 0) {
fpd->fp = (wrd1 & 0x80000000) ? -0.0 : +0.0;
return;
}
frac = ((double)wrd2 + ((double)wrd3 / twoto32)) / 2147483648.0;
if (wrd1 & 0x80000000)
frac = -frac;
fpd->fp = ldexp (frac, ((wrd1 >> 16) & 0x7fff) - 16383);
}
STATIC_INLINE void from_exten(fpdata *fpd, uae_u32 * wrd1, uae_u32 * wrd2, uae_u32 * wrd3)
{
int expon;
double frac;
fptype v;
v = fpd->fp;
if (v == 0.0) {
*wrd1 = signbit(v) ? 0x80000000 : 0;
*wrd2 = 0;
*wrd3 = 0;
return;
}
if (v < 0) {
*wrd1 = 0x80000000;
v = -v;
} else {
*wrd1 = 0;
}
frac = frexp (v, &expon);
frac += 0.5 / (twoto32 * twoto32);
if (frac >= 1.0) {
frac /= 2.0;
expon++;
}
*wrd1 |= (((expon + 16383 - 1) & 0x7fff) << 16);
*wrd2 = (uae_u32) (frac * twoto32);
*wrd3 = (uae_u32) ((frac * twoto32 - *wrd2) * twoto32);
}
#define HAVE_from_double
#define HAVE_to_double
#define HAVE_from_exten
#define HAVE_to_exten
#define HAVE_from_single
#define HAVE_to_single

41
src/machdep/rpt.h Normal file
View file

@ -0,0 +1,41 @@
/*
* UAE - The Un*x Amiga Emulator
*
* Definitions for accessing cycle counters on a given machine, if possible.
*
* Copyright 1998 Bernd Schmidt
*/
#ifndef _RPT_H_
#define _RPT_H_
typedef unsigned long frame_time_t;
extern int64_t g_uae_epoch;
/* Returns elapsed time in microseconds since start of emulator. */
static __inline__ frame_time_t read_processor_time (void)
{
int64_t time;
struct timespec ts;
clock_gettime (CLOCK_MONOTONIC, &ts);
time = (((int64_t) ts.tv_sec) * 1000000) + (ts.tv_nsec / 1000);
return time - g_uae_epoch;
}
static __inline__ int64_t read_processor_time_ns (void)
{
int64_t time;
struct timespec ts;
clock_gettime (CLOCK_MONOTONIC, &ts);
time = (((int64_t) ts.tv_sec) * 1000000 * 1000) + (ts.tv_nsec);
return time;
}
#endif /* _RPT_H_ */

35
src/machdep/support.cpp Normal file
View file

@ -0,0 +1,35 @@
#include "config.h"
#include "sysconfig.h"
#include <stdlib.h>
#include <stdarg.h>
#include <signal.h>
#include "sysdeps.h"
#include "options.h"
#include "memory.h"
#include "newcpu.h"
#include "custom.h"
extern int screen_is_picasso;
int64_t g_uae_epoch = 0;
int machdep_init (void)
{
picasso_requested_on = 0;
picasso_on = 0;
screen_is_picasso = 0;
// Initialize timebase
g_uae_epoch = read_processor_time();
syncbase = 1000000; // Microseconds
return 1;
}
void machdep_free (void)
{
}