summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/assets/citra.icobin0 -> 509287 bytes
-rw-r--r--src/citra/CMakeLists.txt6
-rw-r--r--src/citra/citra.rcbin3146 -> 566 bytes
-rw-r--r--src/citra_qt/CMakeLists.txt1
-rw-r--r--src/citra_qt/citra-qt.rcbin0 -> 566 bytes
-rw-r--r--src/common/common.h4
-rw-r--r--src/common/common_funcs.h8
-rw-r--r--src/common/log.h12
-rw-r--r--src/common/msg_handler.h2
-rw-r--r--src/common/platform.h4
-rw-r--r--src/common/string_util.cpp6
-rw-r--r--src/common/thread.cpp23
-rw-r--r--src/core/arm/dyncom/arm_dyncom_interpreter.cpp697
-rw-r--r--src/core/arm/skyeye_common/vfp/vfpdouble.cpp2
-rw-r--r--src/core/arm/skyeye_common/vfp/vfpinstr.cpp170
-rw-r--r--src/core/arm/skyeye_common/vfp/vfpsingle.cpp2
16 files changed, 267 insertions, 670 deletions
diff --git a/src/assets/citra.ico b/src/assets/citra.ico
new file mode 100644
index 000000000..4fef651e2
--- /dev/null
+++ b/src/assets/citra.ico
Binary files differ
diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txt
index b06259f5e..94f8d13c7 100644
--- a/src/citra/CMakeLists.txt
+++ b/src/citra/CMakeLists.txt
@@ -2,6 +2,7 @@ set(SRCS
emu_window/emu_window_glfw.cpp
citra.cpp
config.cpp
+ citra.rc
)
set(HEADERS
emu_window/emu_window_glfw.h
@@ -14,7 +15,7 @@ create_directory_groups(${SRCS} ${HEADERS})
add_executable(citra ${SRCS} ${HEADERS})
target_link_libraries(citra core common video_core)
-target_link_libraries(citra ${OPENGL_gl_LIBRARY} ${GLFW_LIBRARIES} inih)
+target_link_libraries(citra ${GLFW_LIBRARIES} ${OPENGL_gl_LIBRARY} inih)
if (UNIX)
target_link_libraries(citra -pthread)
@@ -24,6 +25,9 @@ if (APPLE)
target_link_libraries(citra iconv ${COREFOUNDATION_LIBRARY})
elseif (WIN32)
target_link_libraries(citra winmm)
+ if (MINGW) # GCC does not support codecvt, so use iconv instead
+ target_link_libraries(citra iconv)
+ endif()
else() # Unix
target_link_libraries(citra rt)
endif()
diff --git a/src/citra/citra.rc b/src/citra/citra.rc
index c04acc7ff..c28e7dbe5 100644
--- a/src/citra/citra.rc
+++ b/src/citra/citra.rc
Binary files differ
diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt
index 54d0a1271..356ec754f 100644
--- a/src/citra_qt/CMakeLists.txt
+++ b/src/citra_qt/CMakeLists.txt
@@ -17,6 +17,7 @@ set(SRCS
bootmanager.cpp
hotkeys.cpp
main.cpp
+ citra-qt.rc
)
set(HEADERS
diff --git a/src/citra_qt/citra-qt.rc b/src/citra_qt/citra-qt.rc
new file mode 100644
index 000000000..dd6f834f5
--- /dev/null
+++ b/src/citra_qt/citra-qt.rc
Binary files differ
diff --git a/src/common/common.h b/src/common/common.h
index 66f0ccd0c..ba33373ae 100644
--- a/src/common/common.h
+++ b/src/common/common.h
@@ -50,11 +50,13 @@ private:
#elif defined _WIN32
// Check MSC ver
- #if !defined _MSC_VER || _MSC_VER <= 1000
+ #if defined _MSC_VER && _MSC_VER <= 1000
#error needs at least version 1000 of MSC
#endif
+ #ifndef NOMINMAX
#define NOMINMAX
+ #endif
// Memory leak checks
#define CHECK_HEAP_INTEGRITY()
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h
index ca7abbea6..c2750a63c 100644
--- a/src/common/common_funcs.h
+++ b/src/common/common_funcs.h
@@ -31,7 +31,7 @@ template<> struct CompileTimeAssert<true> {};
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
-#ifndef _WIN32
+#ifndef _MSC_VER
#include <errno.h>
#ifdef __linux__
@@ -75,7 +75,7 @@ inline u64 _rotr64(u64 x, unsigned int shift){
return (x >> n) | (x << (64 - n));
}
-#else // WIN32
+#else // _MSC_VER
#include <locale.h>
// Function Cross-Compatibility
@@ -140,7 +140,7 @@ extern "C" {
}
#define Crash() {DebugBreak();}
#endif // M_IX86
-#endif // WIN32 ndef
+#endif // _MSC_VER ndef
// Dolphin's min and max functions
#undef min
@@ -168,7 +168,7 @@ inline u32 swap24(const u8* _data) {return (_data[0] << 16) | (_data[1] << 8) |
#undef swap64
#endif
-#ifdef _WIN32
+#ifdef _MSC_VER
inline u16 swap16(u16 _data) {return _byteswap_ushort(_data);}
inline u32 swap32(u32 _data) {return _byteswap_ulong (_data);}
inline u64 swap64(u64 _data) {return _byteswap_uint64(_data);}
diff --git a/src/common/log.h b/src/common/log.h
index 96d97249f..667f2fbb9 100644
--- a/src/common/log.h
+++ b/src/common/log.h
@@ -8,7 +8,7 @@
#include "common/msg_handler.h"
#include "common/logging/log.h"
-#ifdef _WIN32
+#ifdef _MSC_VER
#ifndef __func__
#define __func__ __FUNCTION__
#endif
@@ -39,14 +39,18 @@
#define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_)
-#ifdef _WIN32
+#ifndef GEKKO
+#ifdef _MSC_VER
#define _assert_msg_(_t_, _a_, _fmt_, ...) \
if (!(_a_)) {\
if (!PanicYesNo(_fmt_, __VA_ARGS__)) {Crash();} \
}
-#else // not win32
+#else // not msvc
#define _assert_msg_(_t_, _a_, _fmt_, ...) \
if (!(_a_)) {\
if (!PanicYesNo(_fmt_, ##__VA_ARGS__)) {Crash();} \
}
-#endif // WIN32
+#endif // _WIN32
+#else // GEKKO
+#define _assert_msg_(_t_, _a_, _fmt_, ...)
+#endif \ No newline at end of file
diff --git a/src/common/msg_handler.h b/src/common/msg_handler.h
index 7bb216e98..5a483ddb4 100644
--- a/src/common/msg_handler.h
+++ b/src/common/msg_handler.h
@@ -30,7 +30,7 @@ extern bool MsgAlert(bool yes_no, int Style, const char* format, ...)
void SetEnableAlert(bool enable);
#ifndef GEKKO
-#ifdef _WIN32
+#ifdef _MSC_VER
#define SuccessAlert(format, ...) MsgAlert(false, INFORMATION, format, __VA_ARGS__)
#define PanicAlert(format, ...) MsgAlert(false, WARNING, format, __VA_ARGS__)
#define PanicYesNo(format, ...) MsgAlert(true, WARNING, format, __VA_ARGS__)
diff --git a/src/common/platform.h b/src/common/platform.h
index 53d98fe74..ce9cfd4a2 100644
--- a/src/common/platform.h
+++ b/src/common/platform.h
@@ -71,14 +71,18 @@
#include <time.h>
+#ifndef NOMINMAX
#define NOMINMAX
+#endif
#define EMU_FASTCALL __fastcall
+#ifdef _MSC_VER
inline struct tm* localtime_r(const time_t *clock, struct tm *result) {
if (localtime_s(result, clock) == 0)
return result;
return nullptr;
}
+#endif
#else
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp
index d919b7a4c..b3b772bd9 100644
--- a/src/common/string_util.cpp
+++ b/src/common/string_util.cpp
@@ -7,7 +7,7 @@
#include "common/common.h"
#include "common/string_util.h"
-#ifdef _WIN32
+#ifdef _MSC_VER
#include <Windows.h>
#include <codecvt>
#else
@@ -45,7 +45,7 @@ bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list ar
{
int writtenCount;
-#ifdef _WIN32
+#ifdef _MSC_VER
// You would think *printf are simple, right? Iterate on each character,
// if it's a format specifier handle it properly, etc.
//
@@ -410,7 +410,7 @@ std::string UriEncode(const std::string & sSrc)
return sResult;
}
-#ifdef _WIN32
+#ifdef _MSC_VER
std::string UTF16ToUTF8(const std::u16string& input)
{
diff --git a/src/common/thread.cpp b/src/common/thread.cpp
index 8c83d67b5..8bf005857 100644
--- a/src/common/thread.cpp
+++ b/src/common/thread.cpp
@@ -17,7 +17,7 @@ namespace Common
int CurrentThreadId()
{
-#ifdef _WIN32
+#ifdef _MSC_VER
return GetCurrentThreadId();
#elif defined __APPLE__
return mach_thread_self();
@@ -27,6 +27,14 @@ int CurrentThreadId()
}
#ifdef _WIN32
+// Supporting functions
+void SleepCurrentThread(int ms)
+{
+ Sleep(ms);
+}
+#endif
+
+#ifdef _MSC_VER
void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask)
{
@@ -38,12 +46,6 @@ void SetCurrentThreadAffinity(u32 mask)
SetThreadAffinityMask(GetCurrentThread(), mask);
}
-// Supporting functions
-void SleepCurrentThread(int ms)
-{
- Sleep(ms);
-}
-
void SwitchCurrentThread()
{
SwitchToThread();
@@ -82,7 +84,7 @@ void SetCurrentThreadName(const char* szThreadName)
{}
}
-#else // !WIN32, so must be POSIX threads
+#else // !MSVC_VER, so must be POSIX threads
void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask)
{
@@ -106,6 +108,7 @@ void SetCurrentThreadAffinity(u32 mask)
SetThreadAffinity(pthread_self(), mask);
}
+#ifndef _WIN32
void SleepCurrentThread(int ms)
{
usleep(1000 * ms);
@@ -115,7 +118,10 @@ void SwitchCurrentThread()
{
usleep(1000 * 1);
}
+#endif
+// MinGW with the POSIX threading model does not support pthread_setname_np
+#if !defined(_WIN32) || defined(_MSC_VER)
void SetCurrentThreadName(const char* szThreadName)
{
#ifdef __APPLE__
@@ -126,6 +132,7 @@ void SetCurrentThreadName(const char* szThreadName)
pthread_setname_np(pthread_self(), szThreadName);
#endif
}
+#endif
#endif
diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
index 3afc26f56..c61ae0053 100644
--- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
+++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
@@ -18,6 +18,7 @@ using namespace std;
#include "arm_dyncom_thumb.h"
#include "arm_dyncom_run.h"
#include "core/arm/skyeye_common/vfp/vfp.h"
+#include "core/arm/disassembler/arm_disasm.h"
#include "core/mem_map.h"
#include "core/hle/hle.h"
@@ -275,50 +276,7 @@ typedef struct _MiscRegPstIdx {
typedef struct _LSWordorUnsignedByte {
} LDnST;
-#if USER_MODE_OPT
-static inline fault_t interpreter_read_memory(addr_t virt_addr, addr_t phys_addr, uint32_t &value, uint32_t size){
- switch(size) {
- case 8:
- value = Memory::Read8(virt_addr);
- break;
- case 16:
- value = Memory::Read16(virt_addr);
- break;
- case 32:
- value = Memory::Read32(virt_addr);
- break;
- }
- return NO_FAULT;
-}
-
-static inline fault_t interpreter_write_memory(addr_t virt_addr, addr_t phys_addr, uint32_t value, uint32_t size) {
- switch(size) {
- case 8:
- Memory::Write8(virt_addr, value & 0xff);
- break;
- case 16:
- Memory::Write16(virt_addr, value & 0xffff);
- break;
- case 32:
- Memory::Write32(virt_addr, value);
- break;
- }
- return NO_FAULT;
-}
-
-static inline fault_t check_address_validity(arm_core_t *core, addr_t virt_addr, addr_t *phys_addr, uint32_t rw) {
- *phys_addr = virt_addr;
- return NO_FAULT;
-}
-
-#else
-fault_t interpreter_read_memory(cpu_t *cpu, addr_t virt_addr, addr_t phys_addr, uint32_t &value, uint32_t size);
-fault_t interpreter_write_memory(cpu_t *cpu, addr_t virt_addr, addr_t phys_addr, uint32_t value, uint32_t size);
-fault_t interpreter_fetch(cpu_t *cpu, addr_t virt_addr, uint32_t &value, uint32_t size);
-fault_t check_address_validity(arm_core_t *core, addr_t virt_addr, addr_t *phys_addr, uint32_t rw, tlb_type_t access_type = DATA_TLB);
-#endif
-
-typedef fault_t (*get_addr_fp_t)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int &phys_addr, unsigned int rw);
+typedef void (*get_addr_fp_t)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int rw);
typedef struct _ldst_inst {
unsigned int inst;
@@ -336,133 +294,105 @@ int CondPassed(arm_processor *cpu, unsigned int cond);
#define I_BIT BIT(inst, 25)
#define P_BIT BIT(inst, 24)
#define OFFSET_12 BITS(inst, 0, 11)
-fault_t LnSWoUB(ImmediateOffset)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int &phys_addr, unsigned int rw) {
+
+void LnSWoUB(ImmediateOffset)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int rw) {
unsigned int Rn = BITS(inst, 16, 19);
unsigned int addr;
- fault_t fault;
- if (U_BIT) {
+
+ if (U_BIT)
addr = CHECK_READ_REG15_WA(cpu, Rn) + OFFSET_12;
- } else {
+ else
addr = CHECK_READ_REG15_WA(cpu, Rn) - OFFSET_12;
- }
+
virt_addr = addr;
- fault = check_address_validity(cpu, addr, &phys_addr, rw);
- return fault;
}
-fault_t LnSWoUB(RegisterOffset)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int &phys_addr, unsigned int rw) {
- fault_t fault;
+void LnSWoUB(RegisterOffset)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int rw) {
unsigned int Rn = BITS(inst, 16, 19);
unsigned int Rm = BITS(inst, 0, 3);
unsigned int rn = CHECK_READ_REG15_WA(cpu, Rn);
unsigned int rm = CHECK_READ_REG15_WA(cpu, Rm);
unsigned int addr;
- if (U_BIT) {
+
+ if (U_BIT)
addr = rn + rm;
- } else {
+ else
addr = rn - rm;
- }
+
virt_addr = addr;
- fault = check_address_validity(cpu, addr, &phys_addr, rw);
- return fault;
}
-fault_t LnSWoUB(ImmediatePostIndexed)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int &phys_addr, unsigned int rw) {
- fault_t fault;
+void LnSWoUB(ImmediatePostIndexed)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int rw) {
unsigned int Rn = BITS(inst, 16, 19);
unsigned int addr = CHECK_READ_REG15_WA(cpu, Rn);
-
- virt_addr = addr;
- fault = check_address_validity(cpu, addr, &phys_addr, rw);
- if (fault) return fault;
- if (U_BIT) {
+ if (U_BIT)
cpu->Reg[Rn] += OFFSET_12;
- } else {
+ else
cpu->Reg[Rn] -= OFFSET_12;
- }
- return fault;
+
+ virt_addr = addr;
}
-fault_t LnSWoUB(ImmediatePreIndexed)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int &phys_addr, unsigned int rw) {
- fault_t fault;
+void LnSWoUB(ImmediatePreIndexed)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int rw) {
unsigned int Rn = BITS(inst, 16, 19);
unsigned int addr;
- if (U_BIT) {
+
+ if (U_BIT)
addr = CHECK_READ_REG15_WA(cpu, Rn) + OFFSET_12;
- } else {
+ else
addr = CHECK_READ_REG15_WA(cpu, Rn) - OFFSET_12;
- }
virt_addr = addr;
- fault = check_address_validity(cpu, addr, &phys_addr, rw);
- if (fault) return fault;
- if (CondPassed(cpu, BITS(inst, 28, 31))) {
+ if (CondPassed(cpu, BITS(inst, 28, 31)))
cpu->Reg[Rn] = addr;
- }
- return fault;
}
-fault_t MLnS(RegisterPreIndexed)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int &phys_addr, unsigned int rw) {
- fault_t fault;
+void MLnS(RegisterPreIndexed)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int rw) {
unsigned int addr;
unsigned int Rn = BITS(inst, 16, 19);
unsigned int Rm = BITS(inst, 0, 3);
unsigned int rn = CHECK_READ_REG15_WA(cpu, Rn);
unsigned int rm = CHECK_READ_REG15_WA(cpu, Rm);
- if (U_BIT) {
+ if (U_BIT)
addr = rn + rm;
- } else
+ else
addr = rn - rm;
- if(BIT(inst, 20)){ // L BIT
- }
- if(BIT(inst, 6)){ // Sign Bit
- }
- if(BIT(inst, 5)){ // Half Bit
- }
virt_addr = addr;
- fault = check_address_validity(cpu, addr, &phys_addr, rw);
- if (fault) return fault;
- if (CondPassed(cpu, BITS(inst, 28, 31))) {
+ if (CondPassed(cpu, BITS(inst, 28, 31)))
cpu->Reg[Rn] = addr;
- }
- return fault;
}
-fault_t LnSWoUB(RegisterPreIndexed)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int &phys_addr, unsigned int rw) {
- fault_t fault;
+void LnSWoUB(RegisterPreIndexed)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int rw) {
unsigned int Rn = BITS(inst, 16, 19);
unsigned int Rm = BITS(inst, 0, 3);
unsigned int rn = CHECK_READ_REG15_WA(cpu, Rn);
unsigned int rm = CHECK_READ_REG15_WA(cpu, Rm);
unsigned int addr;
- if (U_BIT) {
+
+ if (U_BIT)
addr = rn + rm;
- } else {
+ else
addr = rn - rm;
- }
+
virt_addr = addr;
- fault = check_address_validity(cpu, addr, &phys_addr, rw);
- if(fault)
- return fault;
+
if (CondPassed(cpu, BITS(inst, 28, 31))) {
cpu->Reg[Rn] = addr;
}
- return fault;
}
-fault_t LnSWoUB(ScaledRegisterPreIndexed)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int &phys_addr, unsigned int rw) {
- fault_t fault;
+
+void LnSWoUB(ScaledRegisterPreIndexed)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int rw) {
unsigned int shift = BITS(inst, 5, 6);
unsigned int shift_imm = BITS(inst, 7, 11);
unsigned int Rn = BITS(inst, 16, 19);
unsigned int Rm = BITS(inst, 0, 3);
unsigned int index;
unsigned int addr;
-
unsigned int rm = CHECK_READ_REG15_WA(cpu, Rm);
unsigned int rn = CHECK_READ_REG15_WA(cpu, Rn);
@@ -484,33 +414,27 @@ fault_t LnSWoUB(ScaledRegisterPreIndexed)(arm_processor *cpu, unsigned int inst,
DEBUG_MSG;
break;
}
- if (U_BIT) {
+
+ if (U_BIT)
addr = rn + index;
- } else
+ else
addr = rn - index;
+
virt_addr = addr;
- fault = check_address_validity(cpu, addr, &phys_addr, rw);
- if(fault)
- return fault;
- if (CondPassed(cpu, BITS(inst, 28, 31))) {
- cpu->Reg[Rn] = addr;
- }
- return fault;
+ if (CondPassed(cpu, BITS(inst, 28, 31)))
+ cpu->Reg[Rn] = addr;
}
-fault_t LnSWoUB(ScaledRegisterPostIndexed)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int &phys_addr, unsigned int rw) {
- fault_t fault;
+void LnSWoUB(ScaledRegisterPostIndexed)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int rw) {
unsigned int shift = BITS(inst, 5, 6);
unsigned int shift_imm = BITS(inst, 7, 11);
unsigned int Rn = BITS(inst, 16, 19);
unsigned int Rm = BITS(inst, 0, 3);
unsigned int index;
- unsigned int addr;
-
+ unsigned int addr = CHECK_READ_REG15_WA(cpu, Rn);
unsigned int rm = CHECK_READ_REG15_WA(cpu, Rm);
- unsigned int rn = CHECK_READ_REG15_WA(cpu, Rn);
- addr = rn;
+
switch (shift) {
case 0:
index = rm << shift_imm;
@@ -529,31 +453,23 @@ fault_t LnSWoUB(ScaledRegisterPostIndexed)(arm_processor *cpu, unsigned int inst
DEBUG_MSG;
break;
}
+
virt_addr = addr;
- fault = check_address_validity(cpu, addr, &phys_addr, rw);
- if(fault)
- return fault;
+
if (CondPassed(cpu, BITS(inst, 28, 31))) {
if (U_BIT)
cpu->Reg[Rn] += index;
else
cpu->Reg[Rn] -= index;
}
-
- return fault;
}
-fault_t LnSWoUB(RegisterPostIndexed)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int &phys_addr, unsigned int rw) {
- fault_t fault;
+void LnSWoUB(RegisterPostIndexed)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int rw) {
unsigned int Rn = BITS(inst, 16, 19);
unsigned int Rm = BITS(inst, 0, 3);
unsigned int rm = CHECK_READ_REG15_WA(cpu, Rm);
- unsigned int rn = CHECK_READ_REG15_WA(cpu, Rn);
- unsigned int addr = rn;
- virt_addr = addr;
- fault = check_address_validity(cpu, addr, &phys_addr, rw);
- if (fault) return fault;
+ virt_addr = CHECK_READ_REG15_WA(cpu, Rn);
if (CondPassed(cpu, BITS(inst, 28, 31))) {
if (U_BIT) {
@@ -562,52 +478,40 @@ fault_t LnSWoUB(RegisterPostIndexed)(arm_processor *cpu, unsigned int inst, unsi
cpu->Reg[Rn] -= rm;
}
}
- return fault;
}
-fault_t MLnS(ImmediateOffset)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int &phys_addr, unsigned int rw) {
- fault_t fault;
+void MLnS(ImmediateOffset)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int rw) {
unsigned int immedL = BITS(inst, 0, 3);
unsigned int immedH = BITS(inst, 8, 11);
-
unsigned int Rn = BITS(inst, 16, 19);
unsigned int addr;
unsigned int offset_8 = (immedH << 4) | immedL;
- if (U_BIT) {
+
+ if (U_BIT)
addr = CHECK_READ_REG15_WA(cpu, Rn) + offset_8;
- } else
+ else
addr = CHECK_READ_REG15_WA(cpu, Rn) - offset_8;
virt_addr = addr;
- fault = check_address_validity(cpu, addr, &phys_addr, rw);
- return fault;
}
-fault_t MLnS(RegisterOffset)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int &phys_addr, unsigned int rw) {
- fault_t fault;
+void MLnS(RegisterOffset)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int rw) {
unsigned int addr;
unsigned int Rn = BITS(inst, 16, 19);
unsigned int Rm = BITS(inst, 0, 3);
unsigned int rn = CHECK_READ_REG15_WA(cpu, Rn);
unsigned int rm = CHECK_READ_REG15_WA(cpu, Rm);
- if (U_BIT) {
+
+ if (U_BIT)
addr = rn + rm;
- } else
+ else
addr = rn - rm;
- if(BIT(inst, 20)){ // L BIT
- }
- if(BIT(inst, 6)){ // Sign Bit
- }
- if(BIT(inst, 5)){ // Half Bit
- }
+
virt_addr = addr;
- fault = check_address_validity(cpu, addr, &phys_addr, rw);
- return fault;
}
-fault_t MLnS(ImmediatePreIndexed)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int &phys_addr, unsigned int rw) {
- fault_t fault;
+void MLnS(ImmediatePreIndexed)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int rw) {
unsigned int Rn = BITS(inst, 16, 19);
unsigned int immedH = BITS(inst, 8, 11);
unsigned int immedL = BITS(inst, 0, 3);
@@ -615,189 +519,129 @@ fault_t MLnS(ImmediatePreIndexed)(arm_processor *cpu, unsigned int inst, unsigne
unsigned int rn = CHECK_READ_REG15_WA(cpu, Rn);
unsigned int offset_8 = (immedH << 4) | immedL;
- if (U_BIT) {
+ if (U_BIT)
addr = rn + offset_8;
- } else
+ else
addr = rn - offset_8;
virt_addr = addr;
- fault = check_address_validity(cpu, addr, &phys_addr, rw);
- if (fault) return fault;
- if (CondPassed(cpu, BITS(inst, 28, 31))) {
+ if (CondPassed(cpu, BITS(inst, 28, 31)))
cpu->Reg[Rn] = addr;
- }
- return fault;
}
-fault_t MLnS(ImmediatePostIndexed)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int &phys_addr, unsigned int rw) {
- fault_t fault;
+void MLnS(ImmediatePostIndexed)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int rw) {
unsigned int Rn = BITS(inst, 16, 19);
unsigned int immedH = BITS(inst, 8, 11);
unsigned int immedL = BITS(inst, 0, 3);
- unsigned int addr;
unsigned int rn = CHECK_READ_REG15_WA(cpu, Rn);
- addr = rn;
- virt_addr = addr;
- fault = check_address_validity(cpu, addr, &phys_addr, rw);
- if (fault) return fault;
+ virt_addr = rn;
if (CondPassed(cpu, BITS(inst, 28, 31))) {
unsigned int offset_8 = (immedH << 4) | immedL;
- if (U_BIT) {
+ if (U_BIT)
rn += offset_8;
- } else {
+ else
rn -= offset_8;
- }
+
cpu->Reg[Rn] = rn;
}
-
- return fault;
}
-fault_t MLnS(RegisterPostIndexed)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int &phys_addr, unsigned int rw) {
- fault_t fault;
+
+void MLnS(RegisterPostIndexed)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int rw) {
unsigned int Rn = BITS(inst, 16, 19);
unsigned int Rm = BITS(inst, 0, 3);
unsigned int rm = CHECK_READ_REG15_WA(cpu, Rm);
- unsigned int rn = CHECK_READ_REG15_WA(cpu, Rn);
- unsigned int addr = rn;
- virt_addr = addr;
- fault = check_address_validity(cpu, addr, &phys_addr, rw);
- if (fault) return fault;
+ virt_addr = CHECK_READ_REG15_WA(cpu, Rn);
if (CondPassed(cpu, BITS(inst, 28, 31))) {
- if (U_BIT) {
+ if (U_BIT)
cpu->Reg[Rn] += rm;
- } else {
+ else
cpu->Reg[Rn] -= rm;
- }
}
- return fault;
}
-fault_t LdnStM(DecrementBefore)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int &phys_addr, unsigned int rw) {
- fault_t fault;
+void LdnStM(DecrementBefore)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int rw) {
unsigned int Rn = BITS(inst, 16, 19);
unsigned int i = BITS(inst, 0, 15);
int count = 0;
- while(i) {
- if(i & 1) count ++;
+
+ while (i) {
+ if (i & 1) count++;
i = i >> 1;
}
- unsigned int rn = CHECK_READ_REG15_WA(cpu, Rn);
- unsigned int start_addr = rn - count * 4;
- unsigned int end_addr = rn - 4;
- fault = check_address_validity(cpu, end_addr, &phys_addr, rw);
- virt_addr = end_addr;
- if (fault) return fault;
-
- fault = check_address_validity(cpu, start_addr, &phys_addr, rw);
- virt_addr = start_addr;
- if (fault) return fault;
+ virt_addr = CHECK_READ_REG15_WA(cpu, Rn) - count * 4;
- if (CondPassed(cpu, BITS(inst, 28, 31)) && BIT(inst, 21)) {
+ if (CondPassed(cpu, BITS(inst, 28, 31)) && BIT(inst, 21))
cpu->Reg[Rn] -= count * 4;
- }
-
- return fault;
}
-fault_t LdnStM(IncrementBefore)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int &phys_addr, unsigned int rw) {
- fault_t fault;
+void LdnStM(IncrementBefore)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int rw) {
unsigned int Rn = BITS(inst, 16, 19);
unsigned int i = BITS(inst, 0, 15);
- unsigned int rn = CHECK_READ_REG15_WA(cpu, Rn);
int count = 0;
- while(i) {
- if(i & 1) count ++;
+
+ while (i) {
+ if (i & 1) count++;
i = i >> 1;
}
- unsigned int start_addr = rn + 4;
- unsigned int end_addr = rn + count * 4;
-
- fault = check_address_validity(cpu, end_addr, &phys_addr, rw);
- virt_addr = end_addr;
- if (fault) return fault;
-
- fault = check_address_validity(cpu, start_addr, &phys_addr, rw);
- virt_addr = start_addr;
- if (fault) return fault;
+ virt_addr = CHECK_READ_REG15_WA(cpu, Rn) + 4;
- if (CondPassed(cpu, BITS(inst, 28, 31)) && BIT(inst, 21)) {
+ if (CondPassed(cpu, BITS(inst, 28, 31)) && BIT(inst, 21))
cpu->Reg[Rn] += count * 4;
- }
- return fault;
}
-fault_t LdnStM(IncrementAfter)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int &phys_addr, unsigned int rw) {
- fault_t fault;
+void LdnStM(IncrementAfter)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int rw) {
unsigned int Rn = BITS(inst, 16, 19);
unsigned int i = BITS(inst, 0, 15);
- unsigned int rn = CHECK_READ_REG15_WA(cpu, Rn);
int count = 0;
+
while(i) {
- if(i & 1) count ++;
+ if (i & 1) count++;
i = i >> 1;
}
- unsigned int start_addr = rn;
- unsigned int end_addr = rn + count * 4 - 4;
- fault = check_address_validity(cpu, end_addr, &phys_addr, rw);
- virt_addr = end_addr;
- if (fault) return fault;
-
- fault = check_address_validity(cpu, start_addr, &phys_addr, rw);
- virt_addr = start_addr;
- if (fault) return fault;
+ virt_addr = CHECK_READ_REG15_WA(cpu, Rn);
- if (CondPassed(cpu, BITS(inst, 28, 31)) && BIT(inst, 21)) {
+ if (CondPassed(cpu, BITS(inst, 28, 31)) && BIT(inst, 21))
cpu->Reg[Rn] += count * 4;
- }
- return fault;
}
-fault_t LdnStM(DecrementAfter)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int &phys_addr, unsigned int rw) {
- fault_t fault;
+void LdnStM(DecrementAfter)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int rw) {
unsigned int Rn = BITS(inst, 16, 19);
unsigned int i = BITS(inst, 0, 15);
int count = 0;
while(i) {
- if(i & 1) count ++;
+ if(i & 1) count++;
i = i >> 1;
}
unsigned int rn = CHECK_READ_REG15_WA(cpu, Rn);
unsigned int start_addr = rn - count * 4 + 4;
unsigned int end_addr = rn;
- fault = check_address_validity(cpu, end_addr, &phys_addr, rw);
virt_addr = end_addr;
- if (fault) return fault;
-
- fault = check_address_validity(cpu, start_addr, &phys_addr, rw);
- if (fault) return fault;
virt_addr = start_addr;
if (CondPassed(cpu, BITS(inst, 28, 31)) && BIT(inst, 21)) {
cpu->Reg[Rn] -= count * 4;
}
- return fault;
}
-fault_t LnSWoUB(ScaledRegisterOffset)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int &phys_addr, unsigned int rw) {
- fault_t fault;
+void LnSWoUB(ScaledRegisterOffset)(arm_processor *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int rw) {
unsigned int shift = BITS(inst, 5, 6);
unsigned int shift_imm = BITS(inst, 7, 11);
unsigned int Rn = BITS(inst, 16, 19);
unsigned int Rm = BITS(inst, 0, 3);
unsigned int index;
unsigned int addr;
-
unsigned int rm = CHECK_READ_REG15_WA(cpu, Rm);
unsigned int rn = CHECK_READ_REG15_WA(cpu, Rn);
+
switch (shift) {
case 0:
index = rm << shift_imm;
@@ -815,8 +659,7 @@ fault_t LnSWoUB(ScaledRegisterOffset)(arm_processor *cpu, unsigned int inst, uns
index = 0xFFFFFFFF;
else
index = 0;
- }
- else {
+ } else {
index = static_cast<int>(rm) >> shift_imm;
}
break;
@@ -824,15 +667,13 @@ fault_t LnSWoUB(ScaledRegisterOffset)(arm_processor *cpu, unsigned int inst, uns
DEBUG_MSG;
break;
}
+
if (U_BIT) {
addr = rn + index;
} else
addr = rn - index;
virt_addr = addr;
- fault = check_address_validity(cpu, addr, &phys_addr, rw);
-
- return fault;
}
#define ISNEG(n) (n < 0)
@@ -3567,30 +3408,19 @@ int InterpreterTranslate(arm_processor *cpu, int &bb_start, addr_t addr) {
if (cpu->TFlag)
thumb = THUMB;
- addr_t phys_addr;
- addr_t pc_start;
- fault_t fault = NO_FAULT;
- fault = check_address_validity(cpu, addr, &phys_addr, 1);
- if(fault != NO_FAULT){
- cpu->abortSig = true;
- cpu->Aborted = ARMul_PrefetchAbortV;
- cpu->AbortAddr = addr;
- cpu->CP15[CP15(CP15_INSTR_FAULT_STATUS)] = fault & 0xff;
- cpu->CP15[CP15(CP15_FAULT_ADDRESS)] = addr;
- return FETCH_EXCEPTION;
- }
-
- pc_start = phys_addr;
+ addr_t phys_addr = addr;
+ addr_t pc_start = cpu->Reg[15];
while(ret == NON_BRANCH) {
- inst = Memory::Read32(phys_addr & 0xFFFFFFFC);//*(uint32_t *)(phys_addr & 0xFFFFFFFC);
+ inst = Memory::Read32(phys_addr & 0xFFFFFFFC);
- size ++;
+ size++;
// If we are in thumb instruction, we will translate one thumb to one corresponding arm instruction
if (cpu->TFlag) {
uint32_t arm_inst;
tdstate state;
state = decode_thumb_instr(cpu, inst, phys_addr, &arm_inst, &inst_size, &inst_base);
+
// We have translated the branch instruction of thumb in thumb decoder
if(state == t_branch){
goto translated;
@@ -3600,7 +3430,8 @@ int InterpreterTranslate(arm_processor *cpu, int &bb_start, addr_t addr) {
ret = decode_arm_instr(inst, &idx);
if (ret == DECODE_FAILURE) {
- LOG_ERROR(Core_ARM11, "Decode failure.\tPC : [0x%x]\tInstruction : [%x]", phys_addr, inst);
+ std::string disasm = ARM_Disasm::Disassemble(phys_addr, inst);
+ LOG_ERROR(Core_ARM11, "Decode failure.\tPC : [0x%x]\tInstruction : %s [%x]", phys_addr, disasm.c_str(), inst);
LOG_ERROR(Core_ARM11, "cpsr=0x%x, cpu->TFlag=%d, r15=0x%x", cpu->Cpsr, cpu->TFlag, cpu->Reg[15]);
CITRA_IGNORE_EXIT(-1);
}
@@ -3629,15 +3460,15 @@ void InterpreterInitInstLength(unsigned long long int *ptr, size_t size) {
memcpy(InstLabel, ptr, size);
qsort(InstLabel, array_size, sizeof(void *), cmp);
InstLength = new unsigned int[array_size - 4];
- for (int i = 0; i < array_size - 4; i ++) {
- for (int j = 0; j < array_size; j ++) {
+ for (int i = 0; i < array_size - 4; i++) {
+ for (int j = 0; j < array_size; j++) {
if (ptr[i] == InstLabel[j]) {
InstLength[i] = InstLabel[j + 1] - InstLabel[j];
break;
}
}
}
- for (int i = 0; i < array_size - 4; i ++)
+ for (int i = 0; i < array_size - 4; i++)
LOG_DEBUG(Core_ARM11, "[%d]:%d", i, InstLength[i]);
}
@@ -3954,7 +3785,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
unsigned int phys_addr;
unsigned int last_pc = 0;
unsigned int num_instrs = 0;
- fault_t fault;
+
static unsigned int last_physical_base = 0, last_logical_base = 0;
int ptr;
bool single_step = (cpu->NumInstrsToExecute == 1);
@@ -3975,7 +3806,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
phys_addr = cpu->Reg[15];
- if (find_bb(phys_addr, ptr) == -1)
+ if (find_bb(cpu->Reg[15], ptr) == -1)
if (InterpreterTranslate(cpu, ptr, cpu->Reg[15]) == FETCH_EXCEPTION)
goto END;
@@ -4325,53 +4156,34 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
{
ldst_inst *inst_cream = (ldst_inst *)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
- int i;
- unsigned int ret;
- fault = inst_cream->get_addr(cpu, inst_cream->inst, addr, phys_addr, 1);
- if (fault) {
- goto MMU_EXCEPTION;
- }
+ inst_cream->get_addr(cpu, inst_cream->inst, addr, 1);
+
unsigned int inst = inst_cream->inst;
if (BIT(inst, 22) && !BIT(inst, 15)) {
- for (i = 0; i < 13; i++) {
- if(BIT(inst, i)){
- fault = interpreter_read_memory(addr, phys_addr, ret, 32);
- cpu->Reg[i] = ret;
+ for (int i = 0; i < 13; i++) {
+ if(BIT(inst, i)) {
+ cpu->Reg[i] = Memory::Read32(addr);
addr += 4;
- if ((addr & 0xfff) == 0) {
- fault = check_address_validity(cpu, addr, &phys_addr, 1);
- } else {
- phys_addr += 4;
- }
}
}
if (BIT(inst, 13)) {
- fault = interpreter_read_memory(addr, phys_addr, ret, 32);
-
if (cpu->Mode == USER32MODE)
- cpu->Reg[13] = ret;
+ cpu->Reg[13] = Memory::Read32(addr);
else
- cpu->Reg_usr[0] = ret;
+ cpu->Reg_usr[0] = Memory::Read32(addr);
+
addr += 4;
- if ((addr & 0xfff) == 0) {
- fault = check_address_validity(cpu, addr, &phys_addr, 1);
- } else {
- phys_addr += 4;
- }
}
if (BIT(inst, 14)) {
- fault = interpreter_read_memory(addr, phys_addr, ret, 32);
-
if (cpu->Mode == USER32MODE)
- cpu->Reg[14] = ret;
+ cpu->Reg[14] = Memory::Read32(addr);
else
- cpu->Reg_usr[1] = ret;
+ cpu->Reg_usr[1] = Memory::Read32(addr);
}
} else if (!BIT(inst, 22)) {
- for( i = 0; i < 16; i ++ ){
+ for(int i = 0; i < 16; i++ ){
if(BIT(inst, i)){
- fault = interpreter_read_memory(addr, phys_addr, ret, 32);
- if (fault) goto MMU_EXCEPTION;
+ unsigned int ret = Memory::Read32(addr);
// For armv5t, should enter thumb when bits[0] is non-zero.
if(i == 15){
@@ -4381,39 +4193,25 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
cpu->Reg[i] = ret;
addr += 4;
- if ((addr & 0xfff) == 0) {
- fault = check_address_validity(cpu, addr, &phys_addr, 1);
- } else {
- phys_addr += 4;
- }
}
}
} else if (BIT(inst, 22) && BIT(inst, 15)) {
- for( i = 0; i < 15; i ++ ){
+ for(int i = 0; i < 15; i++ ){
if(BIT(inst, i)){
- fault = interpreter_read_memory(addr, phys_addr, ret, 32);
- cpu->Reg[i] = ret;
+ cpu->Reg[i] = Memory::Read32(addr);
addr += 4;
- if ((addr & 0xfff) == 0) {
- fault = check_address_validity(cpu, addr, &phys_addr, 1);
- } else {
- phys_addr += 4;
- }
}
}
-
+
if (CurrentModeHasSPSR) {
cpu->Cpsr = cpu->Spsr_copy;
switch_mode(cpu, cpu->Cpsr & 0x1f);
LOAD_NZCVT;
}
- fault = interpreter_read_memory(addr, phys_addr, ret, 32);
- if (fault) {
- goto MMU_EXCEPTION;
- }
- cpu->Reg[15] = ret;
- }
+ cpu->Reg[15] = Memory::Read32(addr);
+ }
+
if (BIT(inst, 15)) {
INC_PC(sizeof(ldst_inst));
goto DISPATCH;
@@ -4445,16 +4243,16 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
{
ldst_inst *inst_cream = (ldst_inst *)inst_base->component;
//if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
- fault = inst_cream->get_addr(cpu, inst_cream->inst, addr, phys_addr, 1);
- if (fault) goto MMU_EXCEPTION;
- unsigned int value;
- fault = interpreter_read_memory(addr, phys_addr, value, 32);
+ inst_cream->get_addr(cpu, inst_cream->inst, addr, 1);
+
+ unsigned int value = Memory::Read32(addr);
if (BIT(CP15_REG(CP15_CONTROL), 22) == 1)
cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value;
else {
value = ROTATE_RIGHT_32(value,(8*(addr&0x3)));
cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value;
}
+
if (BITS(inst_cream->inst, 12, 15) == 15) {
// For armv5t, should enter thumb when bits[0] is non-zero.
cpu->TFlag = value & 0x1;
@@ -4463,6 +4261,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
goto DISPATCH;
}
//}
+
cpu->Reg[15] += GET_INST_SIZE(cpu);
INC_PC(sizeof(ldst_inst));
FETCH_INST;
@@ -4472,10 +4271,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
{
ldst_inst *inst_cream = (ldst_inst *)inst_base->component;
if (CondPassed(cpu, inst_base->cond)) {
- fault = inst_cream->get_addr(cpu, inst_cream->inst, addr, phys_addr, 1);
- if (fault) goto MMU_EXCEPTION;
- unsigned int value;
- fault = interpreter_read_memory(addr, phys_addr, value, 32);
+ inst_cream->get_addr(cpu, inst_cream->inst, addr, 1);
+ unsigned int value = Memory::Read32(addr);
if (BIT(CP15_REG(CP15_CONTROL), 22) == 1)
cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value;
else {
@@ -4530,12 +4327,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
{
ldst_inst *inst_cream = (ldst_inst *)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
- fault = inst_cream->get_addr(cpu, inst_cream->inst, addr, phys_addr, 1);
- if (fault) goto MMU_EXCEPTION;
- unsigned int value;
- fault = interpreter_read_memory(addr, phys_addr, value, 8);
- if (fault) goto MMU_EXCEPTION;
- cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value;
+ inst_cream->get_addr(cpu, inst_cream->inst, addr, 1);
+ cpu->Reg[BITS(inst_cream->inst, 12, 15)] = Memory::Read8(addr);
+
if (BITS(inst_cream->inst, 12, 15) == 15) {
INC_PC(sizeof(ldst_inst));
goto DISPATCH;
@@ -4550,12 +4344,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
{
ldst_inst *inst_cream = (ldst_inst *)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
- fault = inst_cream->get_addr(cpu, inst_cream->inst, addr, phys_addr, 1);
- if (fault) goto MMU_EXCEPTION;
- unsigned int value;
- fault = interpreter_read_memory(addr, phys_addr, value, 8);
- if (fault) goto MMU_EXCEPTION;
- cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value;
+ inst_cream->get_addr(cpu, inst_cream->inst, addr, 1);
+ cpu->Reg[BITS(inst_cream->inst, 12, 15)] = Memory::Read8(addr);
+
if (BITS(inst_cream->inst, 12, 15) == 15) {
INC_PC(sizeof(ldst_inst));
goto DISPATCH;
@@ -4571,22 +4362,10 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
ldst_inst *inst_cream = (ldst_inst *)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
// Should check if RD is even-numbered, Rd != 14, addr[0:1] == 0, (CP15_reg1_U == 1 || addr[2] == 0)
- fault = inst_cream->get_addr(cpu, inst_cream->inst, addr, phys_addr, 1);
- if (fault) goto MMU_EXCEPTION;
- uint32_t rear_phys_addr;
- fault = check_address_validity(cpu, addr + 4, &rear_phys_addr, 1);
- if(fault){
- LOG_ERROR(Core_ARM11, "MMU fault , should rollback the above get_addr\n");
- CITRA_IGNORE_EXIT(-1);
- goto MMU_EXCEPTION;
- }
- unsigned int value;
- fault = interpreter_read_memory(addr, phys_addr, value, 32);
- if (fault) goto MMU_EXCEPTION;
- cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value;
- fault = interpreter_read_memory(addr + 4, rear_phys_addr, value, 32);
- if (fault) goto MMU_EXCEPTION;
- cpu->Reg[BITS(inst_cream->inst, 12, 15) + 1] = value;
+ inst_cream->get_addr(cpu, inst_cream->inst, addr, 1);
+
+ cpu->Reg[BITS(inst_cream->inst, 12, 15)] = Memory::Read32(addr);
+ cpu->Reg[BITS(inst_cream->inst, 12, 15) + 1] = Memory::Read32(addr + 4);
// No dispatch since this operation should not modify R15
}
@@ -4601,13 +4380,10 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
ldst_inst *inst_cream = (ldst_inst *)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
addr = cpu->Reg[BITS(inst_cream->inst, 16, 19)];
- fault = check_address_validity(cpu, addr, &phys_addr, 1);
- if (fault) goto MMU_EXCEPTION;
- unsigned int value;
- fault = interpreter_read_memory(addr, phys_addr, value, 32);
- if (fault) goto MMU_EXCEPTION;
- add_exclusive_addr(cpu, phys_addr);
+ unsigned int value = Memory::Read32(addr);
+
+ add_exclusive_addr(cpu, addr);
cpu->exclusive_state = 1;
cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value;
@@ -4626,13 +4402,10 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
ldst_inst *inst_cream = (ldst_inst *)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
addr = cpu->Reg[BITS(inst_cream->inst, 16, 19)];
- fault = check_address_validity(cpu, addr, &phys_addr, 1);
- if (fault) goto MMU_EXCEPTION;
- unsigned int value;
- fault = interpreter_read_memory(addr, phys_addr, value, 8);
- if (fault) goto MMU_EXCEPTION;
- add_exclusive_addr(cpu, phys_addr);
+ unsigned int value = Memory::Read8(addr);
+
+ add_exclusive_addr(cpu, addr);
cpu->exclusive_state = 1;
cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value;
@@ -4650,12 +4423,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
{
ldst_inst *inst_cream = (ldst_inst *)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
- fault = inst_cream->get_addr(cpu, inst_cream->inst, addr, phys_addr, 1);
- if (fault) goto MMU_EXCEPTION;
- unsigned int value = 0;
- fault = interpreter_read_memory(addr, phys_addr, value, 16);
- if (fault) goto MMU_EXCEPTION;
- cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value;
+ inst_cream->get_addr(cpu, inst_cream->inst, addr, 1);
+ cpu->Reg[BITS(inst_cream->inst, 12, 15)] = Memory::Read16(addr);
if (BITS(inst_cream->inst, 12, 15) == 15) {
INC_PC(sizeof(ldst_inst));
goto DISPATCH;
@@ -4670,11 +4439,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
{
ldst_inst *inst_cream = (ldst_inst *)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
- fault = inst_cream->get_addr(cpu, inst_cream->inst, addr, phys_addr, 1);
- if (fault) goto MMU_EXCEPTION;
- unsigned int value;
- fault = interpreter_read_memory(addr, phys_addr, value, 8);
- if (fault) goto MMU_EXCEPTION;
+ inst_cream->get_addr(cpu, inst_cream->inst, addr, 1);
+ unsigned int value = Memory::Read8(addr);
if (BIT(value, 7)) {
value |= 0xffffff00;
}
@@ -4693,11 +4459,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
{
ldst_inst *inst_cream = (ldst_inst *)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
- fault = inst_cream->get_addr(cpu, inst_cream->inst, addr, phys_addr, 1);
- if (fault) goto MMU_EXCEPTION;
- unsigned int value;
- fault = interpreter_read_memory(addr, phys_addr, value, 16);
- if (fault) goto MMU_EXCEPTION;
+ inst_cream->get_addr(cpu, inst_cream->inst, addr, 1);
+ unsigned int value = Memory::Read16(addr);
if (BIT(value, 15)) {
value |= 0xffff0000;
}
@@ -4716,11 +4479,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
{
ldst_inst *inst_cream = (ldst_inst *)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
- fault = inst_cream->get_addr(cpu, inst_cream->inst, addr, phys_addr, 1);
- if (fault) goto MMU_EXCEPTION;
- unsigned int value;
- fault = interpreter_read_memory(addr, phys_addr, value, 32);
- if (fault) goto MMU_EXCEPTION;
+ inst_cream->get_addr(cpu, inst_cream->inst, addr, 1);
+ unsigned int value = Memory::Read32(addr);
cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value;
if (BIT(CP15_REG(CP15_CONTROL), 22) == 1)
@@ -5666,78 +5426,49 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
unsigned int Rn = BITS(inst, 16, 19);
unsigned int old_RN = cpu->Reg[Rn];
- fault = inst_cream->get_addr(cpu, inst_cream->inst, addr, phys_addr, 0);
- if (fault) goto MMU_EXCEPTION;
+ inst_cream->get_addr(cpu, inst_cream->inst, addr, 0);
if (BIT(inst_cream->inst, 22) == 1) {
for (i = 0; i < 13; i++) {
- if(BIT(inst_cream->inst, i)){
- fault = check_address_validity(cpu, addr, &phys_addr, 0);
- if (fault) goto MMU_EXCEPTION;
- fault = interpreter_write_memory(addr, phys_addr, cpu->Reg[i], 32);
- if (fault) goto MMU_EXCEPTION;
+ if(BIT(inst_cream->inst, i)) {
+ Memory::Write32(addr, cpu->Reg[i]);
addr += 4;
- phys_addr += 4;
}
}
if (BIT(inst_cream->inst, 13)) {
if (cpu->Mode == USER32MODE) {
- fault = check_address_validity(cpu, addr, &phys_addr, 0);
- if (fault) goto MMU_EXCEPTION;
- fault = interpreter_write_memory(addr, phys_addr, cpu->Reg[i], 32);
- if (fault) goto MMU_EXCEPTION;
+ Memory::Write32(addr, cpu->Reg[i]);
addr += 4;
- phys_addr += 4;
} else {
- fault = interpreter_write_memory(addr, phys_addr, cpu->Reg_usr[0], 32);
- if (fault) goto MMU_EXCEPTION;
+ Memory::Write32(addr, cpu->Reg_usr[0]);
addr += 4;
- phys_addr += 4;
}
}
if (BIT(inst_cream->inst, 14)) {
if (cpu->Mode == USER32MODE) {
- fault = check_address_validity(cpu, addr, &phys_addr, 0);
- if (fault) goto MMU_EXCEPTION;
- fault = interpreter_write_memory(addr, phys_addr, cpu->Reg[i], 32);
- if (fault) goto MMU_EXCEPTION;
+ Memory::Write32(addr, cpu->Reg[i]);
addr += 4;
- phys_addr += 4;
} else {
- fault = check_address_validity(cpu, addr, &phys_addr, 0);
- if (fault) goto MMU_EXCEPTION;
- fault = interpreter_write_memory(addr, phys_addr, cpu->Reg_usr[1], 32);
- if (fault) goto MMU_EXCEPTION;
+ Memory::Write32(addr, cpu->Reg_usr[1]);
addr += 4;
- phys_addr += 4;
}
}
if (BIT(inst_cream->inst, 15)) {
- fault = check_address_validity(cpu, addr, &phys_addr, 0);
- if (fault) goto MMU_EXCEPTION;
- fault = interpreter_write_memory(addr, phys_addr, cpu->Reg[i] + 8, 32);
- if (fault) goto MMU_EXCEPTION;
+ Memory::Write32(addr, cpu->Reg_usr[1] + 8);
}
} else {
- for( i = 0; i < 15; i ++ ) {
+ for( i = 0; i < 15; i++ ) {
if(BIT(inst_cream->inst, i)) {
- fault = check_address_validity(cpu, addr, &phys_addr, 0);
- if (fault) goto MMU_EXCEPTION;
if(i == Rn)
- fault = interpreter_write_memory(addr, phys_addr, old_RN, 32);
+ Memory::Write32(addr, old_RN);
else
- fault = interpreter_write_memory(addr, phys_addr, cpu->Reg[i], 32);
- if (fault) goto MMU_EXCEPTION;
+ Memory::Write32(addr, cpu->Reg[i]);
addr += 4;
- phys_addr += 4;
}
}
// Check PC reg
if(BIT(inst_cream->inst, i)) {
- fault = check_address_validity(cpu, addr, &phys_addr, 0);
- if (fault) goto MMU_EXCEPTION;
- fault = interpreter_write_memory(addr, phys_addr, cpu->Reg[i] + 8, 32);
- if (fault) goto MMU_EXCEPTION;
+ Memory::Write32(addr, cpu->Reg_usr[1] + 8);
}
}
}
@@ -5770,11 +5501,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
{
ldst_inst *inst_cream = (ldst_inst *)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
- fault = inst_cream->get_addr(cpu, inst_cream->inst, addr, phys_addr, 0);
- if (fault) goto MMU_EXCEPTION;
+ inst_cream->get_addr(cpu, inst_cream->inst, addr, 0);
unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)];
- fault = interpreter_write_memory(addr, phys_addr, value, 32);
- if (fault) goto MMU_EXCEPTION;
+ Memory::Write32(addr, value);
}
cpu->Reg[15] += GET_INST_SIZE(cpu);
INC_PC(sizeof(ldst_inst));
@@ -5811,11 +5540,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
{
ldst_inst *inst_cream = (ldst_inst *)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
- fault = inst_cream->get_addr(cpu, inst_cream->inst, addr, phys_addr, 0);
- if (fault) goto MMU_EXCEPTION;
+ inst_cream->get_addr(cpu, inst_cream->inst, addr, 0);
unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)] & 0xff;
- fault = interpreter_write_memory(addr, phys_addr, value, 8);
- if (fault) goto MMU_EXCEPTION;
+ Memory::Write8(addr, value);
}
cpu->Reg[15] += GET_INST_SIZE(cpu);
INC_PC(sizeof(ldst_inst));
@@ -5826,11 +5553,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
{
ldst_inst *inst_cream = (ldst_inst *)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
- fault = inst_cream->get_addr(cpu, inst_cream->inst, addr, phys_addr, 0);
- if (fault) goto MMU_EXCEPTION;
+ inst_cream->get_addr(cpu, inst_cream->inst, addr, 0);
unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)] & 0xff;
- fault = interpreter_write_memory(addr, phys_addr, value, 8);
- if (fault) goto MMU_EXCEPTION;
+ Memory::Write8(addr, value);
}
cpu->Reg[15] += GET_INST_SIZE(cpu);
INC_PC(sizeof(ldst_inst));
@@ -5841,22 +5566,12 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
{
ldst_inst *inst_cream = (ldst_inst *)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
- fault = inst_cream->get_addr(cpu, inst_cream->inst, addr, phys_addr, 0);
- if (fault) goto MMU_EXCEPTION;
- uint32_t rear_phys_addr;
- fault = check_address_validity(cpu, addr + 4, &rear_phys_addr, 0);
- if (fault){
- LOG_ERROR(Core_ARM11, "MMU fault , should rollback the above get_addr");
- CITRA_IGNORE_EXIT(-1);
- goto MMU_EXCEPTION;
- }
+ inst_cream->get_addr(cpu, inst_cream->inst, addr, 0);
unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)];
- fault = interpreter_write_memory(addr, phys_addr, value, 32);
- if (fault) goto MMU_EXCEPTION;
+ Memory::Write32(addr, value);
value = cpu->Reg[BITS(inst_cream->inst, 12, 15) + 1];
- fault = interpreter_write_memory(addr + 4, rear_phys_addr, value, 32);
- if (fault) goto MMU_EXCEPTION;
+ Memory::Write32(addr + 4, value);
}
cpu->Reg[15] += GET_INST_SIZE(cpu);
INC_PC(sizeof(ldst_inst));
@@ -5869,17 +5584,14 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
addr = cpu->Reg[BITS(inst_cream->inst, 16, 19)];
unsigned int value = cpu->Reg[BITS(inst_cream->inst, 0, 3)];
- fault = check_address_validity(cpu, addr, &phys_addr, 0);
- if (fault) goto MMU_EXCEPTION;
int dest_reg = BITS(inst_cream->inst, 12, 15);
- if((exclusive_detect(cpu, phys_addr) == 0) && (cpu->exclusive_state == 1)){
- remove_exclusive(cpu, phys_addr);
+ if((exclusive_detect(cpu, addr) == 0) && (cpu->exclusive_state == 1)){
+ remove_exclusive(cpu, addr);
cpu->Reg[dest_reg] = 0;
cpu->exclusive_state = 0;
- fault = interpreter_write_memory(addr, phys_addr, value, 32);
- if (fault) goto MMU_EXCEPTION;
+ Memory::Write32(addr, value);
} else {
// Failed to write due to mutex access
cpu->Reg[dest_reg] = 1;
@@ -5896,15 +5608,12 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
addr = cpu->Reg[BITS(inst_cream->inst, 16, 19)];
unsigned int value = cpu->Reg[BITS(inst_cream->inst, 0, 3)] & 0xff;
- fault = check_address_validity(cpu, addr, &phys_addr, 0);
- if (fault) goto MMU_EXCEPTION;
int dest_reg = BITS(inst_cream->inst, 12, 15);
- if((exclusive_detect(cpu, phys_addr) == 0) && (cpu->exclusive_state == 1)){
- remove_exclusive(cpu, phys_addr);
+ if((exclusive_detect(cpu, addr) == 0) && (cpu->exclusive_state == 1)){
+ remove_exclusive(cpu, addr);
cpu->Reg[dest_reg] = 0;
cpu->exclusive_state = 0;
- fault = interpreter_write_memory(addr, phys_addr, value, 8);
- if (fault) goto MMU_EXCEPTION;
+ Memory::Write8(addr, value);
} else {
cpu->Reg[dest_reg] = 1;
}
@@ -5918,11 +5627,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
{
ldst_inst *inst_cream = (ldst_inst *)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
- fault = inst_cream->get_addr(cpu, inst_cream->inst, addr, phys_addr, 0);
- if (fault) goto MMU_EXCEPTION;
+ inst_cream->get_addr(cpu, inst_cream->inst, addr, 0);
unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)] & 0xffff;
- fault = interpreter_write_memory(addr, phys_addr, value, 16);
- if (fault) goto MMU_EXCEPTION;
+ Memory::Write16(addr, value);
}
cpu->Reg[15] += GET_INST_SIZE(cpu);
INC_PC(sizeof(ldst_inst));
@@ -5933,11 +5640,9 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
{
ldst_inst *inst_cream = (ldst_inst *)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
- fault = inst_cream->get_addr(cpu, inst_cream->inst, addr, phys_addr, 0);
- if (fault) goto MMU_EXCEPTION;
+ inst_cream->get_addr(cpu, inst_cream->inst, addr, 0);
unsigned int value = cpu->Reg[BITS(inst_cream->inst, 12, 15)];
- fault = interpreter_write_memory(addr, phys_addr, value, 32);
- if (fault) goto MMU_EXCEPTION;
+ Memory::Write32(addr, value);
}
cpu->Reg[15] += GET_INST_SIZE(cpu);
INC_PC(sizeof(ldst_inst));
@@ -5993,15 +5698,10 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
swp_inst *inst_cream = (swp_inst *)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
addr = RN;
- fault = check_address_validity(cpu, addr, &phys_addr, 1);
- if (fault) goto MMU_EXCEPTION;
unsigned int value;
- fault = interpreter_read_memory(addr, phys_addr, value, 32);
- if (fault) goto MMU_EXCEPTION;
- fault = interpreter_write_memory(addr, phys_addr, RM, 32);
- if (fault) goto MMU_EXCEPTION;
+ value = Memory::Read32(addr);
+ Memory::Write32(addr, RM);
- assert((phys_addr & 0x3) == 0);
RD = value;
}
cpu->Reg[15] += GET_INST_SIZE(cpu);
@@ -6014,13 +5714,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
swp_inst *inst_cream = (swp_inst *)inst_base->component;
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
addr = RN;
- fault = check_address_validity(cpu, addr, &phys_addr, 1);
- if (fault) goto MMU_EXCEPTION;
- unsigned int value;
- fault = interpreter_read_memory(addr, phys_addr, value, 8);
- if (fault) goto MMU_EXCEPTION;
- fault = interpreter_write_memory(addr, phys_addr, (RM & 0xFF), 8);
- if (fault) goto MMU_EXCEPTION;
+ unsigned int value = Memory::Read8(addr);
+ Memory::Write8(addr, (RM & 0xFF));
}
cpu->Reg[15] += GET_INST_SIZE(cpu);
INC_PC(sizeof(swp_inst));
@@ -6650,17 +6345,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
#define VFP_INTERPRETER_IMPL
#include "core/arm/skyeye_common/vfp/vfpinstr.cpp"
#undef VFP_INTERPRETER_IMPL
- MMU_EXCEPTION:
- {
- SAVE_NZCVT;
- cpu->abortSig = true;
- cpu->Aborted = ARMul_DataAbortV;
- cpu->AbortAddr = addr;
- cpu->CP15[CP15(CP15_FAULT_STATUS)] = fault & 0xff;
- cpu->CP15[CP15(CP15_FAULT_ADDRESS)] = addr;
- cpu->NumInstrsToExecute = 0;
- return num_instrs;
- }
+
END:
{
SAVE_NZCVT;
diff --git a/src/core/arm/skyeye_common/vfp/vfpdouble.cpp b/src/core/arm/skyeye_common/vfp/vfpdouble.cpp
index 765c1f6bc..a9df490ba 100644
--- a/src/core/arm/skyeye_common/vfp/vfpdouble.cpp
+++ b/src/core/arm/skyeye_common/vfp/vfpdouble.cpp
@@ -1064,7 +1064,7 @@ vfp_double_multiply(struct vfp_double *vdd, struct vfp_double *vdn,
#define NEG_SUBTRACT (1 << 1)
static u32
-vfp_double_multiply_accumulate(ARMul_State* state, int dd, int dn, int dm, u32 fpscr, u32 negate, char *func)
+vfp_double_multiply_accumulate(ARMul_State* state, int dd, int dn, int dm, u32 fpscr, u32 negate, const char *func)
{
struct vfp_double vdd, vdp, vdn, vdm;
u32 exceptions;
diff --git a/src/core/arm/skyeye_common/vfp/vfpinstr.cpp b/src/core/arm/skyeye_common/vfp/vfpinstr.cpp
index cc70fc33c..b5fcbac86 100644
--- a/src/core/arm/skyeye_common/vfp/vfpinstr.cpp
+++ b/src/core/arm/skyeye_common/vfp/vfpinstr.cpp
@@ -2891,32 +2891,15 @@ VSTR_INST:
unsigned int base = (inst_cream->n == 15 ? (cpu->Reg[inst_cream->n] & 0xFFFFFFFC) + 8 : cpu->Reg[inst_cream->n]);
addr = (inst_cream->add ? base + inst_cream->imm32 : base - inst_cream->imm32);
- DBG("VSTR :\n");
-
-
+
if (inst_cream->single)
{
- fault = check_address_validity(cpu, addr, &phys_addr, 0);
- if (fault) goto MMU_EXCEPTION;
- fault = interpreter_write_memory(addr, phys_addr, cpu->ExtReg[inst_cream->d], 32);
- if (fault) goto MMU_EXCEPTION;
- DBG("\taddr[%x] <= s%d=[%x]\n", addr, inst_cream->d, cpu->ExtReg[inst_cream->d]);
+ Memory::Write32(addr, cpu->ExtReg[inst_cream->d]);
}
else
{
- fault = check_address_validity(cpu, addr, &phys_addr, 0);
- if (fault) goto MMU_EXCEPTION;
-
- /* Check endianness */
- fault = interpreter_write_memory(addr, phys_addr, cpu->ExtReg[inst_cream->d*2], 32);
- if (fault) goto MMU_EXCEPTION;
-
- fault = check_address_validity(cpu, addr + 4, &phys_addr, 0);
- if (fault) goto MMU_EXCEPTION;
-
- fault = interpreter_write_memory(addr + 4, phys_addr, cpu->ExtReg[inst_cream->d*2+1], 32);
- if (fault) goto MMU_EXCEPTION;
- DBG("\taddr[%x-%x] <= s[%d-%d]=[%x-%x]\n", addr+4, addr, inst_cream->d*2+1, inst_cream->d*2, cpu->ExtReg[inst_cream->d*2+1], cpu->ExtReg[inst_cream->d*2]);
+ Memory::Write32(addr, cpu->ExtReg[inst_cream->d*2]);
+ Memory::Write32(addr + 4, cpu->ExtReg[inst_cream->d*2+1]);
}
}
cpu->Reg[15] += GET_INST_SIZE(cpu);
@@ -3027,47 +3010,27 @@ VPUSH_INST:
{
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
CHECK_VFP_ENABLED;
-
int i;
vpush_inst *inst_cream = (vpush_inst *)inst_base->component;
- DBG("VPUSH :\n");
-
addr = cpu->Reg[R13] - inst_cream->imm32;
-
for (i = 0; i < inst_cream->regs; i++)
{
if (inst_cream->single)
{
- fault = check_address_validity(cpu, addr, &phys_addr, 0);
- if (fault) goto MMU_EXCEPTION;
- fault = interpreter_write_memory(addr, phys_addr, cpu->ExtReg[inst_cream->d+i], 32);
- if (fault) goto MMU_EXCEPTION;
- DBG("\taddr[%x] <= s%d=[%x]\n", addr, inst_cream->d+i, cpu->ExtReg[inst_cream->d+i]);
+ Memory::Write32(addr, cpu->ExtReg[inst_cream->d+i]);
addr += 4;
}
else
{
- /* Careful of endianness, little by default */
- fault = check_address_validity(cpu, addr, &phys_addr, 0);
- if (fault) goto MMU_EXCEPTION;
- fault = interpreter_write_memory(addr, phys_addr, cpu->ExtReg[(inst_cream->d+i)*2], 32);
- if (fault) goto MMU_EXCEPTION;
-
- fault = check_address_validity(cpu, addr + 4, &phys_addr, 0);
- if (fault) goto MMU_EXCEPTION;
- fault = interpreter_write_memory(addr + 4, phys_addr, cpu->ExtReg[(inst_cream->d+i)*2 + 1], 32);
- if (fault) goto MMU_EXCEPTION;
- DBG("\taddr[%x-%x] <= s[%d-%d]=[%x-%x]\n", addr+4, addr, (inst_cream->d+i)*2+1, (inst_cream->d+i)*2, cpu->ExtReg[(inst_cream->d+i)*2+1], cpu->ExtReg[(inst_cream->d+i)*2]);
+ Memory::Write32(addr, cpu->ExtReg[(inst_cream->d+i)*2]);
+ Memory::Write32(addr + 4, cpu->ExtReg[(inst_cream->d+i)*2 + 1]);
addr += 8;
}
}
- DBG("\tsp[%x]", cpu->Reg[R13]);
cpu->Reg[R13] = cpu->Reg[R13] - inst_cream->imm32;
- DBG("=>[%x]\n", cpu->Reg[R13]);
-
}
cpu->Reg[15] += GET_INST_SIZE(cpu);
INC_PC(sizeof(vpush_inst));
@@ -3110,7 +3073,7 @@ int DYNCOM_TRANS(vpush)(cpu_t *cpu, uint32_t instr, BasicBlock *bb, addr_t pc){
{
if (single)
{
- //fault = interpreter_write_memory(addr, phys_addr, cpu->ExtReg[inst_cream->d+i], 32);
+ //Memory::Write32(addr, cpu->ExtReg[inst_cream->d+i]);
#if 0
phys_addr = get_phys_addr(cpu, bb, Addr, 0);
bb = cpu->dyncom_engine->bb;
@@ -3199,43 +3162,24 @@ VSTM_INST: /* encoding 1 */
vstm_inst *inst_cream = (vstm_inst *)inst_base->component;
addr = (inst_cream->add ? cpu->Reg[inst_cream->n] : cpu->Reg[inst_cream->n] - inst_cream->imm32);
- DBG("VSTM : addr[%x]\n", addr);
-
-
+
for (i = 0; i < inst_cream->regs; i++)
{
if (inst_cream->single)
{
- fault = check_address_validity(cpu, addr, &phys_addr, 0);
- if (fault) goto MMU_EXCEPTION;
-
- fault = interpreter_write_memory(addr, phys_addr, cpu->ExtReg[inst_cream->d+i], 32);
- if (fault) goto MMU_EXCEPTION;
- DBG("\taddr[%x] <= s%d=[%x]\n", addr, inst_cream->d+i, cpu->ExtReg[inst_cream->d+i]);
+ Memory::Write32(addr, cpu->ExtReg[inst_cream->d+i]);
addr += 4;
}
else
{
- /* Careful of endianness, little by default */
- fault = check_address_validity(cpu, addr, &phys_addr, 0);
- if (fault) goto MMU_EXCEPTION;
-
- fault = interpreter_write_memory(addr, phys_addr, cpu->ExtReg[(inst_cream->d+i)*2], 32);
- if (fault) goto MMU_EXCEPTION;
-
- fault = check_address_validity(cpu, addr + 4, &phys_addr, 0);
- if (fault) goto MMU_EXCEPTION;
-
- fault = interpreter_write_memory(addr + 4, phys_addr, cpu->ExtReg[(inst_cream->d+i)*2 + 1], 32);
- if (fault) goto MMU_EXCEPTION;
- DBG("\taddr[%x-%x] <= s[%d-%d]=[%x-%x]\n", addr+4, addr, (inst_cream->d+i)*2+1, (inst_cream->d+i)*2, cpu->ExtReg[(inst_cream->d+i)*2+1], cpu->ExtReg[(inst_cream->d+i)*2]);
+ Memory::Write32(addr, cpu->ExtReg[(inst_cream->d+i)*2]);
+ Memory::Write32(addr + 4, cpu->ExtReg[(inst_cream->d+i)*2 + 1]);
addr += 8;
}
}
if (inst_cream->wback){
cpu->Reg[inst_cream->n] = (inst_cream->add ? cpu->Reg[inst_cream->n] + inst_cream->imm32 :
cpu->Reg[inst_cream->n] - inst_cream->imm32);
- DBG("\twback r%d[%x]\n", inst_cream->n, cpu->Reg[inst_cream->n]);
}
}
@@ -3290,7 +3234,7 @@ int DYNCOM_TRANS(vstm)(cpu_t *cpu, uint32_t instr, BasicBlock *bb, addr_t pc){
if (single)
{
- //fault = interpreter_write_memory(addr, phys_addr, cpu->ExtReg[inst_cream->d+i], 32);
+ //Memory::Write32(addr, cpu->ExtReg[inst_cream->d+i]);
/* if R(i) is R15? */
#if 0
phys_addr = get_phys_addr(cpu, bb, Addr, 0);
@@ -3300,14 +3244,13 @@ int DYNCOM_TRANS(vstm)(cpu_t *cpu, uint32_t instr, BasicBlock *bb, addr_t pc){
//memory_write(cpu, bb, Addr, RSPR(d + i), 32);
memory_write(cpu, bb, Addr, IBITCAST32(FR32(d + i)),32);
bb = cpu->dyncom_engine->bb;
- //if (fault) goto MMU_EXCEPTION;
//DBG("\taddr[%x] <= s%d=[%x]\n", addr, inst_cream->d+i, cpu->ExtReg[inst_cream->d+i]);
Addr = ADD(Addr, CONST(4));
}
else
{
- //fault = interpreter_write_memory(addr, phys_addr, cpu->ExtReg[(inst_cream->d+i)*2], 32);
+ //Memory::Write32(addr, cpu->ExtReg[(inst_cream->d+i)*2]);
#if 0
phys_addr = get_phys_addr(cpu, bb, Addr, 0);
bb = cpu->dyncom_engine->bb;
@@ -3316,9 +3259,8 @@ int DYNCOM_TRANS(vstm)(cpu_t *cpu, uint32_t instr, BasicBlock *bb, addr_t pc){
//memory_write(cpu, bb, Addr, RSPR((d + i) * 2), 32);
memory_write(cpu, bb, Addr, IBITCAST32(FR32((d + i) * 2)),32);
bb = cpu->dyncom_engine->bb;
- //if (fault) goto MMU_EXCEPTION;
- //fault = interpreter_write_memory(addr + 4, phys_addr, cpu->ExtReg[(inst_cream->d+i)*2 + 1], 32);
+ //Memory::Write32(addr + 4, cpu->ExtReg[(inst_cream->d+i)*2 + 1]);
#if 0
phys_addr = get_phys_addr(cpu, bb, ADD(Addr, CONST(4)), 0);
bb = cpu->dyncom_engine->bb;
@@ -3327,7 +3269,6 @@ int DYNCOM_TRANS(vstm)(cpu_t *cpu, uint32_t instr, BasicBlock *bb, addr_t pc){
//memory_write(cpu, bb, ADD(Addr, CONST(4)), RSPR((d + i) * 2 + 1), 32);
memory_write(cpu, bb, ADD(Addr, CONST(4)), IBITCAST32(FR32((d + i) * 2 + 1)), 32);
bb = cpu->dyncom_engine->bb;
- //if (fault) goto MMU_EXCEPTION;
//DBG("\taddr[%x-%x] <= s[%d-%d]=[%x-%x]\n", addr+4, addr, (inst_cream->d+i)*2+1, (inst_cream->d+i)*2, cpu->ExtReg[(inst_cream->d+i)*2+1], cpu->ExtReg[(inst_cream->d+i)*2]);
//addr += 8;
Addr = ADD(Addr, CONST(8));
@@ -3385,49 +3326,27 @@ VPOP_INST:
unsigned int value1, value2;
vpop_inst *inst_cream = (vpop_inst *)inst_base->component;
-
- DBG("VPOP :\n");
-
+
addr = cpu->Reg[R13];
-
for (i = 0; i < inst_cream->regs; i++)
{
if (inst_cream->single)
{
- fault = check_address_validity(cpu, addr, &phys_addr, 1);
- if (fault) goto MMU_EXCEPTION;
-
- fault = interpreter_read_memory(addr, phys_addr, value1, 32);
- if (fault) goto MMU_EXCEPTION;
- DBG("\ts%d <= [%x] addr[%x]\n", inst_cream->d+i, value1, addr);
+ value1 = Memory::Read32(addr);
cpu->ExtReg[inst_cream->d+i] = value1;
addr += 4;
}
else
{
- /* Careful of endianness, little by default */
- fault = check_address_validity(cpu, addr, &phys_addr, 1);
- if (fault) goto MMU_EXCEPTION;
-
- fault = interpreter_read_memory(addr, phys_addr, value1, 32);
- if (fault) goto MMU_EXCEPTION;
-
- fault = check_address_validity(cpu, addr + 4, &phys_addr, 1);
- if (fault) goto MMU_EXCEPTION;
-
- fault = interpreter_read_memory(addr + 4, phys_addr, value2, 32);
- if (fault) goto MMU_EXCEPTION;
- DBG("\ts[%d-%d] <= [%x-%x] addr[%x-%x]\n", (inst_cream->d+i)*2+1, (inst_cream->d+i)*2, value2, value1, addr+4, addr);
+ value1 = Memory::Read32(addr);
+ value2 = Memory::Read32(addr + 4);
cpu->ExtReg[(inst_cream->d+i)*2] = value1;
cpu->ExtReg[(inst_cream->d+i)*2 + 1] = value2;
addr += 8;
}
}
- DBG("\tsp[%x]", cpu->Reg[R13]);
cpu->Reg[R13] = cpu->Reg[R13] + inst_cream->imm32;
- DBG("=>[%x]\n", cpu->Reg[R13]);
-
}
cpu->Reg[15] += GET_INST_SIZE(cpu);
INC_PC(sizeof(vpop_inst));
@@ -3565,33 +3484,19 @@ VLDR_INST:
unsigned int base = (inst_cream->n == 15 ? (cpu->Reg[inst_cream->n] & 0xFFFFFFFC) + 8 : cpu->Reg[inst_cream->n]);
addr = (inst_cream->add ? base + inst_cream->imm32 : base - inst_cream->imm32);
- DBG("VLDR :\n", addr);
-
-
+
if (inst_cream->single)
{
- fault = check_address_validity(cpu, addr, &phys_addr, 1);
- if (fault) goto MMU_EXCEPTION;
- fault = interpreter_read_memory(addr, phys_addr, cpu->ExtReg[inst_cream->d], 32);
- if (fault) goto MMU_EXCEPTION;
- DBG("\ts%d <= [%x] addr[%x]\n", inst_cream->d, cpu->ExtReg[inst_cream->d], addr);
+ cpu->ExtReg[inst_cream->d] = Memory::Read32(addr);
}
else
{
unsigned int word1, word2;
- fault = check_address_validity(cpu, addr, &phys_addr, 1);
- if (fault) goto MMU_EXCEPTION;
- fault = interpreter_read_memory(addr, phys_addr, word1, 32);
- if (fault) goto MMU_EXCEPTION;
-
- fault = check_address_validity(cpu, addr + 4, &phys_addr, 1);
- if (fault) goto MMU_EXCEPTION;
- fault = interpreter_read_memory(addr + 4, phys_addr, word2, 32);
- if (fault) goto MMU_EXCEPTION;
- /* Check endianness */
+ word1 = Memory::Read32(addr);
+ word2 = Memory::Read32(addr + 4);
+
cpu->ExtReg[inst_cream->d*2] = word1;
cpu->ExtReg[inst_cream->d*2+1] = word2;
- DBG("\ts[%d-%d] <= [%x-%x] addr[%x-%x]\n", inst_cream->d*2+1, inst_cream->d*2, word2, word1, addr+4, addr);
}
}
cpu->Reg[15] += GET_INST_SIZE(cpu);
@@ -3729,32 +3634,18 @@ VLDM_INST:
vldm_inst *inst_cream = (vldm_inst *)inst_base->component;
addr = (inst_cream->add ? cpu->Reg[inst_cream->n] : cpu->Reg[inst_cream->n] - inst_cream->imm32);
- DBG("VLDM : addr[%x]\n", addr);
-
+
for (i = 0; i < inst_cream->regs; i++)
{
if (inst_cream->single)
{
- fault = check_address_validity(cpu, addr, &phys_addr, 1);
- if (fault) goto MMU_EXCEPTION;
- fault = interpreter_read_memory(addr, phys_addr, cpu->ExtReg[inst_cream->d+i], 32);
- if (fault) goto MMU_EXCEPTION;
- DBG("\ts%d <= [%x] addr[%x]\n", inst_cream->d+i, cpu->ExtReg[inst_cream->d+i], addr);
+ cpu->ExtReg[inst_cream->d+i] = Memory::Read32(addr);
addr += 4;
}
else
{
- /* Careful of endianness, little by default */
- fault = check_address_validity(cpu, addr, &phys_addr, 1);
- if (fault) goto MMU_EXCEPTION;
- fault = interpreter_read_memory(addr, phys_addr, cpu->ExtReg[(inst_cream->d+i)*2], 32);
- if (fault) goto MMU_EXCEPTION;
-
- fault = check_address_validity(cpu, addr + 4, &phys_addr, 1);
- if (fault) goto MMU_EXCEPTION;
- fault = interpreter_read_memory(addr + 4, phys_addr, cpu->ExtReg[(inst_cream->d+i)*2 + 1], 32);
- if (fault) goto MMU_EXCEPTION;
- DBG("\ts[%d-%d] <= [%x-%x] addr[%x-%x]\n", (inst_cream->d+i)*2+1, (inst_cream->d+i)*2, cpu->ExtReg[(inst_cream->d+i)*2+1], cpu->ExtReg[(inst_cream->d+i)*2], addr+4, addr);
+ cpu->ExtReg[(inst_cream->d+i)*2] = Memory::Read32(addr);
+ cpu->ExtReg[(inst_cream->d+i)*2 + 1] = Memory::Read32(addr + 4);
addr += 8;
}
}
@@ -3815,7 +3706,7 @@ int DYNCOM_TRANS(vldm)(cpu_t *cpu, uint32_t instr, BasicBlock *bb, addr_t pc){
if (single)
{
- //fault = interpreter_write_memory(addr, phys_addr, cpu->ExtReg[inst_cream->d+i], 32);
+ //Memory::Write32(addr, cpu->ExtReg[inst_cream->d+i]);
/* if R(i) is R15? */
#if 0
phys_addr = get_phys_addr(cpu, bb, Addr, 1);
@@ -3827,7 +3718,6 @@ int DYNCOM_TRANS(vldm)(cpu_t *cpu, uint32_t instr, BasicBlock *bb, addr_t pc){
val = new LoadInst(cpu->dyncom_engine->read_value, "", false, bb);
//LETS(d + i, val);
LETFPS(d + i, FPBITCAST32(val));
- //if (fault) goto MMU_EXCEPTION;
//DBG("\taddr[%x] <= s%d=[%x]\n", addr, inst_cream->d+i, cpu->ExtReg[inst_cream->d+i]);
Addr = ADD(Addr, CONST(4));
}
@@ -3852,7 +3742,7 @@ int DYNCOM_TRANS(vldm)(cpu_t *cpu, uint32_t instr, BasicBlock *bb, addr_t pc){
val = new LoadInst(cpu->dyncom_engine->read_value, "", false, bb);
LETFPS((d + i) * 2 + 1, FPBITCAST32(val));
- //fault = interpreter_write_memory(addr + 4, phys_addr, cpu->ExtReg[(inst_cream->d+i)*2 + 1], 32);
+ //Memory::Write(addr + 4, phys_addr, cpu->ExtReg[(inst_cream->d+i)*2 + 1], 32);
//DBG("\taddr[%x-%x] <= s[%d-%d]=[%x-%x]\n", addr+4, addr, (inst_cream->d+i)*2+1, (inst_cream->d+i)*2, cpu->ExtReg[(inst_cream->d+i)*2+1], cpu->ExtReg[(inst_cream->d+i)*2]);
//addr += 8;
Addr = ADD(Addr, CONST(8));
diff --git a/src/core/arm/skyeye_common/vfp/vfpsingle.cpp b/src/core/arm/skyeye_common/vfp/vfpsingle.cpp
index 6c33d8b78..08d0d719f 100644
--- a/src/core/arm/skyeye_common/vfp/vfpsingle.cpp
+++ b/src/core/arm/skyeye_common/vfp/vfpsingle.cpp
@@ -957,7 +957,7 @@ vfp_single_multiply(struct vfp_single *vsd, struct vfp_single *vsn, struct vfp_s
#define NEG_SUBTRACT (1 << 1)
static u32
-vfp_single_multiply_accumulate(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr, u32 negate, char *func)
+vfp_single_multiply_accumulate(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr, u32 negate, const char *func)
{
{