Merge pull request #378 from joshuawarner32/arm64-interpret-ios

Add support for 'platform=ios arch=arm64 process=interpret' build
This commit is contained in:
Joel Dice 2014-12-09 17:11:55 -07:00
commit ba4f4a0faa
5 changed files with 33 additions and 19 deletions

View File

@ -81,13 +81,13 @@ endif
ifeq ($(platform),macosx)
ifneq ($(filter arm arm64,$(arch)),)
x := $(error "please use 'arch=arm' or 'arch=arm64' 'platform=ios' to build for ios-arm")
x := $(error "please use ('arch=arm' or 'arch=arm64') 'platform=ios' to build for ios-arm")
endif
endif
ifeq ($(platform),ios)
ifeq ($(filter arm i386,$(arch)),)
x := $(error "please specify 'arch=i386' or 'arch=arm' with 'platform=ios'")
ifeq ($(filter i386 arm arm64,$(arch)),)
x := $(error "please specify 'arch=i386', 'arch=arm', or 'arch=arm64' with 'platform=ios'")
endif
endif

View File

@ -51,7 +51,7 @@ GLOBAL(vmNativeCall):
mov w23, w6
// setup stack arguments if necessary
sub sp, sp, w20 // allocate stack
sub sp, sp, w20, uxtw // allocate stack
mov x9, sp
LOCAL(loop):
cmp w3, wzr
@ -79,16 +79,16 @@ LOCAL(populateVFPs):
LOCAL(doCall):
blr x19 // call function
add sp, sp, w20 // deallocate stack
add sp, sp, w20, uxtw // deallocate stack
cmp w23,#FLOAT_TYPE
bne LOCAL(double)
b.ne LOCAL(double)
fmov w0,s0
b LOCAL(exit)
LOCAL(double):
cmp w23,#DOUBLE_TYPE
bne LOCAL(exit)
b.ne LOCAL(exit)
fmov x0,d0
LOCAL(exit):

View File

@ -34,7 +34,11 @@
#define THREAD_STATE_IP(state) ((state).FIELD(pc))
#define THREAD_STATE_STACK(state) ((state).FIELD(sp))
#if (defined __APPLE__) && (defined ARCH_arm64)
#define THREAD_STATE_THREAD(state) ((state).FIELD(x[19]))
#else
#define THREAD_STATE_THREAD(state) ((state).FIELD(r[8]))
#endif
#define THREAD_STATE_LINK(state) ((state).FIELD(lr))
#define IP_REGISTER(context) THREAD_STATE_IP(context->uc_mcontext->FIELD(ss))

View File

@ -50,20 +50,11 @@ bool writeObject(uint8_t* data,
OutputStream* out,
const char* startName,
const char* endName,
const char* format,
const char* architecture,
Platform* platform,
unsigned alignment,
bool writable,
bool executable)
{
Platform* platform = Platform::getPlatform(
PlatformInfo(PlatformInfo::formatFromString(format),
PlatformInfo::archFromString(architecture)));
if (!platform) {
fprintf(stderr, "unsupported platform: %s/%s\n", format, architecture);
return false;
}
SymbolInfo symbols[] = {SymbolInfo(0, startName), SymbolInfo(size, endName)};
@ -113,6 +104,19 @@ int main(int argc, const char** argv)
}
}
const char* format = argv[5];
const char* architecture = argv[6];
Platform* platform = Platform::getPlatform(
PlatformInfo(PlatformInfo::formatFromString(format),
PlatformInfo::archFromString(architecture)));
if (!platform) {
fprintf(stderr, "unsupported platform: %s/%s\n", format, architecture);
return 1;
}
uint8_t* data = 0;
unsigned size;
int fd = open(argv[1], O_RDONLY);
@ -148,8 +152,7 @@ int main(int argc, const char** argv)
&out,
argv[3],
argv[4],
argv[5],
argv[6],
platform,
alignment,
writable,
executable);

View File

@ -33,10 +33,12 @@
#define CPU_TYPE_I386 7
#define CPU_TYPE_X86_64 (CPU_TYPE_I386 | CPU_ARCH_ABI64)
#define CPU_TYPE_ARM 12
#define CPU_TYPE_ARM64 (CPU_TYPE_ARM | CPU_ARCH_ABI64)
#define CPU_SUBTYPE_I386_ALL 3
#define CPU_SUBTYPE_X86_64_ALL CPU_SUBTYPE_I386_ALL
#define CPU_SUBTYPE_ARM_V7 9
#define CPU_SUBTYPE_ARM_V8 13
namespace {
@ -157,6 +159,10 @@ class MachOPlatform : public Platform {
cpuType = CPU_TYPE_ARM;
cpuSubType = CPU_SUBTYPE_ARM_V7;
break;
case PlatformInfo::Arm64:
cpuType = CPU_TYPE_ARM64;
cpuSubType = CPU_SUBTYPE_ARM_V8;
break;
default:
// should never happen (see MachOPlatform declarations at bottom)
fprintf(stderr, "unsupported architecture: %d\n", info.arch);
@ -280,6 +286,7 @@ class MachOPlatform : public Platform {
MachOPlatform<uint32_t> darwinx86Platform(PlatformInfo::x86);
MachOPlatform<uint32_t> darwinArmPlatform(PlatformInfo::Arm);
MachOPlatform<uint64_t> darwinArm64Platform(PlatformInfo::Arm64);
MachOPlatform<uint64_t> darwinx86_64Platform(PlatformInfo::x86_64);
} // namespace