mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
Add x64Analyzer to Android.mk. Some minor cleanup
This commit is contained in:
parent
236cb57224
commit
fdcf4f06f2
@ -340,9 +340,6 @@ macro(setup_target_project TargetName ProjectDir)
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# Commented-out files are files that don't compile
|
||||
# and were disabled in the original MSVC project anyway
|
||||
|
||||
set(CommonX86
|
||||
Common/ABI.cpp
|
||||
Common/ABI.h
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
// The corresponding file is called MemTools in the Dolphin project.
|
||||
|
||||
#include "ppsspp_config.h"
|
||||
|
||||
#include "Common/ExceptionHandlerSetup.h"
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
@ -17,7 +19,7 @@
|
||||
#include "Common/Log.h"
|
||||
#include "ext/native/thread/threadutil.h"
|
||||
|
||||
#if defined(PPSSPP_ARCH_X86) || defined(PPSSPP_ARCH_AMD64)
|
||||
#if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
|
||||
#include "Common/MachineContext.h"
|
||||
#endif
|
||||
|
||||
@ -225,7 +227,7 @@ void InstallExceptionHandler(BadAccessHandler badAccessHandler) {
|
||||
void UninstallExceptionHandler() {
|
||||
}
|
||||
|
||||
#elif defined(_POSIX_VERSION) && !defined(_M_GENERIC)
|
||||
#elif defined(_POSIX_VERSION)
|
||||
|
||||
static struct sigaction old_sa_segv;
|
||||
static struct sigaction old_sa_bus;
|
||||
@ -329,7 +331,8 @@ void UninstallExceptionHandler() {
|
||||
NOTICE_LOG(SYSTEM, "Uninstalled exception handler");
|
||||
g_badAccessHandler = nullptr;
|
||||
}
|
||||
#else // _M_GENERIC or unsupported platform
|
||||
|
||||
#else // Unsupported platform. Could also #error
|
||||
|
||||
void InstallExceptionHandler(BadAccessHandler badAccessHandler) {
|
||||
ERROR_LOG(SYSTEM, "Exception handler not implemented on this platform, can't install");
|
||||
|
@ -9,7 +9,7 @@
|
||||
#if PPSSPP_PLATFORM(WINDOWS)
|
||||
#include <windows.h>
|
||||
typedef CONTEXT SContext;
|
||||
#if PPSSPP_ARCH_AMD64
|
||||
#if PPSSPP_ARCH(AMD64)
|
||||
#define CTX_RAX Rax
|
||||
#define CTX_RBX Rbx
|
||||
#define CTX_RCX Rcx
|
||||
@ -46,7 +46,7 @@ typedef CONTEXT SContext;
|
||||
|
||||
#include <mach/mach.h>
|
||||
#include <mach/message.h>
|
||||
#if PPSSPP_ARCH_AMD64
|
||||
#if PPSSPP_ARCH(AMD64)
|
||||
typedef x86_thread_state64_t SContext;
|
||||
#define CTX_RAX __rax
|
||||
#define CTX_RBX __rbx
|
||||
@ -94,7 +94,7 @@ typedef _STRUCT_MCONTEXT64 SContext;
|
||||
#include <ucontext.h>
|
||||
typedef mcontext_t SContext;
|
||||
|
||||
#if PPSSPP_ARCH_AMD64
|
||||
#if PPSSPP_ARCH(AMD64)
|
||||
#define CTX_RAX gregs[REG_RAX]
|
||||
#define CTX_RBX gregs[REG_RBX]
|
||||
#define CTX_RCX gregs[REG_RCX]
|
||||
@ -122,7 +122,7 @@ typedef mcontext_t SContext;
|
||||
#elif defined(__OpenBSD__)
|
||||
#include <signal.h>
|
||||
typedef ucontext_t SContext;
|
||||
#if PPSSPP_ARCH_AMD64
|
||||
#if PPSSPP_ARCH(AMD64)
|
||||
#define CTX_RAX sc_rax
|
||||
#define CTX_RBX sc_rbx
|
||||
#define CTX_RCX sc_rcx
|
||||
@ -146,7 +146,7 @@ typedef ucontext_t SContext;
|
||||
#elif defined(__NetBSD__)
|
||||
#include <ucontext.h>
|
||||
typedef mcontext_t SContext;
|
||||
#if PPSSPP_ARCH_AMD64
|
||||
#if PPSSPP_ARCH(AMD64)
|
||||
#define CTX_RAX __gregs[_REG_RAX]
|
||||
#define CTX_RBX __gregs[_REG_RBX]
|
||||
#define CTX_RCX __gregs[_REG_RCX]
|
||||
@ -170,7 +170,7 @@ typedef mcontext_t SContext;
|
||||
#elif defined(__FreeBSD__)
|
||||
#include <ucontext.h>
|
||||
typedef mcontext_t SContext;
|
||||
#if PPSSPP_ARCH_AMD64
|
||||
#if PPSSPP_ARCH(AMD64)
|
||||
#define CTX_RAX mc_rax
|
||||
#define CTX_RBX mc_rbx
|
||||
#define CTX_RCX mc_rcx
|
||||
@ -194,7 +194,7 @@ typedef mcontext_t SContext;
|
||||
#elif defined(__HAIKU__)
|
||||
#include <signal.h>
|
||||
typedef mcontext_t SContext;
|
||||
#if PPSSPP_ARCH_AMD64
|
||||
#if PPSSPP_ARCH(AMD64)
|
||||
#define CTX_RAX rax
|
||||
#define CTX_RBX rbx
|
||||
#define CTX_RCX rcx
|
||||
@ -219,17 +219,12 @@ typedef mcontext_t SContext;
|
||||
#error No context definition for OS
|
||||
#endif
|
||||
|
||||
#if defined(PPSSPP_ARCH_AMD64) || defined(PPSSPP_ARCH_X86)
|
||||
#if PPSSPP_ARCH(AMD64)
|
||||
|
||||
#include <stddef.h>
|
||||
#define CTX_PC CTX_RIP
|
||||
static inline u64* ContextRN(SContext* ctx, int n)
|
||||
{
|
||||
#if PPSSPP_ARCH_32BIT
|
||||
static const u8 offsets[] = {
|
||||
offsetof(SContext, CTX_RAX), offsetof(SContext, CTX_RCX), offsetof(SContext, CTX_RDX),
|
||||
offsetof(SContext, CTX_RBX), offsetof(SContext, CTX_RSP), offsetof(SContext, CTX_RBP),
|
||||
offsetof(SContext, CTX_RSI), offsetof(SContext, CTX_RDI)};
|
||||
#else
|
||||
static const u8 offsets[] = {
|
||||
offsetof(SContext, CTX_RAX), offsetof(SContext, CTX_RCX), offsetof(SContext, CTX_RDX),
|
||||
offsetof(SContext, CTX_RBX), offsetof(SContext, CTX_RSP), offsetof(SContext, CTX_RBP),
|
||||
@ -237,7 +232,20 @@ static inline u64* ContextRN(SContext* ctx, int n)
|
||||
offsetof(SContext, CTX_R9), offsetof(SContext, CTX_R10), offsetof(SContext, CTX_R11),
|
||||
offsetof(SContext, CTX_R12), offsetof(SContext, CTX_R13), offsetof(SContext, CTX_R14),
|
||||
offsetof(SContext, CTX_R15)};
|
||||
#endif
|
||||
return (u64*)((char*)ctx + offsets[n]);
|
||||
}
|
||||
|
||||
#elif PPSSPP_ARCH(X86)
|
||||
|
||||
#include <stddef.h>
|
||||
#define CTX_PC CTX_RIP
|
||||
|
||||
static inline u32* ContextRN(SContext* ctx, int n)
|
||||
{
|
||||
static const u8 offsets[] = {
|
||||
offsetof(SContext, CTX_RAX), offsetof(SContext, CTX_RCX), offsetof(SContext, CTX_RDX),
|
||||
offsetof(SContext, CTX_RBX), offsetof(SContext, CTX_RSP), offsetof(SContext, CTX_RBP),
|
||||
offsetof(SContext, CTX_RSI), offsetof(SContext, CTX_RDI)};
|
||||
return (u32*)((char*)ctx + offsets[n]);
|
||||
}
|
||||
#endif
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ppsspp_config.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include "util/random/rng.h"
|
||||
@ -148,7 +150,7 @@ extern u8 fromvoffset[128];
|
||||
|
||||
enum class CPUCore;
|
||||
|
||||
#if defined(PPSSPP_ARCH_X86) || defined(PPSSPP_ARCH_AMD64)
|
||||
#if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
|
||||
|
||||
// Note that CTXREG is offset to point at the first floating point register, intentionally. This is so that a byte offset
|
||||
// can reach both GPR and FPR regs.
|
||||
@ -246,7 +248,7 @@ public:
|
||||
|
||||
static const u32 FCR0_VALUE = 0x00003351;
|
||||
|
||||
#if defined(PPSSPP_ARCH_X86) || defined(PPSSPP_ARCH_AMD64)
|
||||
#if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
|
||||
// FPU TEMP0, etc. are swapped in here if necessary (e.g. on x86.)
|
||||
float tempValues[NUM_X86_FPU_TEMPS];
|
||||
#endif
|
||||
|
@ -30,14 +30,14 @@
|
||||
#include "Common/ChunkFile.h"
|
||||
|
||||
|
||||
#if defined(PPSSPP_ARCH_AMD64) || defined(PPSSPP_ARCH_X86)
|
||||
#if PPSSPP_ARCH(AMD64) || PPSSPP_ARCH(X86)
|
||||
#include "Common/MachineContext.h"
|
||||
#include "Common/x64Analyzer.h"
|
||||
#elif defined(PPSSPP_ARCH_ARM64)
|
||||
#elif PPSSPP_ARCH(ARM64)
|
||||
#include "Core/Util/DisArm64.h"
|
||||
typedef sigcontext SContext;
|
||||
#define CTX_PC pc
|
||||
#elif defined(PPSSPP_ARCH_ARM)
|
||||
#elif PPSSPP_ARCH(ARM)
|
||||
#include "ext/disarm.h"
|
||||
typedef sigcontext SContext;
|
||||
#define CTX_PC arm_pc
|
||||
@ -508,19 +508,19 @@ bool HandleFault(uintptr_t hostAddress, void *ctx) {
|
||||
// TODO: Share the struct between the various analyzers, that will allow us to share most of
|
||||
// the implementations here.
|
||||
|
||||
#if defined(PPSSPP_ARCH_AMD64) || defined(PPSSPP_ARCH_X86)
|
||||
#if PPSSPP_ARCH(AMD64) || PPSSPP_ARCH(X86)
|
||||
// X86, X86-64. Variable instruction size so need to analyze the mov instruction in detail.
|
||||
|
||||
// To ignore the access, we need to disassemble the instruction and modify context->CTX_PC
|
||||
LSInstructionInfo info;
|
||||
X86AnalyzeMOV(codePtr, info);
|
||||
#elif defined(PPSSPP_ARCH_ARM64)
|
||||
#elif PPSSPP_ARCH(ARM64)
|
||||
uint32_t word;
|
||||
memcpy(&word, codePtr, 4);
|
||||
// To ignore the access, we need to disassemble the instruction and modify context->CTX_PC
|
||||
Arm64LSInstructionInfo info;
|
||||
Arm64AnalyzeLoadStore((uint64_t)codePtr, word, &info);
|
||||
#elif defined(PPSSPP_ARCH_ARM)
|
||||
#elif PPSSPP_ARCH(ARM)
|
||||
uint32_t word;
|
||||
memcpy(&word, codePtr, 4);
|
||||
// To ignore the access, we need to disassemble the instruction and modify context->CTX_PC
|
||||
|
@ -15,6 +15,7 @@ ifeq ($(TARGET_ARCH_ABI),x86)
|
||||
ARCH_FILES := \
|
||||
$(SRC)/Common/ABI.cpp \
|
||||
$(SRC)/Common/x64Emitter.cpp \
|
||||
$(SRC)/Common/x64Analyzer.cpp \
|
||||
$(SRC)/Common/CPUDetect.cpp \
|
||||
$(SRC)/Common/Thunk.cpp \
|
||||
$(SRC)/Core/MIPS/x86/CompALU.cpp \
|
||||
@ -36,6 +37,7 @@ ifeq ($(TARGET_ARCH_ABI),x86_64)
|
||||
ARCH_FILES := \
|
||||
$(SRC)/Common/ABI.cpp \
|
||||
$(SRC)/Common/x64Emitter.cpp \
|
||||
$(SRC)/Common/x64Analyzer.cpp \
|
||||
$(SRC)/Common/CPUDetect.cpp \
|
||||
$(SRC)/Common/Thunk.cpp \
|
||||
$(SRC)/Core/MIPS/x86/CompALU.cpp \
|
||||
|
Loading…
Reference in New Issue
Block a user