Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8e37d80
Create initial implementation of `__remill_sync_hyper_call`
tetsuo-cpp Jul 27, 2022
a416078
Fill in a few more cases
tetsuo-cpp Jul 28, 2022
24e29a3
Merge remote-tracking branch 'origin/master' into alex/x86-sync-hyper…
tetsuo-cpp Aug 4, 2022
e58a2f2
Use `state.addr_to_load` for LGDT and LIDT operands
tetsuo-cpp Aug 4, 2022
d53129d
Fix variable names
tetsuo-cpp Aug 8, 2022
41862cb
Cross-compile the Remill runtimes
tetsuo-cpp Aug 9, 2022
fcd24b2
Create temp variable for `lgdt` and `lidt` handling
tetsuo-cpp Aug 10, 2022
a544677
Add intrinsics for SPARC emulate instruction calls
tetsuo-cpp Aug 10, 2022
72035aa
Create intrinsics for remaining hyper calls
tetsuo-cpp Aug 10, 2022
295da65
Remove `__remill_sync_hyper_call` implementations in tests
tetsuo-cpp Aug 10, 2022
0abe52a
Create the target triple based on the provided arch
tetsuo-cpp Aug 10, 2022
09f16b7
Provide ARCH parameter for SPARC archs
tetsuo-cpp Aug 10, 2022
2d85bb0
CMake formatting
tetsuo-cpp Aug 10, 2022
1b3bbe6
Switch the conditions around
tetsuo-cpp Aug 10, 2022
03f764c
Adjust target triple
tetsuo-cpp Aug 10, 2022
65ccf60
Cross-compile the hyper calls and then link them into the runtime
tetsuo-cpp Aug 12, 2022
76e48b1
Cleanup
tetsuo-cpp Aug 12, 2022
85eebbe
Prefix int types with namespace
tetsuo-cpp Aug 12, 2022
a8c4174
Include `<limits>`
tetsuo-cpp Aug 14, 2022
20a749c
Fix `lgdt` and `lidt` handling
tetsuo-cpp Aug 14, 2022
79657e6
Mark new intrinsics as "used"
tetsuo-cpp Aug 14, 2022
9c8cf03
Add placeholder intrinsic definitions to tests
tetsuo-cpp Aug 14, 2022
db18a75
Complete list of intrinsic definitions
tetsuo-cpp Aug 14, 2022
f33de27
Merge remote-tracking branch 'origin/master' into alex/x86-sync-hyper…
tetsuo-cpp Aug 14, 2022
35a9723
Mark hyper call definition with `always_inline`
tetsuo-cpp Aug 19, 2022
e49e709
Use `_BitInt` if available
tetsuo-cpp Aug 19, 2022
de9e5e5
Merge remote-tracking branch 'origin/master' into alex/x86-sync-hyper…
tetsuo-cpp Aug 22, 2022
b93978a
Use `__builtin_unreachable` instead of `abort`
tetsuo-cpp Aug 22, 2022
0574f2a
Leave comment explaining `always_inline` attribute
tetsuo-cpp Aug 22, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions include/remill/Arch/Runtime/Intrinsics.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ __remill_write_io_port_16(Memory *, addr_t, uint16_t);
[[gnu::used, gnu::const]] extern Memory *
__remill_write_io_port_32(Memory *, addr_t, uint32_t);

// More specific hyper calls.
[[gnu::used, gnu::const]] extern Memory *
__remill_aarch64_emulate_instruction(Memory *);

Expand All @@ -312,4 +313,7 @@ __remill_aarch32_emulate_instruction(Memory *);
[[gnu::used, gnu::const]] extern Memory *
__remill_aarch32_check_not_el2(Memory *);

[[gnu::used, gnu::const]] extern Memory *
__remill_sparc_unimplemented_instruction(Memory *);

} // extern C
15 changes: 7 additions & 8 deletions lib/Arch/Runtime/HyperCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,13 @@ Memory *__remill_sync_hyper_call(State &state, Memory *mem,
break;

case SyncHyperCall::kX86LoadGlobalDescriptorTable:
asm volatile("lgdt"
:
: "=m"(__remill_read_memory_64(mem, state.addr_to_load)));
auto read = __remill_read_memory_64(mem, state.addr_to_load);
asm volatile("lgdt" : : "m"(read));
break;

case SyncHyperCall::kX86LoadInterruptDescriptorTable:
asm volatile("lidt"
:
: "m"(__remill_read_memory_64(mem, state.addr_to_load)));
auto read = __remill_write_memory_64(mem, state.addr_to_load);
asm volatile("lidt" : : "m"(read));
break;

case SyncHyperCall::kX86ReadModelSpecificRegister:
Expand All @@ -66,7 +64,6 @@ Memory *__remill_sync_hyper_call(State &state, Memory *mem,
break;

case SyncHyperCall::kX86WriteBackInvalidate:
// NOTE(alex): This just clears cache so there's no affect on the state.
asm volatile("wbinvd" :);
break;

Expand Down Expand Up @@ -138,7 +135,9 @@ Memory *__remill_sync_hyper_call(State &state, Memory *mem,

case SyncHyperCall::kSPARCTagOverflow: break;

case SyncHyperCall::kSPARCUnimplementedInstruction: break;
case SyncHyperCall::kSPARCUnimplementedInstruction:
mem = __remill_sparc_unimplemented_instruction(mem);
break;

case SyncHyperCall::kSPARCUnhandledDCTI: break;

Expand Down