Untested support for Android-x86. No idea if this actually works.

This commit is contained in:
Henrik Rydgard 2013-03-21 20:52:33 +01:00
parent f355137156
commit 5293c152c6
12 changed files with 124 additions and 62 deletions

View File

@ -37,53 +37,37 @@
#include <sys/types.h>
#include <machine/cpufunc.h>
#elif !defined(MIPS)
static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
unsigned int *ecx, unsigned int *edx)
void __cpuid(int regs[4], int cpuid_leaf)
{
#if defined _M_GENERIC
(*eax) = (*ebx) = (*ecx) = (*edx) = 0;
#elif defined _LP64
// Note: EBX is reserved on Mac OS X and in PIC on Linux, so it has to
// restored at the end of the asm block.
__asm__ (
"cpuid;"
"movl %%ebx,%1;"
: "=a" (*eax),
"=S" (*ebx),
"=c" (*ecx),
"=d" (*edx)
: "a" (*eax)
: "rbx"
);
#else
__asm__ (
"cpuid;"
"movl %%ebx,%1;"
: "=a" (*eax),
"=S" (*ebx),
"=c" (*ecx),
"=d" (*edx)
: "a" (*eax)
: "ebx"
);
int eax, ebx, ecx, edx;
asm volatile (
#if defined(__i386__)
"pushl %%ebx;\n\t"
#endif
}
#endif /* defined __FreeBSD__ */
"movl %4, %%eax;\n\t"
"cpuid;\n\t"
"movl %%eax, %0;\n\t"
"movl %%ebx, %1;\n\t"
"movl %%ecx, %2;\n\t"
"movl %%edx, %3;\n\t"
#if defined(__i386__)
"popl %%ebx;\n\t"
#endif
:"=m" (eax), "=m" (ebx), "=m" (ecx), "=m" (edx)
:"r" (cpuid_leaf)
:"%eax",
#if !defined(__i386__)
"%ebx",
#endif
"%ecx", "%edx");
static void __cpuid(int info[4], int x)
{
#if defined __FreeBSD__
do_cpuid((unsigned int)x, (unsigned int*)info);
#else
unsigned int eax = x, ebx = 0, ecx = 0, edx = 0;
do_cpuid(&eax, &ebx, &ecx, &edx);
info[0] = eax;
info[1] = ebx;
info[2] = ecx;
info[3] = edx;
#endif
regs[0] = eax;
regs[1] = ebx;
regs[2] = ecx;
regs[3] = edx;
}
#endif
#endif
#include "Common.h"

View File

@ -29,6 +29,12 @@
#pragma warning (disable:4100)
#endif
#ifdef __arm__
#if !defined(ARM)
#define ARM
#endif
#endif
#if defined(ARM)
#define _M_ARM32
#endif

View File

@ -23,6 +23,12 @@
#ifndef _COMMONTYPES_H_
#define _COMMONTYPES_H_
#ifdef __arm__
#if !defined(ARM)
#define ARM
#endif
#endif
#ifdef _WIN32
typedef unsigned __int8 u8;

View File

@ -17,6 +17,12 @@
#pragma once
#ifdef __arm__
#if !defined(ARM)
#define ARM
#endif
#endif
#define NOTICE_LEVEL 1 // VERY important information that is NOT errors. Like startup and debugprintfs from the game itself.
#define ERROR_LEVEL 2 // Important errors.
#define WARNING_LEVEL 3 // Something is suspicious.

View File

@ -387,4 +387,4 @@ void Jit::Comp_DoNothing(u32 op) { }
// mov eax, [table+eax]
// mov dreg, [eax+offreg]
}
}

View File

@ -17,6 +17,8 @@
#pragma once
#include "Common/Common.h"
#if defined(ARM)
#include "../ARM/ArmJit.h"
#else

View File

@ -19,6 +19,7 @@
#include <cmath>
#include "Common/Common.h"
#include "../Core.h"
#include "MIPS.h"
#include "MIPSInt.h"

View File

