Skip to content

Commit

Permalink
Count executed instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
momo5502 committed Sep 8, 2024
1 parent 4d0d197 commit 9c5b65b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/windows_emulator/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,11 +742,11 @@ namespace
const emulator_object<machine_frame> machine_frame_obj{emu, new_sp + combined_size};
machine_frame_obj.access([&](machine_frame& frame)
{
frame.rip = pointers.ContextRecord->Rip;
frame.rsp = pointers.ContextRecord->Rsp;
frame.ss = pointers.ContextRecord->SegSs;
frame.cs = pointers.ContextRecord->SegCs;
frame.eflags = pointers.ContextRecord->EFlags;
frame.rip = pointers.ContextRecord->Rip;
frame.rsp = pointers.ContextRecord->Rsp;
frame.ss = pointers.ContextRecord->SegSs;
frame.cs = pointers.ContextRecord->SegCs;
frame.eflags = pointers.ContextRecord->EFlags;
});

printf("ContextRecord: %llX\n", context_record_obj.value());
Expand Down Expand Up @@ -850,6 +850,7 @@ namespace
*/
emu->hook_memory_execution(0, std::numeric_limits<size_t>::max(), [&](const uint64_t address, const size_t)
{
++context.executed_instructions;
if (!context.verbose)
{
return;
Expand Down
1 change: 1 addition & 0 deletions src/windows_emulator/process_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ struct file

struct process_context
{
uint64_t executed_instructions{0};
emulator_object<TEB> teb{};
emulator_object<PEB> peb{};
emulator_object<RTL_USER_PROCESS_PARAMETERS> process_params{};
Expand Down

0 comments on commit 9c5b65b

Please sign in to comment.