]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Initial version of QEmu PPC CPU integration (not fully working yet)
authorFrode Solheim <frode@fs-uae.net>
Fri, 22 Aug 2014 18:50:16 +0000 (20:50 +0200)
committerFrode Solheim <frode@fs-uae.net>
Fri, 22 Aug 2014 18:50:16 +0000 (20:50 +0200)
14 files changed:
include/ppc.h
ppc/pearpc/cpu/cpu_generic/ppc_alu.cpp
ppc/pearpc/cpu/cpu_generic/ppc_cpu.cpp
ppc/pearpc/cpu/cpu_generic/ppc_opc.cpp
ppc/pearpc/cpu/mem.h
ppc/pearpc/io/io.h
ppc/pearpc/pearpc_config.h [moved from ppc/pearpc/config.h with 100% similarity]
ppc/pearpc/system/arch/generic/sysendian.h
ppc/pearpc/system/arch/sysendian.h
ppc/pearpc/system/arch/sysfeatures.h
ppc/pearpc/system/types.h
ppc/pearpc/uaeglue.cpp
ppc/ppc.cpp
ppc/ppcd.cpp

index 2f9a7ee545bb6bd1b2571e88055072d73796e247..ec563b6acb56f07ee925333c9024a35b36d03c20 100644 (file)
@@ -1,3 +1,29 @@
+#ifndef UAE_PPC_H
+#define UAE_PPC_H
+
+/*
+ * This file only consists of default includes, so it can safely be included
+ * in other projects (PearPC, QEmu) without pulling in lots of headers.
+ */
+
+#include <stdint.h>
+#include <stdbool.h>
+
+/* PPC_EXTERN_C is defined (on the UAE side) when compiling with QEmu CPU. */
+#ifndef PPC_EXTERN_C
+/*
+ * If it is not defined, we are either compiling "on the QEmu side (C)", or
+ * the file is used with the PearPC implementation. In both cases,
+ * PPC_EXTERN_C should expand to nothing.
+ */
+#define PPC_EXTERN_C
+#endif
+
+/* UAE PPC functions */
+
+void uae_ppc_doze(void);
+void uae_ppc_sync (void);
+void uae_ppc_crash(void);
 
 void uae_ppc_cpu_reboot(void);
 void uae_ppc_cpu_stop(void);
@@ -17,3 +43,44 @@ void uae_ppc_wakeup(void);
 #define PPC_STATE_CRASH 3
 
 extern volatile int ppc_state;
+
+#ifdef __cplusplus
+bool uae_ppc_direct_physical_memory_handle(uint32_t addr, uint8_t *&ptr);
+#endif
+
+PPC_EXTERN_C bool uae_ppc_io_mem_read(uint32_t addr, uint32_t *data, int size);
+PPC_EXTERN_C bool uae_ppc_io_mem_write(uint32_t addr, uint32_t data, int size);
+
+bool uae_ppc_io_mem_read64(uint32_t addr, uint64_t *data);
+bool uae_ppc_io_mem_write64(uint32_t addr, uint64_t data);
+
+extern int ppc_cycle_count;
+
+/* PPC CPU implementation */
+
+PPC_EXTERN_C bool ppc_cpu_init(uint32_t pvr);
+PPC_EXTERN_C void ppc_cpu_free(void);
+
+PPC_EXTERN_C void ppc_cpu_stop(void);
+
+PPC_EXTERN_C void ppc_cpu_atomic_raise_ext_exception(void);
+PPC_EXTERN_C void ppc_cpu_atomic_cancel_ext_exception(void);
+
+PPC_EXTERN_C void ppc_cpu_map_memory(uint32_t addr, uint32_t size, void *memory, const char *name);
+
+PPC_EXTERN_C void ppc_cpu_set_pc(int cpu, uint32_t value);
+PPC_EXTERN_C void ppc_cpu_run_continuous(void);
+PPC_EXTERN_C void ppc_cpu_run_single(int count);
+
+PPC_EXTERN_C uint64_t ppc_cpu_get_dec(void);
+PPC_EXTERN_C void ppc_cpu_do_dec(int value);
+
+#if 0
+uint32 ppc_cpu_get_gpr(int cpu, int i);
+void   ppc_cpu_set_gpr(int cpu, int i, uint32 newvalue);
+void   ppc_cpu_set_msr(int cpu, uint32 newvalue);
+uint32 ppc_cpu_get_pc(int cpu);
+uint32 ppc_cpu_get_pvr(int cpu);
+#endif
+
+#endif // UAE_PPC_H
index ddc35d869ff5ce9288fbd51d12e9d8804866c22d..7495cbc2f293dee5b4ca42413a1d5e19c321b23d 100644 (file)
@@ -60,7 +60,7 @@ void ppc_opc_addx()
  *     addox           Add with Overflow
  *     .422
  */
-void ppc_opc_addox()
+static void ppc_opc_addox()
 {
        int rD, rA, rB;
        PPC_OPC_TEMPL_XO(gCPU.current_opc, rD, rA, rB);
@@ -97,7 +97,7 @@ void ppc_opc_addcx()
  *     addcox          Add Carrying with Overflow
  *     .423
  */
-void ppc_opc_addcox()
+static void ppc_opc_addcox()
 {
        int rD, rA, rB;
        PPC_OPC_TEMPL_XO(gCPU.current_opc, rD, rA, rB);
@@ -161,7 +161,7 @@ void ppc_opc_addex()
  *     addeox          Add Extended with Overflow
  *     .424
  */
-void ppc_opc_addeox()
+static void ppc_opc_addeox()
 {
        int rD, rA, rB;
        PPC_OPC_TEMPL_XO(gCPU.current_opc, rD, rA, rB);
@@ -268,7 +268,7 @@ void ppc_opc_addmex()
  *     addmeox         Add to Minus One Extended with Overflow
  *     .429
  */
-void ppc_opc_addmeox()
+static void ppc_opc_addmeox()
 {
        int rD, rA, rB;
        PPC_OPC_TEMPL_XO(gCPU.current_opc, rD, rA, rB);
@@ -315,7 +315,7 @@ void ppc_opc_addzex()
  *     addzeox         Add to Zero Extended with Overflow
  *     .430
  */
-void ppc_opc_addzeox()
+static void ppc_opc_addzeox()
 {
        int rD, rA, rB;
        PPC_OPC_TEMPL_XO(gCPU.current_opc, rD, rA, rB);
@@ -676,7 +676,7 @@ void ppc_opc_divwx()
  *     divwox          Divide Word with Overflow
  *     .470
  */
-void ppc_opc_divwox()
+static void ppc_opc_divwox()
 {
        int rD, rA, rB;
        PPC_OPC_TEMPL_XO(gCPU.current_opc, rD, rA, rB);
@@ -717,7 +717,7 @@ void ppc_opc_divwux()
  *     divwuox         Divide Word Unsigned with Overflow
  *     .472
  */
-void ppc_opc_divwuox()
+static void ppc_opc_divwuox()
 {
        int rD, rA, rB;
        PPC_OPC_TEMPL_XO(gCPU.current_opc, rD, rA, rB);
@@ -945,7 +945,7 @@ void ppc_opc_negx()
  *     negox           Negate with Overflow
  *     .601
  */
-void ppc_opc_negox()
+static void ppc_opc_negox()
 {
        int rD, rA, rB;
        PPC_OPC_TEMPL_XO(gCPU.current_opc, rD, rA, rB);
@@ -1193,7 +1193,7 @@ void ppc_opc_subfx()
  *     subfox          Subtract From with Overflow
  *     .666
  */
-void ppc_opc_subfox()
+static void ppc_opc_subfox()
 {
        int rD, rA, rB;
        PPC_OPC_TEMPL_XO(gCPU.current_opc, rD, rA, rB);
@@ -1231,7 +1231,7 @@ void ppc_opc_subfcx()
  *     subfcox         Subtract From Carrying with Overflow
  *     .667
  */
-void ppc_opc_subfcox()
+static void ppc_opc_subfcox()
 {
        int rD, rA, rB;
        PPC_OPC_TEMPL_XO(gCPU.current_opc, rD, rA, rB);
@@ -1296,7 +1296,7 @@ void ppc_opc_subfex()
  *     subfeox         Subtract From Extended with Overflow
  *     .668
  */
-void ppc_opc_subfeox()
+static void ppc_opc_subfeox()
 {
        int rD, rA, rB;
        PPC_OPC_TEMPL_XO(gCPU.current_opc, rD, rA, rB);
@@ -1362,7 +1362,7 @@ void ppc_opc_subfmex()
  *     subfmeox        Subtract From Minus One Extended with Overflow
  *     .670
  */
-void ppc_opc_subfmeox()
+static void ppc_opc_subfmeox()
 {
        int rD, rA, rB;
        PPC_OPC_TEMPL_XO(gCPU.current_opc, rD, rA, rB);
@@ -1409,7 +1409,7 @@ void ppc_opc_subfzex()
  *     subfzeox        Subtract From Zero Extended with Overflow
  *     .671
  */
-void ppc_opc_subfzeox()
+static void ppc_opc_subfzeox()
 {
        int rD, rA, rB;
        PPC_OPC_TEMPL_XO(gCPU.current_opc, rD, rA, rB);
index 674f76533b5f4ef883c7866157482443ba931783..f483de17421df91158b68e44cc2ee85a042f825a 100644 (file)
@@ -69,7 +69,7 @@ void ppc_cpu_atomic_cancel_ext_exception()
        sys_unlock_mutex(exception_mutex);
 }
 
-void ppc_cpu_atomic_raise_dec_exception()
+static void ppc_cpu_atomic_raise_dec_exception()
 {
        sys_lock_mutex(exception_mutex);
        gCPU.dec_exception = true;
@@ -78,8 +78,6 @@ void ppc_cpu_atomic_raise_dec_exception()
 }
 
 
-extern int ppc_cycle_count;
-
 static void ppc_do_dec(int val)
 {
        if (gCPU.pdec == 0) {
@@ -96,15 +94,14 @@ static void ppc_do_dec(int val)
        }
 }
 
-void uae_ppc_hsync_handler(void)
+uint64_t ppc_cpu_get_dec(void)
 {
-       if (ppc_state != PPC_STATE_SLEEP)
-               return;
-       if (gCPU.pdec == 0) {
-               uae_ppc_wakeup();
-       } else {
-               ppc_do_dec(ppc_cycle_count);
-       }
+       return gCPU.pdec;
+}
+
+void ppc_cpu_do_dec(int val)
+{
+       ppc_do_dec(val);
 }
 
 static uint ops = 0;
@@ -351,7 +348,7 @@ bool ppc_cpu_init(uint32 pvr)
 
 void ppc_cpu_free(void)
 {
-       sys_destroy_mutex(&exception_mutex);
+       sys_destroy_mutex(exception_mutex);
 }
 
 #if 0
index d611d18df6de08d90c1fe3f036948fbaaae309b6..a3287c7b88b4c205bbd5392bcc1cffb49d9a49f4 100644 (file)
@@ -31,7 +31,7 @@
 
 extern void uae_ppc_doze(void);
 
-void ppc_set_msr(uint32 newmsr)
+static void ppc_set_msr(uint32 newmsr)
 {
 /*     if ((newmsr & MSR_EE) && !(gCPU.msr & MSR_EE)) {
                if (pic_check_interrupt()) {
index 36f05c517993aa96eeae6fabdc0066e22f661827..ae10f72a0c6c8298bd323275930fa5e5567300b3 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "system/types.h"
 
-bool   ppc_init_physical_memory(uint size);
+bool FASTCALL ppc_init_physical_memory(uint size);
 
 uint32  ppc_get_memory_size();
 
index b694e9b89e3087f796ba0b5c09f1cd7f9901aa0f..90966320802a6d34d6ff8611b833788d3f88faa8 100644 (file)
 #define IO_MEM_ACCESS_EXC      1
 #define IO_MEM_ACCESS_FATAL    2
 
-extern bool uae_ppc_io_mem_write(uint32, uint32, int);
-extern bool uae_ppc_io_mem_read(uint32, uint32&, int);
-extern bool uae_ppc_io_mem_write64(uint32, uint64);
-extern bool uae_ppc_io_mem_read64(uint32, uint64&);
+#include "ppc.h"
 
 static inline int io_mem_write(uint32 addr, uint32 data, int size)
 {
@@ -97,7 +94,7 @@ static inline int io_mem_write(uint32 addr, uint32 data, int size)
 
 static inline int io_mem_read(uint32 addr, uint32 &data, int size)
 {
-       if (uae_ppc_io_mem_read(addr, data, size))
+       if (uae_ppc_io_mem_read(addr, &data, size))
                return IO_MEM_ACCESS_OK;
 
 #if 0
@@ -168,7 +165,7 @@ static inline int io_mem_write64(uint32 addr, uint64 data)
 
 static inline int io_mem_read64(uint32 addr, uint64 &data)
 {
-       if (uae_ppc_io_mem_read64(addr, data))
+       if (uae_ppc_io_mem_read64(addr, &data))
                return IO_MEM_ACCESS_OK;
 
 #if 0
index 7ede7a673ad0820f34dbc72e55d2d1a29fef1ac5..fdb881e47f47ce61852b4ecabfe82bc3ddaabd82 100644 (file)
@@ -22,7 +22,7 @@
 #define __SYSTEM_ARCH_SPECIFIC_SYSENDIAN_H__
 
 #include "system/types.h"
-#include "config.h"
+#include "pearpc_config.h"
 
 static inline FUNCTION_CONST uint32 ppc_bswap_word(uint32 data)
 {
index 2309adf37709c31d25f011c9dd6b23a5d051968c..6fd3b651c70c1708c1e806bf8c90797c5ac970c1 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef __SYSTEM_ARCH_SYSENDIAN_H__
 #define __SYSTEM_ARCH_SYSENDIAN_H__
 
-#include "config.h"
+#include "pearpc_config.h"
 
 #include SYSTEM_ARCH_SPECIFIC_ENDIAN_DIR
 
index 7138daadb89939bc88193db9378009acd85b83d0..485461ec77cf071371ebc61672ac71bb03c1be2c 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef __SYSTEM_ARCH_SYSFEATURES_H__
 #define __SYSTEM_ARCH_SYSFEATURES_H__
 
-#include "config.h"
+#include "pearpc_config.h"
 
 #include SYSTEM_ARCH_SPECIFIC_FEATURES_DIR
 
index 23193842e3acef9283d7b514b071fc6ecf1aee9b..67b18556b68ab381b02f968c2ad6f257c2c1be8b 100644 (file)
@@ -24,7 +24,7 @@
 
 #define HAVE_CONFIG_H
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include "pearpc_config.h"
 #endif
 
 #ifdef MIN
@@ -40,6 +40,7 @@
  *     compiler magic
  */
 
+
 #ifdef __GNUC__
 
        // FIXME: configure
@@ -53,7 +54,9 @@
 #      define PACKED           __attribute__((packed))
 #      define UNUSED           __attribute__((unused))
 #      define DEPRECATED       __attribute__((deprecated))
+#ifndef NORETURN
 #      define NORETURN         __attribute__((noreturn))
+#endif
 #      define ALIGN_STRUCT(n)  __attribute__((aligned(n)))
 #      define FORCE_INLINE     __attribute__((always_inline)) 
 
index a6b33415413db05a4777eafb223bd75127a325ae..f512c384e24b229ff2df684ceb344d1130aed74b 100644 (file)
@@ -38,7 +38,8 @@ void ht_assert_failed(const char *file, int line, const char *assertion)
 {
 }
 
+#if 0
 void prom_quiesce()
 {
 }
-
+#endif
index d4a7d3529cd5694b02d732744d4213cc6f65a806..0501b3a8ff3763aba15cc3b3baa39bf4dc81b814 100644 (file)
@@ -1,20 +1,29 @@
-
 #include "sysconfig.h"
 #include "sysdeps.h"
 
 #include "options.h"
 #include "threaddep/thread.h"
-#include "ppc.h"
 #include "memory.h"
 #include "cpuboard.h"
 #include "debug.h"
 #include "custom.h"
 #include "uae.h"
 
-#include "cpu/cpu.h"
+#if defined(__cplusplus) && defined(WITH_QEMU_CPU)
+#define PPC_EXTERN_C extern "C"
+#endif
+
+#include "ppc.h"
+//#include "ppc-if.h"
+
+#ifdef WITH_PEARPC_CPU
+#include "pearpc/cpu/cpu.h"
+#include "pearpc/io/io.h"
+#include "pearpc/cpu/cpu_generic/ppc_cpu.h"
+#endif
 
 #define PPC_SYNC_WRITE 0
-#define PPC_ACCESS_LOG 0
+#define PPC_ACCESS_LOG 2
 
 volatile int ppc_state;
 
@@ -30,11 +39,46 @@ static bool ppc_init_done;
 #define CSPPC_PVR 0x00090204
 #define BLIZZPPC_PVR 0x00070101
 
+#define KB * 1024
+#define MB * (1024 * 1024)
+
+static void map_banks(void)
+{
+#ifdef WITH_QEMU_CPU
+       /*
+        * Use NULL to get callbacks to uae_ppc_io_mem_read/write. Use real
+        * memory address for direct access to RAM banks (looks like this
+        * is needed by JIT, or at least more work is needed on QEmu Side
+        * to allow all memory access to go via callbacks).
+        */
+
+       // FIXME: hack, replace with automatic / dynamic mapping
+#if 1
+       ppc_cpu_map_memory(0x00000000, 2048 KB, NULL,                                             "Chip memory");
+       ppc_cpu_map_memory(0x00BF0000,   64 KB, NULL,                                             "CIA");
+       ppc_cpu_map_memory(0x00F00000,  256 KB, get_real_address(0x00F00000), "CPUBoard F00000");
+       ppc_cpu_map_memory(0x00F50000,  192 KB, NULL,                                             "CPUBoard IO");
+       ppc_cpu_map_memory(0x00DF0000,   64 KB, NULL,                                             "Custom chipset");
+       ppc_cpu_map_memory(0x08000000,  128 MB, get_real_address(0x08000000), "RAMSEY memory (high)");
+       ppc_cpu_map_memory(0xFFF00000,  512 KB, get_real_address(0xFFF00000), "CPUBoard MAPROM");
+#else
+       ppc_cpu_map_memory(0x00BF0000,   64 KB, NULL,                                             "CIA");
+       ppc_cpu_map_memory(0x00F00000,  256 KB, NULL,                                             "CPUBoard F00000");
+       ppc_cpu_map_memory(0x00F50000,  192 KB, NULL,                                             "CPUBoard IO");
+       ppc_cpu_map_memory(0x08000000,  128 MB, NULL,                                             "RAMSEY memory (high)");
+       ppc_cpu_map_memory(0xFFF00000,  512 KB, get_real_address(0xFFF00000), "CPUBoard MAPROM");
+#endif
+#endif
+}
+
 static void uae_ppc_cpu_reset(void)
 {
+#ifdef WITH_PPC
+       write_log("---- uae_ppc_cpu_reset ----\n");
        if (!ppc_init_done) {
                write_log(_T("PPC: Hard reset\n"));
                ppc_cpu_init(currprefs.cpuboard_type == BOARD_BLIZZARDPPC ? BLIZZPPC_PVR : CSPPC_PVR);
+               map_banks();
                ppc_init_done = true;
        }
        write_log(_T("PPC: Init\n"));
@@ -42,10 +86,12 @@ static void uae_ppc_cpu_reset(void)
        ppc_cycle_count = 2000;
        ppc_state = PPC_STATE_ACTIVE;
        ppc_cpu_lock_state = 0;
+#endif
 }
 
 static void *ppc_thread(void *v)
 {
+#ifdef WITH_PPC
        for (;;) {
                uae_u32 v = read_comm_pipe_u32_blocking(&ppcrequests);
                if (v == 0xffffffff)
@@ -59,11 +105,13 @@ static void *ppc_thread(void *v)
        }
 
        ppc_thread_running = false;
+#endif
        return NULL;
 }
 
 void uae_ppc_to_main_thread(void)
 {
+       write_log("---- uae_ppc_to_main_thread ----\n");
        if (ppc_thread_running) {
                write_log(_T("PPC: transferring PPC emulation to main thread.\n"));
                uae_ppc_cpu_stop();
@@ -80,8 +128,11 @@ void uae_ppc_to_main_thread(void)
 
 void uae_ppc_emulate(void)
 {
+#ifdef WITH_PPC
+       write_log("---- uae_ppc_emulate ----\n");
        if (ppc_state == PPC_STATE_ACTIVE || ppc_state == PPC_STATE_SLEEP)
                ppc_cpu_run_single(10);
+#endif
 }
 
 bool uae_ppc_poll_queue(void)
@@ -153,7 +204,7 @@ void uae_ppc_sync (void)
        while (ppc_thread_running && comm_pipe_has_data(&ppcquery));
 }
 
-bool uae_ppc_direct_physical_memory_handle(uint32 addr, byte *&ptr)
+bool uae_ppc_direct_physical_memory_handle(uint32_t addr, uint8_t *&ptr)
 {
        if (valid_address(addr, 0x1000)) {
                ptr = get_real_address(addr);
@@ -162,7 +213,7 @@ bool uae_ppc_direct_physical_memory_handle(uint32 addr, byte *&ptr)
        return false;
 }
 
-bool uae_ppc_io_mem_write(uint32 addr, uint32 data, int size)
+PPC_EXTERN_C bool uae_ppc_io_mem_write(uint32_t addr, uint32_t data, int size)
 {
        while (ppc_thread_running && ppc_cpu_lock_state < 0 && ppc_state);
 
@@ -206,9 +257,9 @@ bool uae_ppc_io_mem_write(uint32 addr, uint32 data, int size)
        return true;
 }
 
-bool uae_ppc_io_mem_read(uint32 addr, uint32 &data, int size)
+PPC_EXTERN_C bool uae_ppc_io_mem_read(uint32_t addr, uint32_t *data, int size)
 {
-       uint32 v;
+       uint32_t v;
 
        while (ppc_thread_running && ppc_cpu_lock_state < 0 && ppc_state);
 
@@ -220,7 +271,7 @@ bool uae_ppc_io_mem_read(uint32 addr, uint32 &data, int size)
                if (addr != 0xbfe001)
                        write_log(_T("PPC io read %08x=%08x %d\n"), addr, v, size);
 #endif
-               data = v;
+               *data = v;
                return true;
        }
 #if PPC_ACCESS_LOG > 0
@@ -243,7 +294,7 @@ bool uae_ppc_io_mem_read(uint32 addr, uint32 &data, int size)
                write_log(_T("unknown ppc read %d %08x\n"), addr, size);
                return false;
        }
-       data = v;
+       *data = v;
 
 #if PPC_ACCESS_LOG > 2
        write_log(_T("PPC mem read %08x=%08x %d\n"), addr, v, size);
@@ -251,13 +302,13 @@ bool uae_ppc_io_mem_read(uint32 addr, uint32 &data, int size)
        return true;
 }
 
-bool uae_ppc_io_mem_write64(uint32 addr, uint64 data)
+bool uae_ppc_io_mem_write64(uint32_t addr, uint64_t data)
 {
        while (ppc_thread_running && ppc_cpu_lock_state < 0 && ppc_state);
 
        if (ppc_thread_running && !valid_address(addr, 8)) {
 #if PPC_ACCESS_LOG > 0
-               write_log(_T("PPC io write64 %08x = %08llx\n"), addr, data);
+               write_log(_T("PPC io write64 %08x = %08llx\n"), addr, (unsigned long long) data);
 #endif
                write_comm_pipe_u32(&ppcquery, addr, 0);
                write_comm_pipe_u32(&ppcquery, 8 | 0x80, 0);
@@ -278,9 +329,9 @@ bool uae_ppc_io_mem_write64(uint32 addr, uint64 data)
        return true;
 }
 
-bool uae_ppc_io_mem_read64(uint32 addr, uint64 &data)
+bool uae_ppc_io_mem_read64(uint32_t addr, uint64_t *data)
 {
-       uae_u32 v1, v2;
+       uint32_t v1, v2;
 
        while (ppc_thread_running && ppc_cpu_lock_state < 0 && ppc_state);
 
@@ -289,23 +340,25 @@ bool uae_ppc_io_mem_read64(uint32 addr, uint64 &data)
                write_comm_pipe_u32(&ppcquery, 8, 0);
                v1 = read_comm_pipe_u32_blocking(&ppcreply);
                v2 = read_comm_pipe_u32_blocking(&ppcreply);
-               data = ((uint64)v1 << 32) | v2;
+               *data = ((uint64_t)v1 << 32) | v2;
 #if PPC_ACCESS_LOG > 0
-               write_log(_T("PPC io read64 %08x = %08llx\n"), addr, data);
+               write_log(_T("PPC io read64 %08x = %08llx\n"), addr, (unsigned long long) *data);
 #endif
                return true;
        }
        v1 = get_long(addr + 0);
        v2 = get_long(addr + 4);
-       data = ((uint64)v1 << 32) | v2;
+       *data = ((uint64_t)v1 << 32) | v2;
 #if PPC_ACCESS_LOG > 2
-       write_log(_T("PPC mem read64 %08x = %08llx\n"), addr, data);
+       write_log(_T("PPC mem read64 %08x = %08llx\n"), addr, *data);
 #endif
        return true;
 }
 
 void uae_ppc_cpu_stop(void)
 {
+       write_log("---- uae_ppc_cpu_stop ----\n");
+#ifdef WITH_PPC
        if (ppc_thread_running && ppc_state) {
                write_log(_T("Stopping PPC.\n"));
                uae_ppc_wakeup();
@@ -318,10 +371,13 @@ void uae_ppc_cpu_stop(void)
                ppc_state = PPC_STATE_STOP;
                write_log(_T("PPC stopped.\n"));
        }
+#endif
 }
 
 void uae_ppc_cpu_reboot(void)
 {
+       write_log("---- uae_ppc_cpu_reboot ----\n");
+#ifdef WITH_PPC
        if (ppc_main_thread) {
                uae_ppc_cpu_reset();
        } else {
@@ -337,10 +393,13 @@ void uae_ppc_cpu_reboot(void)
                }
                write_comm_pipe_u32(&ppcrequests, 1, 1);
        }
+#endif
 }
 
 void uae_ppc_reset(bool hardreset)
 {
+       write_log("---- uae_ppc_reset ----\n");
+#ifdef WITH_PPC
        uae_ppc_cpu_stop();
        ppc_main_thread = false;
        if (hardreset) {
@@ -348,10 +407,12 @@ void uae_ppc_reset(bool hardreset)
                        ppc_cpu_free();
                ppc_init_done = false;
        }
+#endif
 }
 
 void uae_ppc_cpu_lock(void)
 {
+#ifdef WITH_PPC
        // when called, lock was already set by other CPU
        if (ppc_access) {
                // ppc accessing but m68k already locked
@@ -360,64 +421,92 @@ void uae_ppc_cpu_lock(void)
                // m68k accessing but ppc already locked
                ppc_cpu_lock_state = 1;
        }
+#endif
 }
 bool uae_ppc_cpu_unlock(void)
 {
+#ifdef WITH_PPC
        if (!ppc_cpu_lock_state)
                return true;
        ppc_cpu_lock_state = 0;
        return false;
+#endif
 }
 
 void uae_ppc_wakeup(void)
 {
+       write_log("---- uae_ppc_wakeup ----\n");
+#ifdef WITH_PPC
        if (ppc_state == PPC_STATE_SLEEP)
                ppc_state = PPC_STATE_ACTIVE;
+#endif
 }
 
-void ppc_cpu_atomic_raise_ext_exception(void);
-void ppc_cpu_atomic_cancel_ext_exception(void);
-
 void uae_ppc_interrupt(bool active)
 {
+       write_log("---- uae_ppc_interrupt ----\n");
+#ifdef WITH_PPC
        if (active) {
                ppc_cpu_atomic_raise_ext_exception();
                uae_ppc_wakeup();
        } else {
                ppc_cpu_atomic_cancel_ext_exception();
        }
+#endif
 }
 
-
 // sleep until interrupt (or PPC stopped)
 void uae_ppc_doze(void)
 {
+       write_log("---- uae_ppc_doze ----\n");
+#ifdef WITH_PPC
        if (!ppc_thread_running)
                return;
        ppc_state = PPC_STATE_SLEEP;
        while (ppc_state == PPC_STATE_SLEEP) {
                sleep_millis(2);
        }
+#endif
 }
 
 void uae_ppc_crash(void)
 {
+       write_log("---- uae_ppc_crash ----\n");
+#ifdef WITH_PPC
        ppc_state = PPC_STATE_CRASH;
        ppc_cpu_stop();
+#endif
 }
 
+void uae_ppc_hsync_handler(void)
+{
+#ifdef WITH_PPC
+       if (ppc_state != PPC_STATE_SLEEP)
+               return;
+       if (ppc_cpu_get_dec() == 0) {
+               uae_ppc_wakeup();
+       } else {
+               ppc_cpu_do_dec(ppc_cycle_count);
+       }
+#endif
+}
+
+#ifdef WITH_PEARPC_CPU
+
 typedef void * sys_mutex;
 
-int    sys_lock_mutex(sys_mutex m)
+int sys_lock_mutex(sys_mutex m)
 {
        uae_sem_wait(&m);
        return 1;
 }
+
 void sys_unlock_mutex(sys_mutex m)
 {
        uae_sem_post(&m);
 }
-int    sys_create_mutex(sys_mutex *m)
+
+int sys_create_mutex(sys_mutex *m)
 {
        if (!(*m))
                uae_sem_init(m, 0, 1);
@@ -427,4 +516,48 @@ int        sys_create_mutex(sys_mutex *m)
 void sys_destroy_mutex(sys_mutex m)
 {
        uae_sem_destroy(&m);
-}
\ No newline at end of file
+}
+
+#endif
+
+#ifndef _MSV_VER
+#define __cdecl
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void __cdecl pixman_format_supported_source(void);
+void __cdecl pixman_format_supported_source(void) { }
+
+void __cdecl pixman_image_composite(void);
+void __cdecl pixman_image_composite(void) { }
+
+void __cdecl pixman_image_create_bits(void);
+void __cdecl pixman_image_create_bits(void) { }
+
+void __cdecl pixman_image_create_solid_fill(void);
+void __cdecl pixman_image_create_solid_fill(void) { }
+
+void __cdecl pixman_image_fill_rectangles(void);
+void __cdecl pixman_image_fill_rectangles(void) { }
+
+void __cdecl pixman_image_get_data(void);
+void __cdecl pixman_image_get_data(void) { }
+
+void __cdecl pixman_image_get_height(void);
+void __cdecl pixman_image_get_height(void) { }
+
+void __cdecl pixman_image_get_width(void);
+void __cdecl pixman_image_get_width(void) { }
+
+void __cdecl pixman_image_get_stride(void);
+void __cdecl pixman_image_get_stride(void) { }
+
+void __cdecl pixman_image_unref(void);
+void __cdecl pixman_image_unref(void) { }
+
+#ifdef __cplusplus
+}
+#endif
index e0908d3d905de8f5c6d5691dbf4413dee8db1462..faeb4050a59dac8377b1ff04db0b798c3e589bb6 100644 (file)
@@ -368,7 +368,7 @@ static void bcx(int Disp, int L)
 {
     u64 bd = 0;
     int bo = DIS_RD, bi = DIS_RA;
-    char *r = Disp ? "" : (L ? "lr" : "ctr");
+    const char *r = Disp ? "" : (L ? "lr" : "ctr");
     char *ptr = o->operands;
 
     if( DIS_RB && !Disp ) { ill(); return; }
@@ -1768,4 +1768,4 @@ char *PPCDisasmSimple(u64 pc, u32 instr)
     PPCDisasm(&dis_out);
     sprintf(output, "%08X  %08X  %-10s %s", pc, instr, dis_out.mnemonic, dis_out.operands);
     return output;
-}
\ No newline at end of file
+}