mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-06-16 15:29:32 +00:00
Remove real 68k support
This commit is contained in:
parent
06747d4a7b
commit
7e845b6ea2
|
@ -2924,10 +2924,6 @@ static bool sigsegv_do_install_handler(int sig)
|
|||
sigemptyset(&sigsegv_sa.sa_mask);
|
||||
sigsegv_sa.sa_handler = (signal_handler)sigsegv_handler;
|
||||
sigsegv_sa.sa_flags = 0;
|
||||
#if !EMULATED_68K && defined(__NetBSD__)
|
||||
sigaddset(&sigsegv_sa.sa_mask, SIGALRM);
|
||||
sigsegv_sa.sa_flags |= SA_ONSTACK;
|
||||
#endif
|
||||
return (sigaction(sig, &sigsegv_sa, 0) == 0);
|
||||
#else
|
||||
return (signal(sig, (signal_handler)sigsegv_handler) != SIG_ERR);
|
||||
|
|
|
@ -516,14 +516,13 @@ static Screen_blit_func_info Screen_blitters[] = {
|
|||
// Initialize the framebuffer update function
|
||||
// Returns FALSE, if the function was to be reduced to a simple memcpy()
|
||||
// --> In that case, VOSF is not necessary
|
||||
bool Screen_blitter_init(VisualFormat const & visual_format, bool native_byte_order, int mac_depth)
|
||||
{
|
||||
bool Screen_blitter_init(VisualFormat const & visual_format, bool native_byte_order, int mac_depth){
|
||||
#if USE_SDL_VIDEO
|
||||
const bool use_sdl_video = true;
|
||||
#else
|
||||
const bool use_sdl_video = false;
|
||||
#endif
|
||||
#if REAL_ADDRESSING || DIRECT_ADDRESSING || USE_SDL_VIDEO
|
||||
#if DIRECT_ADDRESSING || USE_SDL_VIDEO
|
||||
if (mac_depth == 1 && !use_sdl_video && !visual_format.fullscreen) {
|
||||
|
||||
// Windowed 1-bit mode uses a 1-bit X image, so there's no need for special blitting routines
|
||||
|
|
|
@ -535,14 +535,12 @@ static void update_display_window_vosf(VIDEO_DRV_WIN_INIT)
|
|||
|
||||
/*
|
||||
* Update display for DGA mode and VOSF
|
||||
* (only in Real or Direct Addressing mode)
|
||||
* (only in Direct Addressing mode)
|
||||
*/
|
||||
|
||||
#ifndef TEST_VOSF_PERFORMANCE
|
||||
#if REAL_ADDRESSING || DIRECT_ADDRESSING
|
||||
|
||||
static void update_display_dga_vosf(VIDEO_DRV_DGA_INIT)
|
||||
{
|
||||
#if DIRECT_ADDRESSING
|
||||
static void update_display_dga_vosf(VIDEO_DRV_DGA_INIT){
|
||||
VIDEO_MODE_INIT;
|
||||
|
||||
// Compute number of bytes per row, take care to virtual screens
|
||||
|
|
|
@ -763,7 +763,7 @@ shouldProceedAfterError: (NSDictionary *) errorDict
|
|||
cpu = PrefsFindInt32("cpu");
|
||||
val = PrefsFindInt32("modelid");
|
||||
|
||||
#if REAL_ADDRESSING || DIRECT_ADDRESSING
|
||||
#if DIRECT_ADDRESSING
|
||||
puts("Current memory model does not support 24bit addressing");
|
||||
if ( val == [classic tag] )
|
||||
{
|
||||
|
|
|
@ -31,9 +31,6 @@
|
|||
/* Define if using "mon". */
|
||||
/* #undef ENABLE_MON */
|
||||
|
||||
/* Define if using native 68k mode. */
|
||||
/* #undef ENABLE_NATIVE_M68K */
|
||||
|
||||
/* Define to 1 if translation of program messages to the user's native
|
||||
language is requested. */
|
||||
/* #undef ENABLE_NLS */
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
# include <pthread.h>
|
||||
#endif
|
||||
|
||||
#if REAL_ADDRESSING || DIRECT_ADDRESSING
|
||||
#if DIRECT_ADDRESSING
|
||||
# include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
|
@ -107,11 +107,6 @@ static struct sigaction sigint_sa; // sigaction for SIGINT handler
|
|||
static void sigint_handler(...);
|
||||
#endif
|
||||
|
||||
#if REAL_ADDRESSING
|
||||
static bool lm_area_mapped = false; // Flag: Low Memory area mmap()ped
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Helpers to map memory that can be accessed from the Mac side
|
||||
*/
|
||||
|
@ -334,58 +329,14 @@ bool InitEmulator (void)
|
|||
if (RAMSize > 1023*1024*1024) // Cap to 1023MB (APD crashes at 1GB)
|
||||
RAMSize = 1023*1024*1024;
|
||||
|
||||
#if REAL_ADDRESSING || DIRECT_ADDRESSING
|
||||
#if DIRECT_ADDRESSING
|
||||
RAMSize = RAMSize & -getpagesize(); // Round down to page boundary
|
||||
#endif
|
||||
|
||||
// Initialize VM system
|
||||
vm_init();
|
||||
|
||||
#if REAL_ADDRESSING
|
||||
// Flag: RAM and ROM are contigously allocated from address 0
|
||||
bool memory_mapped_from_zero = false;
|
||||
|
||||
// Make sure to map RAM & ROM at address 0 only on platforms that
|
||||
// supports linker scripts to relocate the Basilisk II executable
|
||||
// above 0x70000000
|
||||
#if HAVE_LINKER_SCRIPT
|
||||
const bool can_map_all_memory = true;
|
||||
#else
|
||||
const bool can_map_all_memory = false;
|
||||
#endif
|
||||
|
||||
// Try to allocate all memory from 0x0000, if it is not known to crash
|
||||
if (can_map_all_memory && (vm_acquire_mac_fixed(0, RAMSize + 0x100000) == 0)) {
|
||||
D(bug("Could allocate RAM and ROM from 0x0000\n"));
|
||||
memory_mapped_from_zero = true;
|
||||
}
|
||||
|
||||
#ifndef PAGEZERO_HACK
|
||||
// Otherwise, just create the Low Memory area (0x0000..0x2000)
|
||||
else if (vm_acquire_mac_fixed(0, 0x2000) == 0) {
|
||||
D(bug("Could allocate the Low Memory globals\n"));
|
||||
lm_area_mapped = true;
|
||||
}
|
||||
|
||||
// Exit on failure
|
||||
else {
|
||||
sprintf(str, GetString(STR_LOW_MEM_MMAP_ERR), strerror(errno));
|
||||
ErrorAlert(str);
|
||||
QuitEmulator();
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
*str = 0; // Eliminate unused variable warning
|
||||
#endif /* REAL_ADDRESSING */
|
||||
|
||||
// Create areas for Mac RAM and ROM
|
||||
#if REAL_ADDRESSING
|
||||
if (memory_mapped_from_zero) {
|
||||
RAMBaseHost = (uint8 *)0;
|
||||
ROMBaseHost = RAMBaseHost + RAMSize;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
uint8 *ram_rom_area = (uint8 *)vm_acquire_mac(RAMSize + 0x100000);
|
||||
if (ram_rom_area == VM_MAP_FAILED) {
|
||||
|
@ -411,10 +362,6 @@ bool InitEmulator (void)
|
|||
MEMBaseDiff = (uintptr)RAMBaseHost;
|
||||
RAMBaseMac = 0;
|
||||
ROMBaseMac = Host2MacAddr(ROMBaseHost);
|
||||
#endif
|
||||
#if REAL_ADDRESSING
|
||||
RAMBaseMac = Host2MacAddr(RAMBaseHost);
|
||||
ROMBaseMac = Host2MacAddr(ROMBaseHost);
|
||||
#endif
|
||||
D(bug("Mac RAM starts at %p (%08x)\n", RAMBaseHost, RAMBaseMac));
|
||||
D(bug("Mac ROM starts at %p (%08x)\n", ROMBaseHost, ROMBaseMac));
|
||||
|
@ -498,12 +445,6 @@ void QuitEmuNoExit()
|
|||
}
|
||||
#endif
|
||||
|
||||
#if REAL_ADDRESSING
|
||||
// Delete Low Memory area
|
||||
if (lm_area_mapped)
|
||||
vm_release(0, 0x2000);
|
||||
#endif
|
||||
|
||||
// Exit VM wrappers
|
||||
vm_exit();
|
||||
|
||||
|
|
|
@ -409,7 +409,7 @@ OSX_monitor :: OSX_monitor (const vector<video_mode> &available_modes,
|
|||
void
|
||||
OSX_monitor::set_mac_frame_buffer(const video_mode mode)
|
||||
{
|
||||
#if !REAL_ADDRESSING && !DIRECT_ADDRESSING
|
||||
#if !DIRECT_ADDRESSING
|
||||
set_mac_frame_base(MacFrameBaseMac);
|
||||
|
||||
// Set variables used by UAE memory banking
|
||||
|
|
|
@ -61,11 +61,10 @@ dnl Addressing modes.
|
|||
AC_ARG_ENABLE(addressing,
|
||||
[ --enable-addressing=AM specify the addressing mode to use [default=fastest]],
|
||||
[ case "$enableval" in
|
||||
real) ADDRESSING_TEST_ORDER="real";;
|
||||
direct) ADDRESSING_TEST_ORDER="direct";;
|
||||
banks) ADDRESSING_TEST_ORDER="banks";;
|
||||
fastest)ADDRESSING_TEST_ORDER="direct banks";;
|
||||
*) AC_MSG_ERROR([--enable-addressing takes only one of the following values: fastest, real, direct, banks]);;
|
||||
*) AC_MSG_ERROR([--enable-addressing takes only one of the following values: fastest, direct, banks]);;
|
||||
esac
|
||||
],
|
||||
[ ADDRESSING_TEST_ORDER="direct banks"
|
||||
|
@ -127,11 +126,6 @@ if [[ "x$BII_CROSS_MPROTECT_WORKS" = "x" ]]; then
|
|||
BII_CROSS_MPROTECT_WORKS="guessing no"
|
||||
fi
|
||||
|
||||
AC_ARG_VAR(BII_CROSS_MAP_LOW_AREA, [ Whether the target system can map 0x2000 bytes from 0x0000 [default=guessing no]])
|
||||
if [[ "x$BII_CROSS_MAP_LOW_AREA" = "x" ]]; then
|
||||
BII_CROSS_MAP_LOW_AREA="guessing no"
|
||||
fi
|
||||
|
||||
AC_ARG_VAR(BII_CROSS_SIGNAL_NEED_REINSTALL, [ Whether the target system needs signal handlers to be reinstalled [default=guessing yes]])
|
||||
if [[ "x$BII_CROSS_SIGNAL_NEED_REINSTALL" = "x" ]]; then
|
||||
BII_CROSS_SIGNAL_NEED_REINSTALL="guessing yes"
|
||||
|
@ -189,13 +183,11 @@ DEFINES="$DEFINES -DOS_$OS_TYPE"
|
|||
|
||||
dnl Target CPU type.
|
||||
HAVE_I386=no
|
||||
HAVE_M68K=no
|
||||
HAVE_SPARC=no
|
||||
HAVE_POWERPC=no
|
||||
HAVE_X86_64=no
|
||||
case "$target_cpu" in
|
||||
i386* | i486* | i586* | i686* | i786* ) HAVE_I386=yes;;
|
||||
m68k* ) HAVE_M68K=yes;;
|
||||
sparc* ) HAVE_SPARC=yes;;
|
||||
powerpc* ) HAVE_POWERPC=yes;;
|
||||
x86_64* | amd64* ) HAVE_X86_64=yes;;
|
||||
|
@ -735,7 +727,6 @@ SCSISRC=../dummy/scsi_dummy.cpp
|
|||
AUDIOSRC=../dummy/audio_dummy.cpp
|
||||
EXTFSSRC=extfs_unix.cpp
|
||||
EXTRASYSSRCS=
|
||||
CAN_NATIVE_M68K=no
|
||||
case "$target_os" in
|
||||
linux*)
|
||||
ETHERSRC=ether_unix.cpp
|
||||
|
@ -766,7 +757,6 @@ freebsd*)
|
|||
fi
|
||||
;;
|
||||
netbsd*)
|
||||
CAN_NATIVE_M68K=yes
|
||||
ETHERSRC=ether_unix.cpp
|
||||
;;
|
||||
solaris*)
|
||||
|
@ -916,14 +906,6 @@ if [[ "x$have_libvhd" = "xyes" ]]; then
|
|||
EXTRASYSSRCS="$EXTRASYSSRCS vhd_unix.cpp"
|
||||
fi
|
||||
|
||||
|
||||
dnl Use 68k CPU natively?
|
||||
WANT_NATIVE_M68K=no
|
||||
if [[ "x$HAVE_M68K" = "xyes" -a "x$CAN_NATIVE_M68K" = "xyes" ]]; then
|
||||
AC_DEFINE(ENABLE_NATIVE_M68K, 1, [Define if using native 68k mode.])
|
||||
WANT_NATIVE_M68K=yes
|
||||
fi
|
||||
|
||||
if [[ "x$HAVE_PTHREADS" = "xno" ]]; then
|
||||
dnl Serial, ethernet and audio support needs pthreads
|
||||
AC_MSG_WARN([You don't have pthreads, disabling serial, ethernet and audio support.])
|
||||
|
@ -1116,42 +1098,6 @@ AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm",
|
|||
|
||||
fi dnl HAVE_MMAP_VM
|
||||
|
||||
dnl Check if we can modify the __PAGEZERO segment for use as Low Memory
|
||||
AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x2000],
|
||||
ac_cv_pagezero_hack, [
|
||||
ac_cv_pagezero_hack=no
|
||||
if AC_TRY_COMMAND([Darwin/testlmem.sh 0x2000]); then
|
||||
ac_cv_pagezero_hack=yes
|
||||
dnl might as well skip the test for mmap-able low memory
|
||||
ac_cv_can_map_lm=no
|
||||
fi
|
||||
])
|
||||
AC_TRANSLATE_DEFINE(PAGEZERO_HACK, "$ac_cv_pagezero_hack",
|
||||
[Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this system.])
|
||||
|
||||
dnl Check if we can mmap 0x2000 bytes from 0x0000
|
||||
AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x2000],
|
||||
ac_cv_can_map_lm, [
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
AC_TRY_RUN([
|
||||
#include "../CrossPlatform/vm_alloc.cpp"
|
||||
int main(void) { /* returns 0 if we could map the lowmem globals */
|
||||
volatile char * lm = 0;
|
||||
if (vm_init() < 0) exit(1);
|
||||
if (vm_acquire_fixed(0, 0x2000) < 0) exit(1);
|
||||
lm[0] = 'z';
|
||||
if (vm_release((char *)lm, 0x2000) < 0) exit(1);
|
||||
vm_exit(); exit(0);
|
||||
}
|
||||
], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no,
|
||||
dnl When cross-compiling, do not assume anything.
|
||||
ac_cv_can_map_lm="$BII_CROSS_MAP_LOW_AREA"
|
||||
)
|
||||
AC_LANG_RESTORE
|
||||
]
|
||||
)
|
||||
|
||||
dnl Check signal handlers need to be reinstalled
|
||||
AC_CACHE_CHECK([whether signal handlers need to be reinstalled],
|
||||
ac_cv_signal_need_reinstall, [
|
||||
|
@ -1417,32 +1363,10 @@ AC_TRANSLATE_DEFINE(HAVE_LINKER_SCRIPT, "$ac_cv_linker_script_works",
|
|||
[Define if there is a linker script to relocate the executable above 0x70000000.])
|
||||
|
||||
dnl Determine the addressing mode to use
|
||||
if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
|
||||
ADDRESSING_MODE="real"
|
||||
else
|
||||
ADDRESSING_MODE=""
|
||||
AC_MSG_CHECKING([for the addressing mode to use])
|
||||
for am in $ADDRESSING_TEST_ORDER; do
|
||||
case $am in
|
||||
real)
|
||||
dnl Requires ability to mmap() Low Memory globals
|
||||
if [[ "x$ac_cv_can_map_lm$ac_cv_pagezero_hack" = "xnono" ]]; then
|
||||
continue
|
||||
fi
|
||||
dnl Requires VOSF screen updates
|
||||
if [[ "x$CAN_VOSF" = "xno" ]]; then
|
||||
continue
|
||||
fi
|
||||
dnl Real addressing will probably work.
|
||||
ADDRESSING_MODE="real"
|
||||
WANT_VOSF=yes dnl we can use VOSF and we need it actually
|
||||
DEFINES="$DEFINES -DREAL_ADDRESSING"
|
||||
if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then
|
||||
BLESS=Darwin/lowmem
|
||||
LDFLAGS="$LDFLAGS -pagezero_size 0x2000"
|
||||
fi
|
||||
break
|
||||
;;
|
||||
direct)
|
||||
dnl Requires VOSF screen updates
|
||||
if [[ "x$CAN_VOSF" = "xyes" ]]; then
|
||||
|
@ -1466,7 +1390,6 @@ else
|
|||
AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER])
|
||||
ADDRESSING_MODE="memory banks"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Banked Memory Addressing mode is not supported by the JIT compiler
|
||||
if [[ "x$WANT_JIT" = "xyes" -a "x$ADDRESSING_MODE" = "xmemory banks" ]]; then
|
||||
|
@ -1645,10 +1568,6 @@ elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xy
|
|||
esac
|
||||
;;
|
||||
esac
|
||||
elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
|
||||
dnl Native m68k, no emulation
|
||||
CPUINCLUDES="-I../native_cpu"
|
||||
CPUSRCS="asm_support.s"
|
||||
fi
|
||||
|
||||
dnl Enable JIT compiler, if possible.
|
||||
|
@ -1866,11 +1785,9 @@ dnl Check for certain math functions
|
|||
AC_CHECK_FUNCS(atanh)
|
||||
AC_CHECK_FUNCS(isnan isinf finite isnormal signbit)
|
||||
|
||||
dnl UAE CPU sources for all non-m68k-native architectures.
|
||||
if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then
|
||||
CPUINCLUDES="-I../uae_cpu"
|
||||
CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS $JITSRCS"
|
||||
fi
|
||||
dnl UAE CPU sources for all architectures.
|
||||
CPUINCLUDES="-I../uae_cpu"
|
||||
CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS $JITSRCS"
|
||||
|
||||
dnl Or if we have -IPA (MIPSPro compilers)
|
||||
if [[ "x$HAVE_IPA" = "xyes" ]]; then
|
||||
|
@ -1908,7 +1825,6 @@ echo Enable video on SEGV signals ........... : $WANT_VOSF
|
|||
echo ESD sound support ...................... : $WANT_ESD
|
||||
echo GTK user interface ..................... : $WANT_GTK
|
||||
echo mon debugger support ................... : $WANT_MON
|
||||
echo Running m68k code natively ............. : $WANT_NATIVE_M68K
|
||||
echo Use JIT compiler ....................... : $WANT_JIT
|
||||
echo JIT debug mode ......................... : $WANT_JIT_DEBUG
|
||||
echo Floating-Point emulation core .......... : $FPE_CORE
|
||||
|
|
|
@ -39,24 +39,10 @@
|
|||
# include <pthread.h>
|
||||
#endif
|
||||
|
||||
#if REAL_ADDRESSING || DIRECT_ADDRESSING
|
||||
#if DIRECT_ADDRESSING
|
||||
# include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
#if !EMULATED_68K && defined(__NetBSD__)
|
||||
# include <m68k/sync_icache.h>
|
||||
# include <m68k/frame.h>
|
||||
# include <sys/param.h>
|
||||
# include <sys/sysctl.h>
|
||||
struct sigstate {
|
||||
int ss_flags;
|
||||
struct frame ss_frame;
|
||||
struct fpframe ss_fpstate;
|
||||
};
|
||||
# define SS_FPSTATE 0x02
|
||||
# define SS_USERREGS 0x04
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_GTK
|
||||
# include <gtk/gtk.h>
|
||||
# include <gdk/gdk.h>
|
||||
|
@ -109,26 +95,10 @@ extern void flush_icache_range(uint8 *start, uint32 size); // from compemu_suppo
|
|||
#define DEBUG 0
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
// Constants
|
||||
const char ROM_FILE_NAME[] = "ROM";
|
||||
#if !EMULATED_68K
|
||||
const int SIG_STACK_SIZE = SIGSTKSZ; // Size of signal stack
|
||||
#endif
|
||||
const int SCRATCH_MEM_SIZE = 0x10000; // Size of scratch memory area
|
||||
|
||||
|
||||
#if !EMULATED_68K
|
||||
// RAM and ROM pointers
|
||||
uint32 RAMBaseMac; // RAM base (Mac address space)
|
||||
uint8 *RAMBaseHost; // RAM base (host address space)
|
||||
uint32 RAMSize; // Size of RAM
|
||||
uint32 ROMBaseMac; // ROM base (Mac address space)
|
||||
uint8 *ROMBaseHost; // ROM base (host address space)
|
||||
uint32 ROMSize; // Size of ROM
|
||||
#endif
|
||||
|
||||
|
||||
// CPU and FPU type, addressing mode
|
||||
int CPUType;
|
||||
bool CPUIs68060;
|
||||
|
@ -148,10 +118,6 @@ X11_LOCK_TYPE x_display_lock = X11_LOCK_INIT; // X11 display lock
|
|||
static uint8 last_xpram[XPRAM_SIZE]; // Buffer for monitoring XPRAM changes
|
||||
|
||||
#ifdef HAVE_PTHREADS
|
||||
#if !EMULATED_68K
|
||||
static pthread_t emul_thread; // Handle of MacOS emulation thread (main thread)
|
||||
#endif
|
||||
|
||||
static bool xpram_thread_active = false; // Flag: XPRAM watchdog installed
|
||||
static volatile bool xpram_thread_cancel = false; // Flag: Cancel XPRAM thread
|
||||
static pthread_t xpram_thread; // XPRAM watchdog
|
||||
|
@ -172,14 +138,6 @@ static pthread_mutex_t intflag_lock = PTHREAD_MUTEX_INITIALIZER; // Mutex to pro
|
|||
|
||||
#endif
|
||||
|
||||
#if !EMULATED_68K
|
||||
#define SIG_IRQ SIGUSR1
|
||||
static struct sigaction sigirq_sa; // Virtual 68k interrupt signal
|
||||
static struct sigaction sigill_sa; // Illegal instruction
|
||||
static void *sig_stack = NULL; // Stack for signal handlers
|
||||
uint16 EmulatedSR; // Emulated bits of SR (supervisor bit and interrupt mask)
|
||||
#endif
|
||||
|
||||
#if USE_SCRATCHMEM_SUBTERFUGE
|
||||
uint8 *ScratchMem = NULL; // Scratch memory for Mac ROM writes
|
||||
#endif
|
||||
|
@ -198,10 +156,6 @@ static struct sigaction sigint_sa; // sigaction for SIGINT handler
|
|||
static void sigint_handler(...);
|
||||
#endif
|
||||
|
||||
#if REAL_ADDRESSING
|
||||
static bool lm_area_mapped = false; // Flag: Low Memory area mmap()ped
|
||||
#endif
|
||||
|
||||
static rpc_connection_t *gui_connection = NULL; // RPC connection to the GUI
|
||||
static const char *gui_connection_path = NULL; // GUI connection identifier
|
||||
|
||||
|
@ -210,11 +164,6 @@ static const char *gui_connection_path = NULL; // GUI connection identifier
|
|||
static void *xpram_func(void *arg);
|
||||
static void *tick_func(void *arg);
|
||||
static void one_tick(...);
|
||||
#if !EMULATED_68K
|
||||
static void sigirq_handler(int sig, int code, struct sigcontext *scp);
|
||||
static void sigill_handler(int sig, int code, struct sigcontext *scp);
|
||||
extern "C" void EmulOpTrampoline(void);
|
||||
#endif
|
||||
|
||||
// vde switch variable
|
||||
char* vde_sock;
|
||||
|
@ -292,7 +241,6 @@ static void sigsegv_dump_state(sigsegv_info_t *sip)
|
|||
if (fault_instruction != SIGSEGV_INVALID_ADDRESS)
|
||||
fprintf(stderr, " [IP=%p]", fault_instruction);
|
||||
fprintf(stderr, "\n");
|
||||
#if EMULATED_68K
|
||||
uaecptr nextpc;
|
||||
#ifdef UPDATE_UAE
|
||||
extern void m68k_dumpstate(FILE *, uaecptr *nextpc);
|
||||
|
@ -301,7 +249,6 @@ static void sigsegv_dump_state(sigsegv_info_t *sip)
|
|||
extern void m68k_dumpstate(uaecptr *nextpc);
|
||||
m68k_dumpstate(&nextpc);
|
||||
#endif
|
||||
#endif
|
||||
#if USE_JIT && JIT_DEBUG
|
||||
extern void compiler_dumpstate(void);
|
||||
compiler_dumpstate();
|
||||
|
@ -606,56 +553,14 @@ int main(int argc, char **argv)
|
|||
if (RAMSize > 1023*1024*1024) // Cap to 1023MB (APD crashes at 1GB)
|
||||
RAMSize = 1023*1024*1024;
|
||||
|
||||
#if REAL_ADDRESSING || DIRECT_ADDRESSING
|
||||
#if DIRECT_ADDRESSING
|
||||
RAMSize = RAMSize & -getpagesize(); // Round down to page boundary
|
||||
#endif
|
||||
|
||||
// Initialize VM system
|
||||
vm_init();
|
||||
|
||||
#if REAL_ADDRESSING
|
||||
// Flag: RAM and ROM are contigously allocated from address 0
|
||||
bool memory_mapped_from_zero = false;
|
||||
|
||||
// Make sure to map RAM & ROM at address 0 only on platforms that
|
||||
// supports linker scripts to relocate the Basilisk II executable
|
||||
// above 0x70000000
|
||||
#if HAVE_LINKER_SCRIPT
|
||||
const bool can_map_all_memory = true;
|
||||
#else
|
||||
const bool can_map_all_memory = false;
|
||||
#endif
|
||||
|
||||
// Try to allocate all memory from 0x0000, if it is not known to crash
|
||||
if (can_map_all_memory && (vm_acquire_mac_fixed(0, RAMSize + 0x100000) == 0)) {
|
||||
D(bug("Could allocate RAM and ROM from 0x0000\n"));
|
||||
memory_mapped_from_zero = true;
|
||||
}
|
||||
|
||||
#ifndef PAGEZERO_HACK
|
||||
// Otherwise, just create the Low Memory area (0x0000..0x2000)
|
||||
else if (vm_acquire_mac_fixed(0, 0x2000) == 0) {
|
||||
D(bug("Could allocate the Low Memory globals\n"));
|
||||
lm_area_mapped = true;
|
||||
}
|
||||
|
||||
// Exit on failure
|
||||
else {
|
||||
sprintf(str, GetString(STR_LOW_MEM_MMAP_ERR), strerror(errno));
|
||||
ErrorAlert(str);
|
||||
QuitEmulator();
|
||||
}
|
||||
#endif
|
||||
#endif /* REAL_ADDRESSING */
|
||||
|
||||
// Create areas for Mac RAM and ROM
|
||||
#if REAL_ADDRESSING
|
||||
if (memory_mapped_from_zero) {
|
||||
RAMBaseHost = (uint8 *)0;
|
||||
ROMBaseHost = RAMBaseHost + RAMSize;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
uint8 *ram_rom_area = (uint8 *)vm_acquire_mac(RAMSize + 0x100000);
|
||||
if (ram_rom_area == VM_MAP_FAILED) {
|
||||
|
@ -682,10 +587,6 @@ int main(int argc, char **argv)
|
|||
RAMBaseMac = 0;
|
||||
ROMBaseMac = Host2MacAddr(ROMBaseHost);
|
||||
#endif
|
||||
#if REAL_ADDRESSING
|
||||
RAMBaseMac = Host2MacAddr(RAMBaseHost);
|
||||
ROMBaseMac = Host2MacAddr(ROMBaseHost);
|
||||
#endif
|
||||
|
||||
#if __MACOSX__
|
||||
extern void set_current_directory();
|
||||
|
@ -715,35 +616,6 @@ int main(int argc, char **argv)
|
|||
QuitEmulator();
|
||||
}
|
||||
|
||||
#if !EMULATED_68K
|
||||
// Get CPU model
|
||||
int mib[2] = {CTL_HW, HW_MODEL};
|
||||
char *model;
|
||||
size_t model_len;
|
||||
sysctl(mib, 2, NULL, &model_len, NULL, 0);
|
||||
model = (char *)malloc(model_len);
|
||||
sysctl(mib, 2, model, &model_len, NULL, 0);
|
||||
D(bug("Model: %s\n", model));
|
||||
|
||||
// Set CPU and FPU type
|
||||
CPUIs68060 = false;
|
||||
if (strstr(model, "020"))
|
||||
CPUType = 2;
|
||||
else if (strstr(model, "030"))
|
||||
CPUType = 3;
|
||||
else if (strstr(model, "040"))
|
||||
CPUType = 4;
|
||||
else if (strstr(model, "060")) {
|
||||
CPUType = 4;
|
||||
CPUIs68060 = true;
|
||||
} else {
|
||||
printf("WARNING: Cannot detect CPU type, assuming 68020\n");
|
||||
CPUType = 2;
|
||||
}
|
||||
FPUType = 1; // NetBSD has an FPU emulation, so the FPU ought to be available at all times
|
||||
TwentyFourBitAddressing = false;
|
||||
#endif
|
||||
|
||||
// Initialize everything
|
||||
if (!InitAll(vmdir))
|
||||
QuitEmulator();
|
||||
|
@ -752,57 +624,6 @@ int main(int argc, char **argv)
|
|||
D(bug("Mac RAM starts at %p (%08x)\n", RAMBaseHost, RAMBaseMac));
|
||||
D(bug("Mac ROM starts at %p (%08x)\n", ROMBaseHost, ROMBaseMac));
|
||||
|
||||
#if !EMULATED_68K
|
||||
// (Virtual) supervisor mode, disable interrupts
|
||||
EmulatedSR = 0x2700;
|
||||
|
||||
#ifdef HAVE_PTHREADS
|
||||
// Get handle of main thread
|
||||
emul_thread = pthread_self();
|
||||
#endif
|
||||
|
||||
// Create and install stack for signal handlers
|
||||
sig_stack = malloc(SIG_STACK_SIZE);
|
||||
D(bug("Signal stack at %p\n", sig_stack));
|
||||
if (sig_stack == NULL) {
|
||||
ErrorAlert(STR_NOT_ENOUGH_MEMORY_ERR);
|
||||
QuitEmulator();
|
||||
}
|
||||
stack_t new_stack;
|
||||
new_stack.ss_sp = sig_stack;
|
||||
new_stack.ss_flags = 0;
|
||||
new_stack.ss_size = SIG_STACK_SIZE;
|
||||
if (sigaltstack(&new_stack, NULL) < 0) {
|
||||
sprintf(str, GetString(STR_SIGALTSTACK_ERR), strerror(errno));
|
||||
ErrorAlert(str);
|
||||
QuitEmulator();
|
||||
}
|
||||
|
||||
// Install SIGILL handler for emulating privileged instructions and
|
||||
// executing A-Trap and EMUL_OP opcodes
|
||||
sigemptyset(&sigill_sa.sa_mask); // Block virtual 68k interrupts during SIGILL handling
|
||||
sigaddset(&sigill_sa.sa_mask, SIG_IRQ);
|
||||
sigaddset(&sigill_sa.sa_mask, SIGALRM);
|
||||
sigill_sa.sa_handler = (void (*)(int))sigill_handler;
|
||||
sigill_sa.sa_flags = SA_ONSTACK;
|
||||
if (sigaction(SIGILL, &sigill_sa, NULL) < 0) {
|
||||
sprintf(str, GetString(STR_SIG_INSTALL_ERR), "SIGILL", strerror(errno));
|
||||
ErrorAlert(str);
|
||||
QuitEmulator();
|
||||
}
|
||||
|
||||
// Install virtual 68k interrupt signal handler
|
||||
sigemptyset(&sigirq_sa.sa_mask);
|
||||
sigaddset(&sigirq_sa.sa_mask, SIGALRM);
|
||||
sigirq_sa.sa_handler = (void (*)(int))sigirq_handler;
|
||||
sigirq_sa.sa_flags = SA_ONSTACK | SA_RESTART;
|
||||
if (sigaction(SIG_IRQ, &sigirq_sa, NULL) < 0) {
|
||||
sprintf(str, GetString(STR_SIG_INSTALL_ERR), "SIG_IRQ", strerror(errno));
|
||||
ErrorAlert(str);
|
||||
QuitEmulator();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_MON
|
||||
// Setup SIGINT handler to enter mon
|
||||
sigemptyset(&sigint_sa.sa_mask);
|
||||
|
@ -859,9 +680,6 @@ int main(int argc, char **argv)
|
|||
|
||||
// Start 60Hz timer
|
||||
sigemptyset(&timer_sa.sa_mask); // Block virtual 68k interrupts during SIGARLM handling
|
||||
#if !EMULATED_68K
|
||||
sigaddset(&timer_sa.sa_mask, SIG_IRQ);
|
||||
#endif
|
||||
timer_sa.sa_handler = one_tick;
|
||||
timer_sa.sa_flags = SA_ONSTACK | SA_RESTART;
|
||||
if (sigaction(SIGALRM, &timer_sa, NULL) < 0) {
|
||||
|
@ -901,10 +719,8 @@ void QuitEmulator(void)
|
|||
{
|
||||
D(bug("QuitEmulator\n"));
|
||||
|
||||
#if EMULATED_68K
|
||||
// Exit 680x0 emulation
|
||||
Exit680x0();
|
||||
#endif
|
||||
|
||||
#if defined(USE_CPU_EMUL_SERVICES)
|
||||
// Show statistics
|
||||
|
@ -960,12 +776,6 @@ void QuitEmulator(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if REAL_ADDRESSING
|
||||
// Delete Low Memory area
|
||||
if (lm_area_mapped)
|
||||
vm_release(0, 0x2000);
|
||||
#endif
|
||||
|
||||
// Exit VM wrappers
|
||||
vm_exit();
|
||||
|
||||
|
@ -996,8 +806,7 @@ void QuitEmulator(void)
|
|||
* or a dynamically recompiling emulator)
|
||||
*/
|
||||
|
||||
void FlushCodeCache(void *start, uint32 size)
|
||||
{
|
||||
void FlushCodeCache(void *start, uint32 size){
|
||||
#if USE_JIT
|
||||
if (UseJIT)
|
||||
#ifdef UPDATE_UAE
|
||||
|
@ -1006,9 +815,6 @@ void FlushCodeCache(void *start, uint32 size)
|
|||
flush_icache_range((uint8 *)start, size);
|
||||
#endif
|
||||
#endif
|
||||
#if !EMULATED_68K && defined(__NetBSD__)
|
||||
m68k_sync_icache(start, size);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -1017,9 +823,7 @@ void FlushCodeCache(void *start, uint32 size)
|
|||
*/
|
||||
|
||||
#ifdef ENABLE_MON
|
||||
static void sigint_handler(...)
|
||||
{
|
||||
#if EMULATED_68K
|
||||
static void sigint_handler(...){
|
||||
uaecptr nextpc;
|
||||
#ifdef UPDATE_UAE
|
||||
extern void m68k_dumpstate(FILE *, uaecptr *nextpc);
|
||||
|
@ -1027,7 +831,6 @@ static void sigint_handler(...)
|
|||
#else
|
||||
extern void m68k_dumpstate(uaecptr *nextpc);
|
||||
m68k_dumpstate(&nextpc);
|
||||
#endif
|
||||
#endif
|
||||
VideoQuitFullScreen();
|
||||
const char *arg[4] = {"mon", "-m", "-r", NULL};
|
||||
|
@ -1155,38 +958,17 @@ void B2_delete_mutex(B2_mutex *mutex)
|
|||
|
||||
uint32 InterruptFlags = 0;
|
||||
|
||||
#if EMULATED_68K
|
||||
void SetInterruptFlag(uint32 flag)
|
||||
{
|
||||
void SetInterruptFlag(uint32 flag){
|
||||
LOCK_INTFLAGS;
|
||||
InterruptFlags |= flag;
|
||||
UNLOCK_INTFLAGS;
|
||||
}
|
||||
|
||||
void ClearInterruptFlag(uint32 flag)
|
||||
{
|
||||
void ClearInterruptFlag(uint32 flag){
|
||||
LOCK_INTFLAGS;
|
||||
InterruptFlags &= ~flag;
|
||||
UNLOCK_INTFLAGS;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !EMULATED_68K
|
||||
void TriggerInterrupt(void)
|
||||
{
|
||||
#if defined(HAVE_PTHREADS)
|
||||
pthread_kill(emul_thread, SIG_IRQ);
|
||||
#else
|
||||
raise(SIG_IRQ);
|
||||
#endif
|
||||
}
|
||||
|
||||
void TriggerNMI(void)
|
||||
{
|
||||
// not yet supported
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* XPRAM watchdog thread (saves XPRAM every minute)
|
||||
|
@ -1281,312 +1063,6 @@ static void *tick_func(void *arg)
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if !EMULATED_68K
|
||||
/*
|
||||
* Virtual 68k interrupt handler
|
||||
*/
|
||||
|
||||
static void sigirq_handler(int sig, int code, struct sigcontext *scp)
|
||||
{
|
||||
// Interrupts disabled? Then do nothing
|
||||
if (EmulatedSR & 0x0700)
|
||||
return;
|
||||
|
||||
struct sigstate *state = (struct sigstate *)scp->sc_ap;
|
||||
M68kRegisters *regs = (M68kRegisters *)&state->ss_frame;
|
||||
|
||||
// Set up interrupt frame on stack
|
||||
uint32 a7 = regs->a[7];
|
||||
a7 -= 2;
|
||||
WriteMacInt16(a7, 0x64);
|
||||
a7 -= 4;
|
||||
WriteMacInt32(a7, scp->sc_pc);
|
||||
a7 -= 2;
|
||||
WriteMacInt16(a7, scp->sc_ps | EmulatedSR);
|
||||
scp->sc_sp = regs->a[7] = a7;
|
||||
|
||||
// Set interrupt level
|
||||
EmulatedSR |= 0x2100;
|
||||
|
||||
// Jump to MacOS interrupt handler on return
|
||||
scp->sc_pc = ReadMacInt32(0x64);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* SIGILL handler, for emulation of privileged instructions and executing
|
||||
* A-Trap and EMUL_OP opcodes
|
||||
*/
|
||||
|
||||
static void sigill_handler(int sig, int code, struct sigcontext *scp)
|
||||
{
|
||||
struct sigstate *state = (struct sigstate *)scp->sc_ap;
|
||||
uint16 *pc = (uint16 *)scp->sc_pc;
|
||||
uint16 opcode = *pc;
|
||||
M68kRegisters *regs = (M68kRegisters *)&state->ss_frame;
|
||||
|
||||
#define INC_PC(n) scp->sc_pc += (n)
|
||||
|
||||
#define GET_SR (scp->sc_ps | EmulatedSR)
|
||||
|
||||
#define STORE_SR(v) \
|
||||
scp->sc_ps = (v) & 0xff; \
|
||||
EmulatedSR = (v) & 0xe700; \
|
||||
if (((v) & 0x0700) == 0 && InterruptFlags) \
|
||||
TriggerInterrupt();
|
||||
|
||||
//printf("opcode %04x at %p, sr %04x, emul_sr %04x\n", opcode, pc, scp->sc_ps, EmulatedSR);
|
||||
|
||||
if ((opcode & 0xf000) == 0xa000) {
|
||||
|
||||
// A-Line instruction, set up A-Line trap frame on stack
|
||||
uint32 a7 = regs->a[7];
|
||||
a7 -= 2;
|
||||
WriteMacInt16(a7, 0x28);
|
||||
a7 -= 4;
|
||||
WriteMacInt32(a7, (uint32)pc);
|
||||
a7 -= 2;
|
||||
WriteMacInt16(a7, GET_SR);
|
||||
scp->sc_sp = regs->a[7] = a7;
|
||||
|
||||
// Jump to MacOS A-Line handler on return
|
||||
scp->sc_pc = ReadMacInt32(0x28);
|
||||
|
||||
} else if ((opcode & 0xff00) == 0x7100) {
|
||||
|
||||
// Extended opcode, push registers on user stack
|
||||
uint32 a7 = regs->a[7];
|
||||
a7 -= 4;
|
||||
WriteMacInt32(a7, (uint32)pc);
|
||||
a7 -= 2;
|
||||
WriteMacInt16(a7, scp->sc_ps);
|
||||
for (int i=7; i>=0; i--) {
|
||||
a7 -= 4;
|
||||
WriteMacInt32(a7, regs->a[i]);
|
||||
}
|
||||
for (int i=7; i>=0; i--) {
|
||||
a7 -= 4;
|
||||
WriteMacInt32(a7, regs->d[i]);
|
||||
}
|
||||
scp->sc_sp = regs->a[7] = a7;
|
||||
|
||||
// Jump to EmulOp trampoline code on return
|
||||
scp->sc_pc = (uint32)EmulOpTrampoline;
|
||||
|
||||
} else switch (opcode) { // Emulate privileged instructions
|
||||
|
||||
case 0x40e7: // move sr,-(sp)
|
||||
regs->a[7] -= 2;
|
||||
WriteMacInt16(regs->a[7], GET_SR);
|
||||
scp->sc_sp = regs->a[7];
|
||||
INC_PC(2);
|
||||
break;
|
||||
|
||||
case 0x46df: { // move (sp)+,sr
|
||||
uint16 sr = ReadMacInt16(regs->a[7]);
|
||||
STORE_SR(sr);
|
||||
regs->a[7] += 2;
|
||||
scp->sc_sp = regs->a[7];
|
||||
INC_PC(2);
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x007c: { // ori #xxxx,sr
|
||||
uint16 sr = GET_SR | pc[1];
|
||||
scp->sc_ps = sr & 0xff; // oring bits into the sr can't enable interrupts, so we don't need to call STORE_SR
|
||||
EmulatedSR = sr & 0xe700;
|
||||
INC_PC(4);
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x027c: { // andi #xxxx,sr
|
||||
uint16 sr = GET_SR & pc[1];
|
||||
STORE_SR(sr);
|
||||
INC_PC(4);
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x46fc: // move #xxxx,sr
|
||||
STORE_SR(pc[1]);
|
||||
INC_PC(4);
|
||||
break;
|
||||
|
||||
case 0x46ef: { // move (xxxx,sp),sr
|
||||
uint16 sr = ReadMacInt16(regs->a[7] + (int32)(int16)pc[1]);
|
||||
STORE_SR(sr);
|
||||
INC_PC(4);
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x46d8: // move (a0)+,sr
|
||||
case 0x46d9: { // move (a1)+,sr
|
||||
uint16 sr = ReadMacInt16(regs->a[opcode & 7]);
|
||||
STORE_SR(sr);
|
||||
regs->a[opcode & 7] += 2;
|
||||
INC_PC(2);
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x40f8: // move sr,xxxx.w
|
||||
WriteMacInt16(pc[1], GET_SR);
|
||||
INC_PC(4);
|
||||
break;
|
||||
|
||||
case 0x40d0: // move sr,(a0)
|
||||
case 0x40d1: // move sr,(a1)
|
||||
case 0x40d2: // move sr,(a2)
|
||||
case 0x40d3: // move sr,(a3)
|
||||
case 0x40d4: // move sr,(a4)
|
||||
case 0x40d5: // move sr,(a5)
|
||||
case 0x40d6: // move sr,(a6)
|
||||
case 0x40d7: // move sr,(sp)
|
||||
WriteMacInt16(regs->a[opcode & 7], GET_SR);
|
||||
INC_PC(2);
|
||||
break;
|
||||
|
||||
case 0x40c0: // move sr,d0
|
||||
case 0x40c1: // move sr,d1
|
||||
case 0x40c2: // move sr,d2
|
||||
case 0x40c3: // move sr,d3
|
||||
case 0x40c4: // move sr,d4
|
||||
case 0x40c5: // move sr,d5
|
||||
case 0x40c6: // move sr,d6
|
||||
case 0x40c7: // move sr,d7
|
||||
regs->d[opcode & 7] = GET_SR;
|
||||
INC_PC(2);
|
||||
break;
|
||||
|
||||
case 0x46c0: // move d0,sr
|
||||
case 0x46c1: // move d1,sr
|
||||
case 0x46c2: // move d2,sr
|
||||
case 0x46c3: // move d3,sr
|
||||
case 0x46c4: // move d4,sr
|
||||
case 0x46c5: // move d5,sr
|
||||
case 0x46c6: // move d6,sr
|
||||
case 0x46c7: { // move d7,sr
|
||||
uint16 sr = regs->d[opcode & 7];
|
||||
STORE_SR(sr);
|
||||
INC_PC(2);
|
||||
break;
|
||||
}
|
||||
|
||||
case 0xf327: // fsave -(sp)
|
||||
regs->a[7] -= 4;
|
||||
WriteMacInt32(regs->a[7], 0x41000000); // Idle frame
|
||||
scp->sc_sp = regs->a[7];
|
||||
INC_PC(2);
|
||||
break;
|
||||
|
||||
case 0xf35f: // frestore (sp)+
|
||||
regs->a[7] += 4;
|
||||
scp->sc_sp = regs->a[7];
|
||||
INC_PC(2);
|
||||
break;
|
||||
|
||||
case 0x4e73: { // rte
|
||||
uint32 a7 = regs->a[7];
|
||||
uint16 sr = ReadMacInt16(a7);
|
||||
a7 += 2;
|
||||
scp->sc_ps = sr & 0xff;
|
||||
EmulatedSR = sr & 0xe700;
|
||||
scp->sc_pc = ReadMacInt32(a7);
|
||||
a7 += 4;
|
||||
uint16 format = ReadMacInt16(a7) >> 12;
|
||||
a7 += 2;
|
||||
static const int frame_adj[16] = {
|
||||
0, 0, 4, 4, 8, 0, 0, 52, 50, 12, 24, 84, 16, 0, 0, 0
|
||||
};
|
||||
scp->sc_sp = regs->a[7] = a7 + frame_adj[format];
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x4e7a: // movec cr,x
|
||||
switch (pc[1]) {
|
||||
case 0x0002: // movec cacr,d0
|
||||
regs->d[0] = 0x3111;
|
||||
break;
|
||||
case 0x1002: // movec cacr,d1
|
||||
regs->d[1] = 0x3111;
|
||||
break;
|
||||
case 0x0003: // movec tc,d0
|
||||
case 0x0004: // movec itt0,d0
|
||||
case 0x0005: // movec itt1,d0
|
||||
case 0x0006: // movec dtt0,d0
|
||||
case 0x0007: // movec dtt1,d0
|
||||
case 0x0806: // movec urp,d0
|
||||
case 0x0807: // movec srp,d0
|
||||
regs->d[0] = 0;
|
||||
break;
|
||||
case 0x1000: // movec sfc,d1
|
||||
case 0x1001: // movec dfc,d1
|
||||
case 0x1003: // movec tc,d1
|
||||
case 0x1801: // movec vbr,d1
|
||||
regs->d[1] = 0;
|
||||
break;
|
||||
case 0x8801: // movec vbr,a0
|
||||
regs->a[0] = 0;
|
||||
break;
|
||||
case 0x9801: // movec vbr,a1
|
||||
regs->a[1] = 0;
|
||||
break;
|
||||
default:
|
||||
goto ill;
|
||||
}
|
||||
INC_PC(4);
|
||||
break;
|
||||
|
||||
case 0x4e7b: // movec x,cr
|
||||
switch (pc[1]) {
|
||||
case 0x1000: // movec d1,sfc
|
||||
case 0x1001: // movec d1,dfc
|
||||
case 0x0801: // movec d0,vbr
|
||||
case 0x1801: // movec d1,vbr
|
||||
break;
|
||||
case 0x0002: // movec d0,cacr
|
||||
case 0x1002: // movec d1,cacr
|
||||
FlushCodeCache(NULL, 0);
|
||||
break;
|
||||
default:
|
||||
goto ill;
|
||||
}
|
||||
INC_PC(4);
|
||||
break;
|
||||
|
||||
case 0xf478: // cpusha dc
|
||||
case 0xf4f8: // cpusha dc/ic
|
||||
FlushCodeCache(NULL, 0);
|
||||
INC_PC(2);
|
||||
break;
|
||||
|
||||
default:
|
||||
ill: printf("SIGILL num %d, code %d\n", sig, code);
|
||||
printf(" context %p:\n", scp);
|
||||
printf(" onstack %08x\n", scp->sc_onstack);
|
||||
printf(" sp %08x\n", scp->sc_sp);
|
||||
printf(" fp %08x\n", scp->sc_fp);
|
||||
printf(" pc %08x\n", scp->sc_pc);
|
||||
printf(" opcode %04x\n", opcode);
|
||||
printf(" sr %08x\n", scp->sc_ps);
|
||||
printf(" state %p:\n", state);
|
||||
printf(" flags %d\n", state->ss_flags);
|
||||
for (int i=0; i<8; i++)
|
||||
printf(" d%d %08x\n", i, state->ss_frame.f_regs[i]);
|
||||
for (int i=0; i<8; i++)
|
||||
printf(" a%d %08x\n", i, state->ss_frame.f_regs[i+8]);
|
||||
|
||||
VideoQuitFullScreen();
|
||||
#ifdef ENABLE_MON
|
||||
const char *arg[4] = {"mon", "-m", "-r", NULL};
|
||||
mon(3, arg);
|
||||
#endif
|
||||
QuitEmulator();
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Display alert
|
||||
*/
|
||||
|
|
|
@ -1506,7 +1506,6 @@ static void create_memory_pane(GtkWidget *top)
|
|||
}
|
||||
table_make_option_menu(table, 2, STR_MODELID_CTRL, model_options, active);
|
||||
|
||||
#if EMULATED_68K
|
||||
static const opt_desc cpu_options[] = {
|
||||
{STR_CPU_68020_LAB, GTK_SIGNAL_FUNC(mn_cpu_68020)},
|
||||
{STR_CPU_68020_FPU_LAB, GTK_SIGNAL_FUNC(mn_cpu_68020_fpu)},
|
||||
|
@ -1524,7 +1523,6 @@ static void create_memory_pane(GtkWidget *top)
|
|||
case 4: active = 4;
|
||||
}
|
||||
table_make_option_menu(table, 3, STR_CPU_CTRL, cpu_options, active);
|
||||
#endif
|
||||
|
||||
w_rom_file = table_make_file_entry(table, 4, STR_ROM_FILE_CTRL, "rom");
|
||||
|
||||
|
|
|
@ -62,41 +62,17 @@
|
|||
#include <mach/clock.h>
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NATIVE_M68K
|
||||
|
||||
/* Mac and host address space are the same */
|
||||
#define REAL_ADDRESSING 1
|
||||
|
||||
/* Using 68k natively */
|
||||
#define EMULATED_68K 0
|
||||
|
||||
/* Mac ROM is not write protected */
|
||||
#define ROM_IS_WRITE_PROTECTED 0
|
||||
#define USE_SCRATCHMEM_SUBTERFUGE 1
|
||||
|
||||
#else
|
||||
|
||||
/* Mac and host address space are distinct */
|
||||
#ifndef REAL_ADDRESSING
|
||||
#define REAL_ADDRESSING 0
|
||||
#endif
|
||||
|
||||
/* Using 68k emulator */
|
||||
#define EMULATED_68K 1
|
||||
|
||||
/* The m68k emulator uses a prefetch buffer ? */
|
||||
#define USE_PREFETCH_BUFFER 0
|
||||
|
||||
/* Mac ROM is write protected when banked memory is used */
|
||||
#if REAL_ADDRESSING || DIRECT_ADDRESSING
|
||||
#if DIRECT_ADDRESSING
|
||||
# define ROM_IS_WRITE_PROTECTED 0
|
||||
# define USE_SCRATCHMEM_SUBTERFUGE 1
|
||||
#else
|
||||
# define ROM_IS_WRITE_PROTECTED 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* Direct Addressing requires Video on SEGV signals in plain X11 mode */
|
||||
#if DIRECT_ADDRESSING && (!ENABLE_VOSF && !USE_SDL_VIDEO)
|
||||
# undef ENABLE_VOSF
|
||||
|
@ -113,11 +89,9 @@
|
|||
#ifdef HAVE_PTHREADS
|
||||
#define USE_PTHREADS_SERVICES
|
||||
#endif
|
||||
#if EMULATED_68K
|
||||
#if defined(__NetBSD__)
|
||||
#define USE_CPU_EMUL_SERVICES
|
||||
#endif
|
||||
#endif
|
||||
#ifdef USE_CPU_EMUL_SERVICES
|
||||
#undef USE_PTHREADS_SERVICES
|
||||
#endif
|
||||
|
|
|
@ -406,7 +406,7 @@ static void add_window_modes(video_depth depth)
|
|||
// Set Mac frame layout and base address (uses the_buffer/MacFrameBaseMac)
|
||||
static void set_mac_frame_buffer(X11_monitor_desc &monitor, video_depth depth, bool native_byte_order)
|
||||
{
|
||||
#if !REAL_ADDRESSING && !DIRECT_ADDRESSING
|
||||
#if !DIRECT_ADDRESSING
|
||||
int layout = FLAYOUT_DIRECT;
|
||||
if (depth == VDEPTH_16BIT)
|
||||
layout = (xdepth == 15) ? FLAYOUT_HOST_555 : FLAYOUT_HOST_565;
|
||||
|
@ -1184,7 +1184,7 @@ driver_fbdev::driver_fbdev(X11_monitor_desc &m) : driver_dga(m)
|
|||
}
|
||||
|
||||
#if ENABLE_VOSF
|
||||
#if REAL_ADDRESSING || DIRECT_ADDRESSING
|
||||
#if DIRECT_ADDRESSING
|
||||
// Screen_blitter_init() returns TRUE if VOSF is mandatory
|
||||
// i.e. the framebuffer update function is not Blit_Copy_Raw
|
||||
use_vosf = Screen_blitter_init(visualFormat, true, mode.depth);
|
||||
|
@ -1321,7 +1321,7 @@ driver_xf86dga::driver_xf86dga(X11_monitor_desc &m)
|
|||
// Init blitting routines
|
||||
int bytes_per_row = TrivialBytesPerRow((v_width + 7) & ~7, mode.depth);
|
||||
#if ENABLE_VOSF
|
||||
#if REAL_ADDRESSING || DIRECT_ADDRESSING
|
||||
#if DIRECT_ADDRESSING
|
||||
// Screen_blitter_init() returns TRUE if VOSF is mandatory
|
||||
// i.e. the framebuffer update function is not Blit_Copy_Raw
|
||||
use_vosf = Screen_blitter_init(visualFormat, x_native_byte_order, depth_of_video_mode(mode));
|
||||
|
@ -2527,7 +2527,7 @@ static void video_refresh_dga(void)
|
|||
}
|
||||
|
||||
#ifdef ENABLE_VOSF
|
||||
#if REAL_ADDRESSING || DIRECT_ADDRESSING
|
||||
#if DIRECT_ADDRESSING
|
||||
static void video_refresh_dga_vosf(void)
|
||||
{
|
||||
// Quit DGA mode if requested
|
||||
|
@ -2600,7 +2600,7 @@ static void VideoRefreshInit(void)
|
|||
{
|
||||
// TODO: set up specialised 8bpp VideoRefresh handlers ?
|
||||
if (display_type == DISPLAY_DGA) {
|
||||
#if ENABLE_VOSF && (REAL_ADDRESSING || DIRECT_ADDRESSING)
|
||||
#if ENABLE_VOSF && DIRECT_ADDRESSING
|
||||
if (use_vosf)
|
||||
video_refresh = video_refresh_dga_vosf;
|
||||
else
|
||||
|
|
|
@ -94,11 +94,6 @@ static SDL_mutex *intflag_lock = NULL; // Mutex to protect InterruptFlags
|
|||
uint8 *ScratchMem = NULL; // Scratch memory for Mac ROM writes
|
||||
#endif
|
||||
|
||||
#if REAL_ADDRESSING
|
||||
static bool lm_area_mapped = false; // Flag: Low Memory area mmap()ped
|
||||
#endif
|
||||
|
||||
|
||||
// Prototypes
|
||||
static int xpram_func(void *arg);
|
||||
static int tick_func(void *arg);
|
||||
|
|
|
@ -1767,9 +1767,7 @@ static void create_memory_pane(GtkWidget *top)
|
|||
case 14: active = 1; break;
|
||||
}
|
||||
table_make_option_menu(table, 2, STR_MODELID_CTRL, model_options, active);
|
||||
#endif
|
||||
|
||||
#if EMULATED_68K
|
||||
static const opt_desc cpu_options[] = {
|
||||
{STR_CPU_68020_LAB, GTK_SIGNAL_FUNC(mn_cpu_68020)},
|
||||
{STR_CPU_68020_FPU_LAB, GTK_SIGNAL_FUNC(mn_cpu_68020_fpu)},
|
||||
|
|
|
@ -43,23 +43,11 @@
|
|||
#include <WinSock2.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
/* Mac and host address space are distinct */
|
||||
#ifndef REAL_ADDRESSING
|
||||
#define REAL_ADDRESSING 0
|
||||
#endif
|
||||
#if REAL_ADDRESSING
|
||||
#error "Real Addressing mode can't work without proper kernel support"
|
||||
#endif
|
||||
|
||||
/* Using 68k emulator */
|
||||
#define EMULATED_68K 1
|
||||
|
||||
/* The m68k emulator uses a prefetch buffer ? */
|
||||
#define USE_PREFETCH_BUFFER 0
|
||||
|
||||
/* Mac ROM is write protected when banked memory is used */
|
||||
#if REAL_ADDRESSING || DIRECT_ADDRESSING
|
||||
#if DIRECT_ADDRESSING
|
||||
# define ROM_IS_WRITE_PROTECTED 0
|
||||
# define USE_SCRATCHMEM_SUBTERFUGE 1
|
||||
#else
|
||||
|
|
|
@ -444,7 +444,6 @@ void ether_udp_read(uint32 packet, int length, struct sockaddr_in *from)
|
|||
* Ethernet packet allocator
|
||||
*/
|
||||
|
||||
#if SIZEOF_VOID_P != 4 || REAL_ADDRESSING == 0
|
||||
static uint32 ether_packet = 0; // Ethernet packet (cached allocation)
|
||||
static uint32 n_ether_packets = 0; // Number of ethernet packets allocated so far (should be at most 1)
|
||||
|
||||
|
@ -476,4 +475,3 @@ EthernetPacket::~EthernetPacket()
|
|||
bug("WARNING: Nested allocation of ethernet packets!\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -61,19 +61,13 @@ enum {
|
|||
|
||||
extern uint32 ether_data; // Mac address of driver data in MacOS RAM
|
||||
|
||||
// Ethernet packet allocator (optimized for 32-bit platforms in real addressing mode)
|
||||
// Ethernet packet allocator
|
||||
class EthernetPacket {
|
||||
#if SIZEOF_VOID_P == 4 && REAL_ADDRESSING
|
||||
uint8 packet[1516];
|
||||
public:
|
||||
uint32 addr(void) const { return (uint32)packet; }
|
||||
#else
|
||||
uint32 packet;
|
||||
public:
|
||||
EthernetPacket();
|
||||
~EthernetPacket();
|
||||
uint32 addr(void) const { return packet; }
|
||||
#endif
|
||||
};
|
||||
|
||||
// Copy packet data from WDS to linear buffer (must hold at least 1514 bytes),
|
||||
|
|
|
@ -69,7 +69,6 @@ bool InitAll(const char *vmdir)
|
|||
return false;
|
||||
}
|
||||
|
||||
#if EMULATED_68K
|
||||
// Set CPU and FPU type (UAE emulation)
|
||||
switch (ROMVersion) {
|
||||
case ROM_VERSION_64K:
|
||||
|
@ -97,7 +96,6 @@ bool InitAll(const char *vmdir)
|
|||
break;
|
||||
}
|
||||
CPUIs68060 = false;
|
||||
#endif
|
||||
|
||||
// Load XPRAM
|
||||
XPRAMInit(vmdir);
|
||||
|
@ -180,11 +178,9 @@ bool InitAll(const char *vmdir)
|
|||
XPRAM[0x58] = uint8(main_monitor.depth_to_apple_mode(main_monitor.get_current_mode().depth));
|
||||
XPRAM[0x59] = 0;
|
||||
|
||||
#if EMULATED_68K
|
||||
// Init 680x0 emulation (this also activates the memory system which is needed for PatchROM())
|
||||
if (!Init680x0())
|
||||
return false;
|
||||
#endif
|
||||
|
||||
// Install ROM patches
|
||||
if (!PatchROM()) {
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
/*
|
||||
* cpu_emulation.h - Definitions for Basilisk II CPU emulation module (native 68k version)
|
||||
*
|
||||
* Basilisk II (C) 1997-2008 Christian Bauer
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef CPU_EMULATION_H
|
||||
#define CPU_EMULATION_H
|
||||
|
||||
|
||||
/*
|
||||
* Memory system
|
||||
*/
|
||||
|
||||
// RAM and ROM pointers (allocated and set by main_*.cpp)
|
||||
extern uint32 RAMBaseMac; // RAM base (Mac address space), does not include Low Mem when != 0
|
||||
extern uint8 *RAMBaseHost; // RAM base (host address space)
|
||||
extern uint32 RAMSize; // Size of RAM
|
||||
|
||||
extern uint32 ROMBaseMac; // ROM base (Mac address space)
|
||||
extern uint8 *ROMBaseHost; // ROM base (host address space)
|
||||
extern uint32 ROMSize; // Size of ROM
|
||||
|
||||
// Mac memory access functions
|
||||
static inline uint32 ReadMacInt32(uint32 addr) {return *(uint32 *)addr;}
|
||||
static inline uint32 ReadMacInt16(uint32 addr) {return *(uint16 *)addr;}
|
||||
static inline uint32 ReadMacInt8(uint32 addr) {return *(uint8 *)addr;}
|
||||
static inline void WriteMacInt32(uint32 addr, uint32 l) {*(uint32 *)addr = l;}
|
||||
static inline void WriteMacInt16(uint32 addr, uint32 w) {*(uint16 *)addr = w;}
|
||||
static inline void WriteMacInt8(uint32 addr, uint32 b) {*(uint8 *)addr = b;}
|
||||
static inline uint8 *Mac2HostAddr(uint32 addr) {return (uint8 *)addr;}
|
||||
static inline uint32 Host2MacAddr(uint8 *addr) {return (uint32)addr;}
|
||||
static inline void *Mac_memset(uint32 addr, int c, size_t n) {return memset(Mac2HostAddr(addr), c, n);}
|
||||
static inline void *Mac2Host_memcpy(void *dest, uint32 src, size_t n) {return memcpy(dest, Mac2HostAddr(src), n);}
|
||||
static inline void *Host2Mac_memcpy(uint32 dest, const void *src, size_t n) {return memcpy(Mac2HostAddr(dest), src, n);}
|
||||
static inline void *Mac2Mac_memcpy(uint32 dest, uint32 src, size_t n) {return memcpy(Mac2HostAddr(dest), Mac2HostAddr(src), n);}
|
||||
|
||||
|
||||
/*
|
||||
* 680x0 emulation
|
||||
*/
|
||||
|
||||
// 680x0 emulation functions
|
||||
struct M68kRegisters;
|
||||
extern void Start680x0(void); // Reset and start 680x0
|
||||
extern "C" void Execute68k(uint32 addr, M68kRegisters *r); // Execute 68k code from EMUL_OP routine
|
||||
extern "C" void Execute68kTrap(uint16 trap, M68kRegisters *r); // Execute MacOS 68k trap from EMUL_OP routine
|
||||
|
||||
// Interrupt functions
|
||||
extern void TriggerInterrupt(void); // Trigger interrupt (InterruptFlag must be set first)
|
||||
extern void TriggerNMI(void); // Trigger interrupt level 7
|
||||
|
||||
#endif
|
|
@ -832,7 +832,7 @@ bool CheckROM(void)
|
|||
// Read version
|
||||
ROMVersion = ntohs(*(uint16 *)(ROMBaseHost + 8));
|
||||
|
||||
#if REAL_ADDRESSING || DIRECT_ADDRESSING
|
||||
#if DIRECT_ADDRESSING
|
||||
// Real and direct addressing modes require a 32-bit clean ROM
|
||||
return ROMVersion == ROM_VERSION_32;
|
||||
#else
|
||||
|
@ -1257,15 +1257,6 @@ static bool patch_rom_32(void)
|
|||
*wp++ = htons(0x0cea);
|
||||
*wp = htons(M68K_RTS);
|
||||
|
||||
#if REAL_ADDRESSING
|
||||
// Move system zone to start of Mac RAM
|
||||
wp = (uint16 *)(ROMBaseHost + 0x50a);
|
||||
*wp++ = htons(HiWord(RAMBaseMac + 0x2000));
|
||||
*wp++ = htons(LoWord(RAMBaseMac + 0x2000));
|
||||
*wp++ = htons(HiWord(RAMBaseMac + 0x3800));
|
||||
*wp = htons(LoWord(RAMBaseMac + 0x3800));
|
||||
#endif
|
||||
|
||||
#if !ROM_IS_WRITE_PROTECTED
|
||||
#if defined(USE_SCRATCHMEM_SUBTERFUGE)
|
||||
// Set fake handle at 0x0000 to scratch memory area (so broken Mac programs won't write into Mac ROM)
|
||||
|
@ -1280,13 +1271,6 @@ static bool patch_rom_32(void)
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if REAL_ADDRESSING
|
||||
// gb-- Temporary hack to get rid of crashes in Speedometer
|
||||
wp = (uint16 *)(ROMBaseHost + 0xdba2);
|
||||
if (ntohs(*wp) == 0x662c) // bne.b #$2c
|
||||
*wp = htons(0x602c); // bra.b #$2c
|
||||
#endif
|
||||
|
||||
// Don't write to VIA in InitTimeMgr
|
||||
wp = (uint16 *)(ROMBaseHost + 0xb0e2);
|
||||
*wp++ = htons(0x4cdf); // movem.l (sp)+,d0-d5/a0-a4
|
||||
|
|
|
@ -41,12 +41,10 @@ uint32 ROMBaseMac; // ROM base (Mac address space)
|
|||
uint8 *ROMBaseHost; // ROM base (host address space)
|
||||
uint32 ROMSize; // Size of ROM
|
||||
|
||||
#if !REAL_ADDRESSING
|
||||
// Mac frame buffer
|
||||
uint8 *MacFrameBaseHost; // Frame buffer base (host address space)
|
||||
uint32 MacFrameSize; // Size of frame buffer
|
||||
int MacFrameLayout; // Frame buffer layout
|
||||
#endif
|
||||
|
||||
#if DIRECT_ADDRESSING
|
||||
uintptr MEMBaseDiff; // Global offset between a Mac address and its Host equivalent
|
||||
|
@ -64,13 +62,8 @@ extern bool quit_program;
|
|||
* Initialize 680x0 emulation, CheckROM() must have been called first
|
||||
*/
|
||||
|
||||
bool Init680x0(void)
|
||||
{
|
||||
#if REAL_ADDRESSING
|
||||
// Mac address space = host address space
|
||||
RAMBaseMac = (uintptr)RAMBaseHost;
|
||||
ROMBaseMac = (uintptr)ROMBaseHost;
|
||||
#elif DIRECT_ADDRESSING
|
||||
bool Init680x0(void){
|
||||
#if DIRECT_ADDRESSING
|
||||
// Mac address space = host address space minus constant offset (MEMBaseDiff)
|
||||
// NOTE: MEMBaseDiff is set up in main_unix.cpp/main()
|
||||
RAMBaseMac = 0;
|
||||
|
@ -119,14 +112,12 @@ void Exit680x0(void)
|
|||
exit_m68k();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Initialize memory mapping of frame buffer (called upon video mode change)
|
||||
*/
|
||||
|
||||
void InitFrameBufferMapping(void)
|
||||
{
|
||||
#if !REAL_ADDRESSING && !DIRECT_ADDRESSING
|
||||
void InitFrameBufferMapping(void){
|
||||
#if !DIRECT_ADDRESSING
|
||||
memory_init();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
|
||||
#if USE_JIT
|
||||
|
||||
#if !REAL_ADDRESSING && !DIRECT_ADDRESSING
|
||||
#error "Only Real or Direct Addressing is supported with the JIT Compiler"
|
||||
#if !DIRECT_ADDRESSING
|
||||
#error "Only Direct Addressing is supported with the JIT Compiler"
|
||||
#endif
|
||||
|
||||
#if X86_ASSEMBLY && !SAHF_SETO_PROFITABLE
|
||||
|
@ -5565,9 +5565,7 @@ void get_n_addr(int address, int dest, int tmp)
|
|||
f=dest;
|
||||
}
|
||||
|
||||
#if REAL_ADDRESSING
|
||||
mov_l_rr(dest, address);
|
||||
#elif DIRECT_ADDRESSING
|
||||
#if DIRECT_ADDRESSING
|
||||
lea_l_brr(dest,address,MEMBaseDiff);
|
||||
#endif
|
||||
forget_about(tmp);
|
||||
|
@ -7080,7 +7078,7 @@ void execute_normal(void)
|
|||
if (!check_for_cache_miss()) {
|
||||
cpu_history pc_hist[MAXRUN];
|
||||
int blocklen = 0;
|
||||
#if REAL_ADDRESSING || DIRECT_ADDRESSING
|
||||
#if DIRECT_ADDRESSING
|
||||
start_pc_p = regs.pc_p;
|
||||
start_pc = get_virtual_address(regs.pc_p);
|
||||
#else
|
||||
|
|
|
@ -37,8 +37,8 @@ extern uint32 ROMBaseMac; // ROM base (Mac address space)
|
|||
extern uint8 *ROMBaseHost; // ROM base (host address space)
|
||||
extern uint32 ROMSize; // Size of ROM
|
||||
|
||||
#if !REAL_ADDRESSING && !DIRECT_ADDRESSING
|
||||
// If we are not using real or direct addressing, the Mac frame buffer gets
|
||||
#if !DIRECT_ADDRESSING
|
||||
// If we are not using direct addressing, the Mac frame buffer gets
|
||||
// mapped to this location. The memory must be allocated by VideoInit().
|
||||
// If multiple monitors are used, they must share the frame buffer
|
||||
const uint32 MacFrameBaseMac = 0xa0000000;
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include "readcpu.h"
|
||||
#include "newcpu.h"
|
||||
|
||||
#if !REAL_ADDRESSING && !DIRECT_ADDRESSING
|
||||
#if !DIRECT_ADDRESSING
|
||||
|
||||
static bool illegal_mem = false;
|
||||
|
||||
|
@ -638,5 +638,5 @@ void map_banks(addrbank *bank, int start, int size)
|
|||
put_mem_bank((bnr + hioffs) << 16, bank);
|
||||
}
|
||||
|
||||
#endif /* !REAL_ADDRESSING && !DIRECT_ADDRESSING */
|
||||
#endif /* !DIRECT_ADDRESSING */
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#ifndef UAE_MEMORY_H
|
||||
#define UAE_MEMORY_H
|
||||
|
||||
#if !DIRECT_ADDRESSING && !REAL_ADDRESSING
|
||||
#if !DIRECT_ADDRESSING
|
||||
|
||||
/* Enabling this adds one additional native memory reference per 68k memory
|
||||
* access, but saves one shift (on the x86). Enabling this is probably
|
||||
|
@ -115,15 +115,11 @@ extern void byteput(uaecptr addr, uae_u32 b);
|
|||
|
||||
#endif
|
||||
|
||||
#endif /* !DIRECT_ADDRESSING && !REAL_ADDRESSING */
|
||||
#endif /* !DIRECT_ADDRESSING */
|
||||
|
||||
#if REAL_ADDRESSING
|
||||
const uintptr MEMBaseDiff = 0;
|
||||
#elif DIRECT_ADDRESSING
|
||||
#if DIRECT_ADDRESSING
|
||||
extern uintptr MEMBaseDiff;
|
||||
#endif
|
||||
|
||||
#if REAL_ADDRESSING || DIRECT_ADDRESSING
|
||||
static __inline__ uae_u8 *do_get_real_address(uaecptr addr)
|
||||
{
|
||||
return (uae_u8 *)MEMBaseDiff + addr;
|
||||
|
@ -201,7 +197,7 @@ static __inline__ uae_u8 *get_real_address(uaecptr addr)
|
|||
}
|
||||
/* gb-- deliberately not implemented since it shall not be used... */
|
||||
extern uae_u32 get_virtual_address(uae_u8 *addr);
|
||||
#endif /* DIRECT_ADDRESSING || REAL_ADDRESSING */
|
||||
#endif /* DIRECT_ADDRESSING */
|
||||
|
||||
#endif /* MEMORY_H */
|
||||
|
||||
|
|
|
@ -303,7 +303,7 @@ static int backup_pointer = 0;
|
|||
static long int m68kpc_offset;
|
||||
int lastint_no;
|
||||
|
||||
#if REAL_ADDRESSING || DIRECT_ADDRESSING
|
||||
#if DIRECT_ADDRESSING
|
||||
#define get_ibyte_1(o) get_byte(get_virtual_address(regs.pc_p) + (o) + 1)
|
||||
#define get_iword_1(o) get_word(get_virtual_address(regs.pc_p) + (o))
|
||||
#define get_ilong_1(o) get_long(get_virtual_address(regs.pc_p) + (o))
|
||||
|
|
|
@ -182,7 +182,7 @@ static __inline__ void fill_prefetch_2 (void)
|
|||
|
||||
static __inline__ uaecptr m68k_getpc (void)
|
||||
{
|
||||
#if REAL_ADDRESSING || DIRECT_ADDRESSING
|
||||
#if DIRECT_ADDRESSING
|
||||
return get_virtual_address(regs.pc_p);
|
||||
#else
|
||||
return regs.pc + ((char *)regs.pc_p - (char *)regs.pc_oldp);
|
||||
|
@ -195,7 +195,7 @@ static __inline__ void m68k_setpc (uaecptr newpc)
|
|||
uae_u32 previous_pc = m68k_getpc();
|
||||
#endif
|
||||
|
||||
#if REAL_ADDRESSING || DIRECT_ADDRESSING
|
||||
#if DIRECT_ADDRESSING
|
||||
regs.pc_p = get_real_address(newpc);
|
||||
#else
|
||||
regs.pc_p = regs.pc_oldp = get_real_address(newpc);
|
||||
|
|
Loading…
Reference in New Issue
Block a user