Skip to content

Support PowerPC syscall#653

Merged
tetsuo-cpp merged 6 commits intomasterfrom
alex/ppc-syscall
Feb 16, 2023
Merged

Support PowerPC syscall#653
tetsuo-cpp merged 6 commits intomasterfrom
alex/ppc-syscall

Conversation

@tetsuo-cpp
Copy link
Contributor

No description provided.

@tetsuo-cpp
Copy link
Contributor Author

The unit test still seems to be failing. It doesn't seem to have access to the runtime as it complains about missing __remill_sync_hyper_call when trying to execute it.

@Ninja3047
Copy link
Collaborator

The unit test still seems to be failing. It doesn't seem to have access to the runtime as it complains about missing __remill_sync_hyper_call when trying to execute it.

i think a stub implementation needs to be added here similar to how we have implementations for __remill_read_memory_8 and others?
https://github.com/lifting-bits/remill/blob/master/test_runner_lib/TestRunner.cpp

break;

case SyncHyperCall::kPPCSysCall:
mem = __remill_ppc_syscall(mem);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, I don't think we can implement this with inline asm like we've been doing for the x86 and ARM syscalls. The GCC/Clang inline assembly machine constraints for PowerPC don't seem to allow you to specify a particular register.

Copy link
Collaborator

@Ninja3047 Ninja3047 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@tetsuo-cpp
Copy link
Contributor Author

Ping @2over12 @lkorenc. This is good to go.

Copy link
Contributor

@2over12 2over12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM if we can use the LoadMemoryPointerRef utility Id like to do that

std::array<llvm::Value *, 3> args = {state_pointer, mem_ptr_ref,
hyper_call};

bldr.CreateCall(insn_lifter_parent.GetIntrinsicTable()->sync_hyper_call,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So is the reasoning here for why we need a custom signature for this sync call because we want to pass the type sync call explicitly? Just wondering why we cant take the strategy of other intrinsic hyper calls where it's a typical (state,PC,memory) lifted function and we can use AddCall transparently.

Copy link
Contributor Author

@tetsuo-cpp tetsuo-cpp Feb 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep that's correct. With __remill_sync_hyper_call, we need to provide a Name enumeration to signal what kind of sync call we're making. So AddCall doesn't work for us here.

@tetsuo-cpp tetsuo-cpp merged commit 1818fc8 into master Feb 16, 2023
@tetsuo-cpp tetsuo-cpp deleted the alex/ppc-syscall branch February 16, 2023 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants