Fixing Windows build.

This commit is contained in:
Ben Vanik 2015-08-18 14:45:49 -07:00
parent 8b0d4fb51c
commit a668556d7f
4 changed files with 29 additions and 12 deletions

@ -1 +1 @@
Subproject commit 7c9845040311ae8a1964f6d4f6a4eef3530bb3d7
Subproject commit e28427bd7d2eb82f630d22914eefebf430f6fff6

View File

@ -61,14 +61,18 @@ bool X64Backend::Initialize() {
machine_info_.supports_extended_load_store = false;
}
machine_info_.register_sets[0] = (MachineInfo::RegisterSet){
0, "gpr", MachineInfo::RegisterSet::INT_TYPES, X64Emitter::GPR_COUNT,
};
machine_info_.register_sets[1] = (MachineInfo::RegisterSet){
1, "xmm", MachineInfo::RegisterSet::FLOAT_TYPES |
MachineInfo::RegisterSet::VEC_TYPES,
X64Emitter::XMM_COUNT,
};
auto& gprs = machine_info_.register_sets[0];
gprs.id = 0;
std::strcpy(gprs.name, "gpr");
gprs.types = MachineInfo::RegisterSet::INT_TYPES;
gprs.count = X64Emitter::GPR_COUNT;
auto& xmms = machine_info_.register_sets[1];
xmms.id = 1;
std::strcpy(xmms.name, "xmm");
xmms.types = MachineInfo::RegisterSet::FLOAT_TYPES |
MachineInfo::RegisterSet::VEC_TYPES;
xmms.count = X64Emitter::XMM_COUNT;
code_cache_ = X64CodeCache::Create();
Backend::code_cache_ = code_cache_.get();

View File

@ -84,9 +84,15 @@ ThreadState::ThreadState(Processor* processor, uint32_t thread_id,
}
assert_not_zero(stack_address_);
// Allocate with 64b alignment.
context_ =
reinterpret_cast<PPCContext*>(aligned_alloc(64, sizeof(PPCContext)));
// Allocate with 64b alignment.
#if __STDC_VERSION__ >= 201112L
void* context_ptr = aligned_alloc(64, sizeof(PPCContext));
#elif XE_COMPILER_MSVC
void* context_ptr = _aligned_malloc(sizeof(PPCContext), 64);
#else
#error No aligned alloc.
#endif
context_ = reinterpret_cast<PPCContext*>(context_ptr);
assert_true(((uint64_t)context_ & 0x3F) == 0);
std::memset(context_, 0, sizeof(PPCContext));
@ -111,7 +117,13 @@ ThreadState::~ThreadState() {
thread_state_ = nullptr;
}
#if __STDC_VERSION__ >= 201112L
free(context_);
#elif XE_COMPILER_MSVC
_aligned_free(context_);
#else
#error No aligned alloc.
#endif
if (stack_allocated_) {
memory()->LookupHeap(stack_address_)->Decommit(stack_address_, stack_size_);
}

View File

@ -50,3 +50,4 @@ project("capstone")
"-Wno-deprecated",
"-w",
})
filter({})