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_.supports_extended_load_store = false;
} }
machine_info_.register_sets[0] = (MachineInfo::RegisterSet){ auto& gprs = machine_info_.register_sets[0];
0, "gpr", MachineInfo::RegisterSet::INT_TYPES, X64Emitter::GPR_COUNT, gprs.id = 0;
}; std::strcpy(gprs.name, "gpr");
machine_info_.register_sets[1] = (MachineInfo::RegisterSet){ gprs.types = MachineInfo::RegisterSet::INT_TYPES;
1, "xmm", MachineInfo::RegisterSet::FLOAT_TYPES | gprs.count = X64Emitter::GPR_COUNT;
MachineInfo::RegisterSet::VEC_TYPES,
X64Emitter::XMM_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(); code_cache_ = X64CodeCache::Create();
Backend::code_cache_ = code_cache_.get(); 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_); assert_not_zero(stack_address_);
// Allocate with 64b alignment. // Allocate with 64b alignment.
context_ = #if __STDC_VERSION__ >= 201112L
reinterpret_cast<PPCContext*>(aligned_alloc(64, sizeof(PPCContext))); 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); assert_true(((uint64_t)context_ & 0x3F) == 0);
std::memset(context_, 0, sizeof(PPCContext)); std::memset(context_, 0, sizeof(PPCContext));
@ -111,7 +117,13 @@ ThreadState::~ThreadState() {
thread_state_ = nullptr; thread_state_ = nullptr;
} }
#if __STDC_VERSION__ >= 201112L
free(context_); free(context_);
#elif XE_COMPILER_MSVC
_aligned_free(context_);
#else
#error No aligned alloc.
#endif
if (stack_allocated_) { if (stack_allocated_) {
memory()->LookupHeap(stack_address_)->Decommit(stack_address_, stack_size_); memory()->LookupHeap(stack_address_)->Decommit(stack_address_, stack_size_);
} }

View File

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