-
Notifications
You must be signed in to change notification settings - Fork 166
Provide initial definition for __remill_sync_hyper_call
#611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 24 commits
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 a416078
Fill in a few more cases
tetsuo-cpp 24e29a3
Merge remote-tracking branch 'origin/master' into alex/x86-sync-hyper…
tetsuo-cpp e58a2f2
Use `state.addr_to_load` for LGDT and LIDT operands
tetsuo-cpp d53129d
Fix variable names
tetsuo-cpp 41862cb
Cross-compile the Remill runtimes
tetsuo-cpp fcd24b2
Create temp variable for `lgdt` and `lidt` handling
tetsuo-cpp a544677
Add intrinsics for SPARC emulate instruction calls
tetsuo-cpp 72035aa
Create intrinsics for remaining hyper calls
tetsuo-cpp 295da65
Remove `__remill_sync_hyper_call` implementations in tests
tetsuo-cpp 0abe52a
Create the target triple based on the provided arch
tetsuo-cpp 09f16b7
Provide ARCH parameter for SPARC archs
tetsuo-cpp 2d85bb0
CMake formatting
tetsuo-cpp 1b3bbe6
Switch the conditions around
tetsuo-cpp 03f764c
Adjust target triple
tetsuo-cpp 65ccf60
Cross-compile the hyper calls and then link them into the runtime
tetsuo-cpp 76e48b1
Cleanup
tetsuo-cpp 85eebbe
Prefix int types with namespace
tetsuo-cpp a8c4174
Include `<limits>`
tetsuo-cpp 20a749c
Fix `lgdt` and `lidt` handling
tetsuo-cpp 79657e6
Mark new intrinsics as "used"
tetsuo-cpp 9c8cf03
Add placeholder intrinsic definitions to tests
tetsuo-cpp db18a75
Complete list of intrinsic definitions
tetsuo-cpp f33de27
Merge remote-tracking branch 'origin/master' into alex/x86-sync-hyper…
tetsuo-cpp 35a9723
Mark hyper call definition with `always_inline`
tetsuo-cpp e49e709
Use `_BitInt` if available
tetsuo-cpp de9e5e5
Merge remote-tracking branch 'origin/master' into alex/x86-sync-hyper…
tetsuo-cpp b93978a
Use `__builtin_unreachable` instead of `abort`
tetsuo-cpp 0574f2a
Leave comment explaining `always_inline` attribute
tetsuo-cpp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /* | ||
| * Copyright (c) 2022 Trail of Bits, Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #ifndef __has_include | ||
| # define __has_include(...) 0 | ||
| #endif | ||
|
|
||
| #ifndef __has_builtin | ||
| # define __has_builtin(...) 0 | ||
| #endif | ||
|
|
||
| #ifndef __is_identifier | ||
| # define __is_identifier(...) 1 | ||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,7 @@ | |
|
|
||
| #pragma once | ||
|
|
||
| #include <cstdint> | ||
| #include "Int.h" | ||
|
|
||
| class SyncHyperCall { | ||
| public: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| /* | ||
| * Copyright (c) 2022 Trail of Bits, Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "Builtin.h" | ||
|
|
||
| #if __has_include(<cstdint>) | ||
| # include <cstdint> | ||
| #elif __has_include(<cinttypes>) | ||
| # include <cinttypes> | ||
| #else | ||
|
|
||
| #define REMILL_CUSTOM_INT_TYPES 1 | ||
|
|
||
| using size_t = decltype(sizeof(int)); | ||
|
|
||
| template <size_t kDesiredSize, typename... Ts> | ||
| struct TypeSelector; | ||
|
|
||
| template <size_t kDesiredSize, size_t kXorSize, typename... Ts> | ||
| struct TypeSelectorImpl; | ||
|
|
||
| template <size_t kDesiredSize, size_t kXorSize, typename T, typename... Ts> | ||
| struct TypeSelectorImpl<kDesiredSize, kXorSize, T, Ts...> | ||
| : public TypeSelector<kDesiredSize, Ts...> {}; | ||
|
|
||
| template <size_t kDesiredSize, typename T, typename... Ts> | ||
| struct TypeSelectorImpl<kDesiredSize, 0, T, Ts...> { | ||
| using Type = T; | ||
| }; | ||
|
|
||
| template <size_t kDesiredSize> | ||
| struct TypeSelector<kDesiredSize> { | ||
| using Type = void; | ||
| }; | ||
|
|
||
| template <size_t kDesiredSize, typename T, typename... Ts> | ||
| struct TypeSelector<kDesiredSize, T, Ts...> | ||
| : public TypeSelectorImpl<kDesiredSize, sizeof(T) ^ kDesiredSize, T, Ts...> {}; | ||
|
|
||
| using int8_t = signed char; | ||
| using uint8_t = unsigned char; | ||
| using int16_t = TypeSelector<2, short, int, long, long long>::Type; | ||
| using uint16_t = TypeSelector<2, unsigned short, unsigned, unsigned long, unsigned long long>::Type; | ||
| using int32_t = TypeSelector<4, int, long, long long>::Type; | ||
| using uint32_t = TypeSelector<4, unsigned, unsigned long, unsigned long long>::Type; | ||
| using int64_t = TypeSelector<8, int, long, long long>::Type; | ||
| using uint64_t = TypeSelector<8, unsigned, unsigned long, unsigned long long>::Type; | ||
|
|
||
| #endif // cstint, cinttypes | ||
|
|
||
| #if !defined(REMILL_DISABLE_INT128) | ||
| #if defined(__x86_64__) || defined(__i386__) || defined(_M_X86) || defined (__arm__) | ||
| typedef unsigned uint128_t __attribute__((mode(TI))); | ||
| typedef int int128_t __attribute__((mode(TI))); | ||
| #elif defined(__aarch64__) | ||
| typedef __uint128_t uint128_t; | ||
| typedef __int128_t int128_t; | ||
| #elif defined(__sparc__) | ||
| typedef __uint128_t uint128_t; | ||
| typedef __int128_t int128_t; | ||
| #elif defined(__is_identifier) && __is_identifier(_ExtInt) | ||
| typedef unsigned _ExtInt(128) uint128_t; | ||
| typedef signed _ExtInt(128) int128_t; | ||
| #else | ||
| #error "Unable to identify u/int128 type." | ||
| #endif | ||
|
|
||
| static_assert(sizeof(int128_t) == 16, "Invalid size for `int128_t`."); | ||
| static_assert(sizeof(uint128_t) == 16, "Invalid size for `uint128_t`."); | ||
| #endif // `!defined(REMILL_DISABLE_INT128)` | ||
|
|
||
| #ifdef REMILL_CUSTOM_INT_TYPES | ||
| namespace std { | ||
| inline namespace __remill { | ||
| using size_t = ::size_t; | ||
| using uint8_t = ::uint8_t; | ||
| using uint16_t = ::uint16_t; | ||
| using uint32_t = ::uint32_t; | ||
| using uint64_t = ::uint64_t; | ||
| using int8_t = ::int8_t; | ||
| using int16_t = ::int16_t; | ||
| using int32_t = ::int32_t; | ||
| using int64_t = ::int64_t; | ||
| } // namespace __remill | ||
| } // namespace std | ||
| #endif // REMILL_CUSTOM_INT_TYPES | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.