Skip to content

Commit

Permalink
Merge pull request #50 from yomaytk/fix-cicd
Browse files Browse the repository at this point in the history
Fix for using x86 host arch.
  • Loading branch information
yomaytk authored Jun 18, 2024
2 parents 94caf90 + e17c56b commit 667c045
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
16 changes: 8 additions & 8 deletions backend/remill/lib/Arch/Arch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,42 +179,42 @@ auto Arch::GetArchByName(llvm::LLVMContext *context_, OSName os_name_,

case kArchX86: {
DLOG(INFO) << "Using architecture: X86";
return GetUndefinedArch(context_, os_name_, arch_name_);
return GetX86(context_, os_name_, arch_name_);
}

case kArchX86_SLEIGH: {
DLOG(INFO) << "Using architecture: X86_Sleigh";
return GetUndefinedArch(context_, os_name_, arch_name_);
return GetSleighX86(context_, os_name_, arch_name_);
}

case kArchAMD64_SLEIGH: {
DLOG(INFO) << "Using architecture: X86_Sleigh";
return GetUndefinedArch(context_, os_name_, arch_name_);
return GetSleighX86(context_, os_name_, arch_name_);
}

case kArchX86_AVX: {
DLOG(INFO) << "Using architecture: X86, feature set: AVX";
return GetUndefinedArch(context_, os_name_, arch_name_);
return GetX86(context_, os_name_, arch_name_);
}

case kArchX86_AVX512: {
DLOG(INFO) << "Using architecture: X86, feature set: AVX512";
return GetUndefinedArch(context_, os_name_, arch_name_);
return GetX86(context_, os_name_, arch_name_);
}

case kArchAMD64: {
DLOG(INFO) << "Using architecture: AMD64";
return GetUndefinedArch(context_, os_name_, arch_name_);
return GetX86(context_, os_name_, arch_name_);
}

case kArchAMD64_AVX: {
DLOG(INFO) << "Using architecture: AMD64, feature set: AVX";
return GetUndefinedArch(context_, os_name_, arch_name_);
return GetX86(context_, os_name_, arch_name_);
}

case kArchAMD64_AVX512: {
DLOG(INFO) << "Using architecture: AMD64, feature set: AVX512";
return GetUndefinedArch(context_, os_name_, arch_name_);
return GetX86(context_, os_name_, arch_name_);
}

case kArchSparc32: {
Expand Down
4 changes: 2 additions & 2 deletions backend/remill/lib/Arch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ add_subdirectory(AArch64)
# add_subdirectory(SPARC32)
# add_subdirectory(SPARC64)
add_subdirectory(Sleigh)
# add_subdirectory(X86)
add_subdirectory(X86)

set_property(TARGET remill_arch PROPERTY POSITION_INDEPENDENT_CODE ON)

Expand All @@ -41,7 +41,7 @@ target_link_libraries(remill_arch LINK_PUBLIC
remill_arch_sleigh
# remill_arch_sparc32
# remill_arch_sparc64
# remill_arch_x86
remill_arch_x86
LINK_PRIVATE
remill_settings
)
Expand Down
14 changes: 9 additions & 5 deletions backend/remill/lib/Arch/Runtime/HyperCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@
void __remill_sync_hyper_call(State &state, RuntimeManager *runtime_manager,
SyncHyperCall::Name call) {

#if REMILL_HYPERCALL_X86
#if false
# if REMILL_HYPERCALL_X86
register uint32_t esp asm("esp") = state.gpr.rsp.dword;
register uint32_t ebp asm("ebp") = state.gpr.rbp.dword;
#elif REMILL_HYPERCALL_AMD64
# elif REMILL_HYPERCALL_AMD64
register uint64_t rsp asm("rsp") = state.gpr.rsp.qword;
register uint64_t rbp asm("rbp") = state.gpr.rbp.qword;
register uint64_t r8 asm("r8") = state.gpr.r8.qword;
Expand All @@ -62,11 +63,13 @@ void __remill_sync_hyper_call(State &state, RuntimeManager *runtime_manager,
register uint64_t r13 asm("r13") = state.gpr.r13.qword;
register uint64_t r14 asm("r14") = state.gpr.r14.qword;
register uint64_t r15 asm("r15") = state.gpr.r15.qword;
# endif
#endif

switch (call) {

#if REMILL_HYPERCALL_X86 || REMILL_HYPERCALL_AMD64
#if false
# if REMILL_HYPERCALL_X86 || REMILL_HYPERCALL_AMD64

case SyncHyperCall::kX86CPUID:
asm volatile("cpuid"
Expand Down Expand Up @@ -132,7 +135,7 @@ void __remill_sync_hyper_call(State &state, RuntimeManager *runtime_manager,

case SyncHyperCall::kX86SetSegmentGS: mem = __remill_x86_set_segment_gs(mem); break;

# if REMILL_HYPERCALL_X86
# if REMILL_HYPERCALL_X86

case SyncHyperCall::kX86SetDebugReg: mem = __remill_x86_set_debug_reg(mem); break;

Expand Down Expand Up @@ -171,7 +174,7 @@ void __remill_sync_hyper_call(State &state, RuntimeManager *runtime_manager,
"r"(esp), "r"(ebp));
break;

# elif REMILL_HYPERCALL_AMD64
# elif REMILL_HYPERCALL_AMD64

case SyncHyperCall::kAMD64SetDebugReg: mem = __remill_amd64_set_debug_reg(mem); break;

Expand Down Expand Up @@ -215,6 +218,7 @@ void __remill_sync_hyper_call(State &state, RuntimeManager *runtime_manager,
"r"(r14), "r"(r15));
break;

# endif
# endif

#elif REMILL_HYPERCALL_ARM
Expand Down
2 changes: 1 addition & 1 deletion backend/remill/lib/Arch/Sleigh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ add_library(remill_arch_sleigh STATIC
Thumb.h
# PPC.h
Arch.cpp
# X86Arch.cpp
X86Arch.cpp
# Thumb2Arch.cpp
# PPCArch.cpp
ControlFlowStructuring.cpp
Expand Down
2 changes: 1 addition & 1 deletion backend/remill/lib/Arch/X86/Runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ cmake_minimum_required(VERSION 3.6)
project(x86_runtime)

set(X86RUNTIME_SOURCEFILES
Instructions.cpp
# Instructions.cpp
BasicBlock.cpp

"${REMILL_LIB_DIR}/Arch/Runtime/Intrinsics.cpp"
Expand Down

0 comments on commit 667c045

Please sign in to comment.