@ -26,7 +26,7 @@ LOCAL_MODULE := ppsspp_jni
NATIVE := ../../native
SRC := ../..
LOCAL_CFLAGS := -DUSE_PROFILER -DARM -DGL_GLEXT_PROTOTYPES -DUSING_GLES2 -O2 -fsigned-char -Wall -Wno-multichar -Wno-psabi -Wno-unused-variable -fno-strict-aliasing -ffast-math
LOCAL_CFLAGS := -DUSE_PROFILER -DGL_GLEXT_PROTOTYPES -DUSING_GLES2 -O2 -fsigned-char -Wall -Wno-multichar -Wno-psabi -Wno-unused-variable -fno-strict-aliasing -ffast-math
# yes, it's really CPPFLAGS for C++
LOCAL_CPPFLAGS := -std=gnu++0x
LOCAL_C_INCLUDES := \
@ -43,13 +43,81 @@ LOCAL_LDLIBS := -lz -lGLESv2 -ldl -llog
# $(SRC)/Core/EmuThread.cpp \
# http://software.intel.com/en-us/articles/getting-started-on-optimizing-ndk-project-for-multiple-cpu-architectures
ifeq ($(TARGET_ARCH_ABI),x86)
LOCAL_CFLAGS := $(LOCAL_CFLAGS) -D_M_IX86
ARCH_FILES := \
$(SRC)/Common/ABI.cpp \
$(SRC)/Common/x64Emitter.cpp \
$(SRC)/Common/CPUDetect.cpp \
$(SRC)/Common/Thunk.cpp \
$(SRC)/Core/MIPS/x86/JitCache.cpp \
$(SRC)/Core/MIPS/x86/CompALU.cpp \
$(SRC)/Core/MIPS/x86/CompBranch.cpp \
$(SRC)/Core/MIPS/x86/CompFPU.cpp \
$(SRC)/Core/MIPS/x86/CompLoadStore.cpp \
$(SRC)/Core/MIPS/x86/CompVFPU.cpp \
$(SRC)/Core/MIPS/x86/Asm.cpp \
$(SRC)/Core/MIPS/x86/Jit.cpp \
$(SRC)/Core/MIPS/x86/RegCache.cpp \
$(SRC)/Core/MIPS/x86/RegCacheFPU.cpp
endif
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
LOCAL_CFLAGS := $(LOCAL_CFLAGS) -DARM -DARMV7
ARCH_FILES := \
$(SRC)/Common/ArmEmitter.cpp \
$(SRC)/Common/ArmCPUDetect.cpp \
$(SRC)/Common/ArmThunk.cpp \
$(SRC)/Core/MIPS/ARM/ArmJitCache.cpp \
$(SRC)/Core/MIPS/ARM/ArmCompALU.cpp \
$(SRC)/Core/MIPS/ARM/ArmCompBranch.cpp \
$(SRC)/Core/MIPS/ARM/ArmCompFPU.cpp \
$(SRC)/Core/MIPS/ARM/ArmCompLoadStore.cpp \
$(SRC)/Core/MIPS/ARM/ArmCompVFPU.cpp \
$(SRC)/Core/MIPS/ARM/ArmAsm.cpp \
$(SRC)/Core/MIPS/ARM/ArmJit.cpp \
$(SRC)/Core/MIPS/ARM/ArmRegCache.cpp \
$(SRC)/Core/MIPS/ARM/ArmRegCacheFPU.cpp \
ArmEmitterTest.cpp \
endif
ifeq ($(TARGET_ARCH_ABI),armeabi)
LOCAL_CFLAGS := $(LOCAL_CFLAGS) -DARM
ARCH_FILES := \
$(SRC)/Common/ArmEmitter.cpp \
$(SRC)/Common/ArmCPUDetect.cpp \
$(SRC)/Common/ArmThunk.cpp \
$(SRC)/Core/MIPS/ARM/ArmJitCache.cpp \
$(SRC)/Core/MIPS/ARM/ArmCompALU.cpp \
$(SRC)/Core/MIPS/ARM/ArmCompBranch.cpp \
$(SRC)/Core/MIPS/ARM/ArmCompFPU.cpp \
$(SRC)/Core/MIPS/ARM/ArmCompLoadStore.cpp \
$(SRC)/Core/MIPS/ARM/ArmCompVFPU.cpp \
$(SRC)/Core/MIPS/ARM/ArmAsm.cpp \
$(SRC)/Core/MIPS/ARM/ArmJit.cpp \
$(SRC)/Core/MIPS/ARM/ArmRegCache.cpp \
$(SRC)/Core/MIPS/ARM/ArmRegCacheFPU.cpp \
ArmEmitterTest.cpp \
endif
LOCAL_SRC_FILES := \
$(ARCH_FILES) \
NativeApp.cpp \
EmuScreen.cpp \
MenuScreens.cpp \
UIShader.cpp \
GamepadEmu.cpp \
ArmEmitterTest.cpp \
TestRunner.cpp \
ui_atlas.cpp \
$(SRC)/native/android/app-android.cpp \
@ -62,9 +130,6 @@ LOCAL_SRC_FILES := \
$(SRC)/ext/libkirk/kirk_engine.c \
$(SRC)/ext/snappy/snappy-c.cpp \
$(SRC)/ext/snappy/snappy.cpp \
$(SRC)/Common/ArmEmitter.cpp \
$(SRC)/Common/ArmCPUDetect.cpp \
$(SRC)/Common/ArmThunk.cpp \
$(SRC)/Common/LogManager.cpp \
$(SRC)/Common/MemArena.cpp \
$(SRC)/Common/MemoryUtil.cpp \
@ -179,16 +244,6 @@ LOCAL_SRC_FILES := \
$(SRC)/Core/MIPS/MIPSCodeUtils.cpp \
$(SRC)/Core/MIPS/MIPSDebugInterface.cpp \
$(SRC)/Core/MIPS/JitCommon/JitCommon.cpp \
$(SRC)/Core/MIPS/ARM/ArmJitCache.cpp \
$(SRC)/Core/MIPS/ARM/ArmCompALU.cpp \
$(SRC)/Core/MIPS/ARM/ArmCompBranch.cpp \
$(SRC)/Core/MIPS/ARM/ArmCompFPU.cpp \
$(SRC)/Core/MIPS/ARM/ArmCompLoadStore.cpp \
$(SRC)/Core/MIPS/ARM/ArmCompVFPU.cpp \
$(SRC)/Core/MIPS/ARM/ArmAsm.cpp \
$(SRC)/Core/MIPS/ARM/ArmJit.cpp \
$(SRC)/Core/MIPS/ARM/ArmRegCache.cpp \
$(SRC)/Core/MIPS/ARM/ArmRegCacheFPU.cpp \
$(SRC)/Core/Util/BlockAllocator.cpp \
$(SRC)/Core/Util/ppge_atlas.cpp \
$(SRC)/Core/Util/PPGeDraw.cpp \

View File

@ -1,4 +1,4 @@
APP_STL := stlport_static
APP_ABI := armeabi-v7a armeabi
APP_ABI := armeabi-v7a armeabi x86
#APP_ABI := armeabi-v7a

View File

@ -50,7 +50,9 @@
#include "MenuScreens.h"
#include "UIShader.h"
#ifdef ARM
#include "ArmEmitterTest.h"
#endif
Texture *uiTexture;
@ -162,7 +164,7 @@ void NativeGetAppInfo(std::string *app_dir_name, std::string *app_nice_name, boo
*app_dir_name = "ppsspp";
*landscape = true;
#if defined(ANDROID)
#if defined(ARM) && defined(ANDROID)
ArmEmitterTest();
#endif
}

View File

@ -15,4 +15,4 @@ public class PpssppActivity extends NativeActivity {
{
return false;
}
}
}

2
native

@ -1 +1 @@
Subproject commit b73af1e9c441e6667ab2f05df31cee90ce0cae2a
Subproject commit 4fef50245deeb14253372704684586aa85e9e21f